-
Notifications
You must be signed in to change notification settings - Fork 429
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
*: add facility to print the iterator stack #3682
Conversation
This is really nice! A couple comments. Any way to annotate the level iters with level numbers? There's possibly other metadata that might be useful too? Position? Direction? Data iterated over so far, etc? Could this then be useful up in Cockroach, say, for trace spans - we can print this debug stack. It could supplement the iterator stats nicely. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TFTR!
I added the level for level iterators and filenum for "leaf" iterators.
I'm not sure right now how to use it during tracing, since it depends when you look at the tree. I think if we add more information, printing it at the end might be useful.
*pebble.Iterator(0x14003a0ea08)
├── *keyspan.InterleavingIter(0x14003ee2030)
│ ├── *invalidating.iter(0x14007c52f00)
│ │ └── *pebble.mergingIter(0x14003a0f028)
│ │ └── *pebble.levelIter(0x14003a0f3a0) L6: fileNum=001316
│ │ └── *sstable.singleLevelIterator(0x14004bce008) fileNum=001316
│ └── *keyspan.assertIter(0x14001229950)
│ └── *keyspan.DefragmentingIter(0x14003ee26e8)
│ └── *keyspan.BoundedIter(0x14003ee2678)
│ └── *keyspanimpl.MergingIter(0x14003ee2300)
│ └── *keyspanimpl.LevelIter(0x14003ee2788) L6
│ └── *keyspan.assertIter(0x14000753a70)
│ └── *sstable.fragmentBlockIter(0x140000ffb88) fileNum=001316
└── *invalidating.iter(0x14007c52f00)
└── *pebble.mergingIter(0x14003a0f028)
└── *pebble.levelIter(0x14003a0f3a0) L6: fileNum=001316
└── *sstable.singleLevelIterator(0x14004bce008) fileNum=001316
Reviewable status: 0 of 30 files reviewed, all discussions resolved (waiting on @jbowens)
98a2481
to
f64a665
Compare
Ok to merge? This has been useful when debugging some meta failures. |
Friendly ping |
f64a665
to
d0d572c
Compare
To print the entire iterator stack tree, we can now use `fmt.Printf("%s", base.DebugTree(iter))` to get something like this: ``` *pebble.Iterator(0x14003a0ea08) ├── *keyspan.InterleavingIter(0x14003ee2030) │ ├── *invalidating.iter(0x14007c52f00) │ │ └── *pebble.mergingIter(0x14003a0f028) │ │ └── *pebble.levelIter(0x14003a0f3a0) L6: fileNum=001316 │ │ └── *sstable.singleLevelIterator(0x14004bce008) fileNum=001316 │ └── *keyspan.assertIter(0x14001229950) │ └── *keyspan.DefragmentingIter(0x14003ee26e8) │ └── *keyspan.BoundedIter(0x14003ee2678) │ └── *keyspanimpl.MergingIter(0x14003ee2300) │ └── *keyspanimpl.LevelIter(0x14003ee2788) L6 │ └── *keyspan.assertIter(0x14000753a70) │ └── *sstable.fragmentBlockIter(0x140000ffb88) fileNum=001316 └── *invalidating.iter(0x14007c52f00) └── *pebble.mergingIter(0x14003a0f028) └── *pebble.levelIter(0x14003a0f3a0) L6: fileNum=001316 └── *sstable.singleLevelIterator(0x14004bce008) fileNum=001316 ```
d0d572c
to
41ddf83
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewed 4 of 30 files at r1, 2 of 19 files at r2, 3 of 15 files at r3.
Reviewable status: 9 of 34 files reviewed, all discussions resolved
TFTR! |
To print the entire iterator stack tree, we can now use
fmt.Printf("%s", base.DebugTree(iter))
to get something like this: