wchevreuil commented on a change in pull request #2009:
URL: https://github.com/apache/hbase/pull/2009#discussion_r449650148
##########
File path:
hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegion.java
##########
@@ -3170,37 +3171,88 @@ public void prepareDeleteTimestamps(Mutation mutation,
Map<byte[], List<Cell>> f
count = kvCount.get(qual);
Get get = new Get(CellUtil.cloneRow(cell));
- get.readVersions(count);
- get.addColumn(family, qual);
+ get.readVersions(Integer.MAX_VALUE);
if (coprocessorHost != null) {
if (!coprocessorHost.prePrepareTimeStampForDeleteVersion(mutation,
cell,
byteNow, get)) {
- updateDeleteLatestVersionTimestamp(cell, get, count, byteNow);
+ updateDeleteLatestVersionTimestamp(cell, get, count,
+
this.htableDescriptor.getColumnFamily(family).getMaxVersions(),
+ byteNow, deleteCells);
+
}
} else {
- updateDeleteLatestVersionTimestamp(cell, get, count, byteNow);
+ updateDeleteLatestVersionTimestamp(cell, get, count,
+ this.htableDescriptor.getColumnFamily(family).getMaxVersions(),
+ byteNow, deleteCells);
}
} else {
PrivateCellUtil.updateLatestStamp(cell, byteNow);
+ deleteCells.add(cell);
}
}
+ e.setValue(deleteCells);
}
}
- void updateDeleteLatestVersionTimestamp(Cell cell, Get get, int count,
byte[] byteNow)
- throws IOException {
- List<Cell> result = get(get, false);
-
+ void updateDeleteLatestVersionTimestamp(Cell cell, Get get, int count, int
maxVersions,
+ byte[] byteNow, List<Cell> deleteCells) throws IOException {
+ List<Cell> result = new ArrayList<>();
+ result.addAll(deleteCells);
+ Scan scan = new Scan(get);
+ scan.setRaw(true);
+ this.getScanner(scan).next(result);
+ result.sort((cell1, cell2) -> {
+ if(cell1.getTimestamp()>cell2.getTimestamp()){
+ return -1;
+ } else if(cell1.getTimestamp()<cell2.getTimestamp()){
+ return 1;
+ } else {
+ if(CellUtil.isDelete(cell1)){
+ return -1;
+ } else if (CellUtil.isDelete(cell2)){
+ return 1;
+ }
+ }
+ return 0;
+ });
+ List<Cell> cells = new ArrayList<>();
if (result.size() < count) {
Review comment:
Yes.
----------------------------------------------------------------
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]