errose28 commented on code in PR #4337:
URL: https://github.com/apache/ozone/pull/4337#discussion_r1148426806
##########
hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/keyvalue/KeyValueContainerMetadataInspector.java:
##########
@@ -392,6 +412,36 @@ private boolean checkAndRepair(JsonObject parent,
errors.add(usedBytesError);
}
+ // check and repair if db delete count mismatches delete transaction count.
+ final JsonElement pendingDeleteCountDB = dBMetadata.get(
+ OzoneConsts.PENDING_DELETE_BLOCK_COUNT);
+ final long dbDeleteCount = jsonToLong(pendingDeleteCountDB);
+ final JsonElement pendingDeleteCountAggregate
+ = aggregates.get(PendingDelete.COUNT);
+ final long deleteTransactionCount =
jsonToLong(pendingDeleteCountAggregate);
+ if (dbDeleteCount != deleteTransactionCount) {
+ passed = false;
+
+ final BooleanSupplier deleteCountRepairAction = () -> {
+ final String key = containerData.getPendingDeleteBlockCountKey();
+ try {
+ // reset delete block count to 0 in metadata table
+ metadataTable.put(key, 0L);
Review Comment:
This should reset to the aggregate value, not 0. Looks like the tests did
not catch this because `checkDBBlockAndByteCounts` needs to be modified to
check the pending delete block count in the DB after repair.
##########
hadoop-hdds/container-service/src/test/java/org/apache/hadoop/ozone/container/keyvalue/TestKeyValueContainerMetadataInspector.java:
##########
@@ -172,7 +269,8 @@ public void inspectThenRepairOnCorrectContainer(
*/
public void inspectThenRepairOnIncorrectContainer(
KeyValueContainerData containerData, int createdBlocks, int setBlocks,
- int setBytes) throws Exception {
+ int setBytes, int deleteCount, long numDeletedLocalIds,
+ boolean shouldRepair) throws Exception {
Review Comment:
I was just suggesting we keep the existing doc and parameter list consistent
since we were already making changes here, but if you are against it it's not a
blocking issue.
--
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]