kerneltime commented on code in PR #4379:
URL: https://github.com/apache/ozone/pull/4379#discussion_r1133052209
##########
hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/keyvalue/KeyValueHandler.java:
##########
@@ -1226,11 +1227,67 @@ private String[] getFilesWithPrefix(String prefix, File
chunkDir) {
return chunkDir.list(filter);
}
+ private boolean logBlocksIfNonZero(Container container)
+ throws IOException {
+ boolean nonZero = false;
+ try (DBHandle dbHandle
+ = BlockUtils.getDB(
+ (KeyValueContainerData) container.getContainerData(),
+ conf)) {
+ List<? extends Table.KeyValue<String, BlockData>>
+ blocks = dbHandle.getStore().getBlockDataTable().getRangeKVs(
+ ((KeyValueContainerData) container.getContainerData()).
+ startKeyEmpty(),
+ Integer.MAX_VALUE,
+ ((KeyValueContainerData) container.getContainerData()).
+ containerPrefix(),
+ ((KeyValueContainerData) container.getContainerData()).
+ getUnprefixedKeyFilter());
+ StringBuilder stringBuilder = new StringBuilder();
+ for (Table.KeyValue<String, BlockData> kv : blocks) {
+ nonZero = true;
+ stringBuilder.append(kv.getValue());
+ if (stringBuilder.length() > StorageUnit.KB.toBytes(32)) {
+ break;
+ }
+ }
+ if (nonZero) {
+ LOG.error("blocks in rocksDB on container delete: {}",
+ stringBuilder.toString());
+ }
+ }
+ return nonZero;
+ }
+
+ private void logBlocksFoundOnDisk(Container container) throws IOException {
+ // List files left over
+ File chunksPath = new
+ File(container.getContainerData().getChunksPath());
+ Preconditions.checkArgument(chunksPath.isDirectory());
+ try (DirectoryStream<Path> dir
+ = Files.newDirectoryStream(chunksPath.toPath())) {
+ StringBuilder stringBuilder = new StringBuilder();
+ for (Path block : dir) {
+ stringBuilder.append(block);
+ stringBuilder.append(",");
+ if (stringBuilder.length() > StorageUnit.KB.toBytes(16)) {
+ break;
+ }
+ LOG.error(
+ "Received container deletion command for container {} but" +
+ " the container is not empty",
+ container.getContainerData().getContainerID());
Review Comment:
We don't need this log message.
##########
hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/keyvalue/KeyValueHandler.java:
##########
@@ -1226,11 +1227,67 @@ private String[] getFilesWithPrefix(String prefix, File
chunkDir) {
return chunkDir.list(filter);
}
+ private boolean logBlocksIfNonZero(Container container)
+ throws IOException {
+ boolean nonZero = false;
+ try (DBHandle dbHandle
+ = BlockUtils.getDB(
+ (KeyValueContainerData) container.getContainerData(),
+ conf)) {
+ List<? extends Table.KeyValue<String, BlockData>>
+ blocks = dbHandle.getStore().getBlockDataTable().getRangeKVs(
+ ((KeyValueContainerData) container.getContainerData()).
+ startKeyEmpty(),
+ Integer.MAX_VALUE,
+ ((KeyValueContainerData) container.getContainerData()).
+ containerPrefix(),
+ ((KeyValueContainerData) container.getContainerData()).
+ getUnprefixedKeyFilter());
Review Comment:
Thanks!
--
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]