gjacoby126 commented on a change in pull request #624: PHOENIX-5564 Restructure
read repair to improve readability and corre…
URL: https://github.com/apache/phoenix/pull/624#discussion_r346520621
##########
File path:
phoenix-core/src/main/java/org/apache/phoenix/index/GlobalIndexChecker.java
##########
@@ -275,45 +307,73 @@ private void repairIndexRows(byte[] indexRowKey, long
ts, List<Cell> row) throws
}
// A single cell will be returned. We decode that here
byte[] value = result.value();
- long rowCount = PLong.INSTANCE.getCodec().decodeLong(new
ImmutableBytesWritable(value), SortOrder.getDefault());
- if (rowCount == 0) {
- // This means there does not exist a data table row for this
unverified index row
+ long code = PLong.INSTANCE.getCodec().decodeLong(new
ImmutableBytesWritable(value), SortOrder.getDefault());
Review comment:
So, it turns out it's messier to translate a long to an enum than an int, so
I leave it up to you. But something like:
long result = PLong.INSTANCE.getCodec().decodeLong(new
ImmutableBytesWritable(value), SortOrder.getDefault());
RebuildReturnCode returnCode = RebuildReturnCode.values[(Integer) result];
The idea was that you'd have a variable of type RebuildReturnCode, so you
wouldn't have to keep converting enum values to longs in multiple places in the
code and could just compare the result against the enum values directly. But
the narrowing cast makes it a bit messy.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services