gjacoby126 commented on a change in pull request #740: PHOENIX-5795 Supporting
selective queries for index rows updated conc…
URL: https://github.com/apache/phoenix/pull/740#discussion_r396880060
##########
File path:
phoenix-core/src/main/java/org/apache/phoenix/hbase/index/IndexRegionObserver.java
##########
@@ -826,13 +813,31 @@ private void
preparePostIndexMutations(BatchMutateContext context, long now, Pho
// Set the status of the index row to "verified"
verifiedPut.addColumn(emptyCF, emptyCQ, now,
VERIFIED_BYTES);
context.postIndexUpdates.put(hTableInterfaceReference,
verifiedPut);
- }
- else {
+ } else {
context.postIndexUpdates.put(hTableInterfaceReference,
m);
}
+ } else {
+ if (!hasAllIndexedColumns(indexMaintainer,
context.multiMutationMap.get(rowKey))) {
+ // This batch needs to be retried since one of the
concurrent mutations does not have the value
+ // for an indexed column. Not including an index
column may lead to incorrect index row key
+ // generation for concurrent mutations since
concurrent mutations are not serialized entirely
+ // and do not see each other's effect on data table.
Throwing an IOException will result in
+ // retries of this batch. Before throwing exception,
we need to remove reference counts and
+ // locks for the rows of this batch
+ removePendingRows(context);
+ context.indexUpdates.clear();
+ for (RowLock rowLock : context.rowLocks) {
+ rowLock.release();
+ }
+ context.rowLocks.clear();
+ throw new IOException("One of the concurrent mutations
does not have all indexed columns. " +
+ "The batch needs to be retried " +
+
c.getEnvironment().getRegion().getRegionInfo().getTable().getNameAsString());
Review comment:
Better to pass the TableName in rather than the whole ObserverContext, which
has a lot of important dependencies that don't relate to this method.
----------------------------------------------------------------
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