ChenSammi commented on code in PR #7934:
URL: https://github.com/apache/ozone/pull/7934#discussion_r1977194722
##########
hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/metadata/DatanodeStoreSchemaThreeImpl.java:
##########
@@ -132,17 +140,52 @@ public void dumpKVContainerData(long containerID, File
dumpDir)
}
public void loadKVContainerData(File dumpDir)
- throws IOException {
- getMetadataTable().loadFromFile(
- getTableDumpFile(getMetadataTable(), dumpDir));
- getBlockDataTable().loadFromFile(
- getTableDumpFile(getBlockDataTable(), dumpDir));
- if
(VersionedDatanodeFeatures.isFinalized(HDDSLayoutFeature.HBASE_SUPPORT)) {
- getLastChunkInfoTable().loadFromFile(
- getTableDumpFile(getLastChunkInfoTable(), dumpDir));
+ throws IOException, RocksDBException {
+ try (BatchOperation batch = getBatchHandler().initBatchOperation()) {
+ processTable(batch, getTableDumpFile(getMetadataTable(), dumpDir),
+ FixedLengthStringCodec.get(), LongCodec.get(), getMetadataTable());
+ processTable(batch, getTableDumpFile(getBlockDataTable(), dumpDir),
+ FixedLengthStringCodec.get(), BlockData.getCodec(),
getBlockDataTable());
+ if
(VersionedDatanodeFeatures.isFinalized(HDDSLayoutFeature.HBASE_SUPPORT)) {
+ processTable(batch, getTableDumpFile(getLastChunkInfoTable(), dumpDir),
+ FixedLengthStringCodec.get(), BlockData.getCodec(),
getLastChunkInfoTable());
+ }
+ processTable(batch, getTableDumpFile(getDeleteTransactionTable(),
dumpDir), FixedLengthStringCodec.get(),
+ Proto2Codec.get(DeletedBlocksTransaction.getDefaultInstance()),
getDeleteTransactionTable());
+
+ getStore().commitBatchOperation(batch);
+ }
+ }
+
+ private <K, V> void processTable(BatchOperation batch, File tableDumpFile,
+ Codec<K> keyCodec, Codec<V> valueCodec, Table<K, V> table) throws
IOException, RocksDBException {
+ if (isFileEmpty(tableDumpFile)) {
+ LOG.warn("SST File {} is empty. Skipping processing.",
tableDumpFile.getAbsolutePath());
Review Comment:
It's normal that some table is not there, such as deleteTransactionTable if
there is no block deletion transactions. This warning log will cause
confusing.
--
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]