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 GetAllKeyVersions API #2232
Conversation
@ajkr has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator. |
@ajkr updated the pull request - view changes - changes since last import |
LGTM, let's also add a simple test |
utilities/debug.cc
Outdated
break; | ||
} | ||
|
||
key_versions->emplace_back(); |
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.
this is okay but looks a bit strange to me, maybe we can add the constructor and use it in the emplace_back
but it's up to you
@ajkr updated the pull request - view changes - changes since last import |
@ajkr has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator. |
ping, i want to include this in 5.5 so our customer can start using it |
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.
Forgot to send out comments...
SequenceNumber sequence; | ||
// TODO(ajkr): we should provide a helper function that converts the int to a | ||
// string describing the type for easier debugging. | ||
int type; |
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.
Why not just get a enum?
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.
the authoritative enum is in db/dbformat.h and I didn't want to duplicate it. What do you suggest - duplicate it anyways since it'll almost never change?
utilities/debug.cc
Outdated
assert(key_versions != nullptr); | ||
key_versions->clear(); | ||
|
||
DBImpl* idb = dynamic_cast<DBImpl*>(db->GetRootDB()); |
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.
Either check whether idb is empty after dynamic casting or just do static cast. I'm voting for simply do static casting.
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.
ok
include/rocksdb/utilities/debug.h
Outdated
}; | ||
|
||
// Returns listing of all versions of keys in the provided user key range. | ||
// The range is inclusive-exclusive, i.e., [`begin_key`, `end_key`). |
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.
I think we should do inclusive end_key. Otherwise if they pass in the same key for begin and end key (and intuitive way if they assume this can return them versions for one specific key), the semantic is confusing.
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.
the reason for inclusive-exclusive was for compatibility with "ldb idump", which is exclusive of the end key. I can make the function return results for the inclusive-inclusive interval, and then filter out the end key in "ldb idump" to maintain compatibility.
@ajkr updated the pull request - view changes - changes since last import |
@ajkr has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator. |
GetAllKeyVersions()
, to return a listing of internal data for a range of user keys. The newstruct KeyVersion
exposes data similar to internal key without exposing any internal type.