-
Notifications
You must be signed in to change notification settings - Fork 436
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
bugfix: counter cannot compact in mem leveldb #1283
Merged
Merged
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
7778b53
add code review and merge code rule
025d4c2
add code review and merge code rule
d86da6c
add code review and merge code rule
8b86460
add code review and merge code rule
11b6fe8
add code review and merge code rule
aeedead
Merge branch 'master' of github.com:baidu/tera into sla
a25c3e0
bugfix: counter cannot compact in mem leveldb
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,6 +19,46 @@ namespace leveldb { | |
Comparator::~Comparator() { } | ||
|
||
namespace { | ||
class RowKeyComparator : public Comparator { | ||
public: | ||
RowKeyComparator(const RawKeyOperator* key_operator) | ||
: key_operator_(key_operator) {} | ||
|
||
virtual const char* Name() const { | ||
return "leveldb.RowKeyComparator"; | ||
} | ||
|
||
virtual int Compare(const Slice& a, const Slice& b) const { | ||
Slice a_key, a_col, a_qual; | ||
Slice b_key, b_col, b_qual; | ||
int64_t a_ts = -1; | ||
int64_t b_ts = -1; | ||
leveldb::TeraKeyType a_type; | ||
leveldb::TeraKeyType b_type; | ||
|
||
if (!key_operator_->ExtractTeraKey(a, &a_key, &a_col, &a_qual, &a_ts, &a_type)) { | ||
return key_operator_->Compare(a, b); | ||
} | ||
if (!key_operator_->ExtractTeraKey(b, &b_key, &b_col, &b_qual, &b_ts, &b_type)) { | ||
return key_operator_->Compare(a, b); | ||
} | ||
return a_key.compare(b_key); | ||
} | ||
|
||
virtual void FindShortestSeparator( | ||
std::string* start, | ||
const Slice& limit) const { | ||
return; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 直接 |
||
} | ||
|
||
virtual void FindShortSuccessor(std::string* key) const { | ||
return; | ||
} | ||
|
||
private: | ||
const RawKeyOperator* key_operator_; | ||
}; | ||
|
||
class BytewiseComparatorImpl : public Comparator { | ||
public: | ||
BytewiseComparatorImpl() { } | ||
|
@@ -156,4 +196,8 @@ const Comparator* TeraTTLKvComparator() { | |
return terakv; | ||
} | ||
|
||
Comparator* NewRowKeyComparator(const RawKeyOperator* key_operator) { | ||
Comparator* cmp = new RowKeyComparator(key_operator); | ||
return cmp; | ||
} | ||
} // namespace leveldb |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
(可以不用判断NULL,直接delete;加上判断也行,随你。)