virajjasani commented on code in PR #2154:
URL: https://github.com/apache/phoenix/pull/2154#discussion_r2093502009
##########
phoenix-core-server/src/main/java/org/apache/phoenix/hbase/index/IndexRegionObserver.java:
##########
@@ -910,7 +911,12 @@ private void
applyPendingPutMutations(MiniBatchOperationInProgress<Mutation> min
context.dataRowStates.put(rowKeyPtr, dataRowState);
}
Put nextDataRowState = dataRowState.getSecond();
- dataRowState.setSecond((nextDataRowState != null) ? applyNew((Put)
m, nextDataRowState) : new Put((Put) m));
+ // Need to deep copy the references to the cells in the mutation
+ Put copied = IndexUtil.copyPut((Put) m);
Review Comment:
> I think we need to do this only at places where we are setting values in
BatchMutateContext for the first time.
Yes I was talking about this:
```
private void
readDataTableRows(ObserverContext<RegionCoprocessorEnvironment> c,
BatchMutateContext context, Scan scan)
throws IOException {
try (RegionScanner scanner =
c.getEnvironment().getRegion().getScanner(scan)) {
boolean more = true;
while (more) {
List<Cell> cells = new ArrayList<Cell>();
more = scanner.next(cells);
if (cells.isEmpty()) {
continue;
}
byte[] rowKey = CellUtil.cloneRow(cells.get(0));
Put put = new Put(rowKey);
for (Cell cell : cells) {
put.add(cell);
}
context.dataRowStates.put(new ImmutableBytesPtr(rowKey), new
Pair<Put, Put>(put, new Put(put)));
}
}
}
```
I was thinking about `new Put(put)` but looks like we don't need it because
you cloned cells that are being added to Put mutation. We are good I think.
--
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.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]