-
Notifications
You must be signed in to change notification settings - Fork 21
CNDB-15608 simplify ceiling row id from primary key #2142
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
Conversation
PartitionAwarePrimaryKeyMap implements unused exactRowIdOrInvertedCeiling and overcomplicated ceiling method.
Checklist before you submit for review
|
|
❌ Build ds-cassandra-pr-gate/PR-2142 rejected by Butler4 regressions found Found 4 new test failures
Found 2 known test failures |
Test failures are unrelated to the PR. |
|
CNDB's PR: https://github.com/riptano/cndb/pull/16154 |
michaeljmarshall
left a comment
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.
LGTM
The implementation is identical, AFAICT. The one minor detail is that neither indexOf nor ceilingRowId actually return negative values beyond the Long.MIN_VALUE or the -1 for when lastIndex >= valueCount. This does not break the logic of ceiling, but does lead to a pessimization that should be fixed. I will create a subsequent issue to track that work.
@Override
public long ceilingRowId(long targetValue)
{
// already out of range
if (lastIndex >= valueCount)
return -1;
long rowId = findBlockRowId(targetValue);
lastIndex = rowId >= 0 ? rowId : -rowId - 1;
return lastIndex >= valueCount ? -1 : lastIndex;
}
@Override
public long indexOf(long targetValue)
{
// already out of range
if (lastIndex >= valueCount)
return Long.MIN_VALUE;
long rowId = findBlockRowId(targetValue);
lastIndex = rowId >= 0 ? rowId : -rowId - 1;
return rowId >= valueCount ? Long.MIN_VALUE : rowId;
}
@michaeljmarshall |
|
In re-reviewing the logic, I was mistaken about the misused methods and the pessimization. Everything looks correct to me.
I'm not sure I follow your point about exceeding long rowId = findBlockRowId(targetValue);
lastIndex = rowId >= 0 ? rowId : -rowId - 1;
return rowId >= valueCount ? Long.MIN_VALUE : rowId;works by getting either the exact row match back or |
This is for
Why will it be out of the scope? |
PartitionAwarePrimaryKeyMap implements overcomplicated `ceiling` method calling `exactRowIdOrInvertedCeiling`. This commit Simplifies PartitionAwarePrimaryKeyMap.ceiling to use the corresponding correct method from the reader directly. This can be seen as a follow up to https://github.com/datastax/cassandra/pull/1096/files#diff-c5011580ab9b0d99d9e504570c4cccb152221d3dbe62c8a956e83fce9070b380
PartitionAwarePrimaryKeyMap implements overcomplicated `ceiling` method calling `exactRowIdOrInvertedCeiling`. This commit Simplifies PartitionAwarePrimaryKeyMap.ceiling to use the corresponding correct method from the reader directly. This can be seen as a follow up to https://github.com/datastax/cassandra/pull/1096/files#diff-c5011580ab9b0d99d9e504570c4cccb152221d3dbe62c8a956e83fce9070b380



What is the issue
PartitionAwarePrimaryKeyMap implements overcomplicated
ceilingmethod callingexactRowIdOrInvertedCeiling.Part of https://github.com/riptano/cndb/issues/15608
What does this PR fix and why was it fixed
Simplifies PartitionAwarePrimaryKeyMap.ceiling to use the corresponding correct method from the reader directly.
This can be seen as a follow up to https://github.com/datastax/cassandra/pull/1096/files#diff-c5011580ab9b0d99d9e504570c4cccb152221d3dbe62c8a956e83fce9070b380
CNDB's PR: https://github.com/riptano/cndb/pull/16154