ptlrs commented on code in PR #7934:
URL: https://github.com/apache/ozone/pull/7934#discussion_r2019054248
##########
hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/metadata/DatanodeStoreSchemaThreeImpl.java:
##########
@@ -132,17 +138,61 @@ 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),
+ getDbDef().getMetadataColumnFamily().getKeyCodec(),
+ getDbDef().getMetadataColumnFamily().getValueCodec(),
+ getMetadataTable());
+ processTable(batch, getTableDumpFile(getBlockDataTable(), dumpDir),
+ getDbDef().getBlockDataColumnFamily().getKeyCodec(),
+ getDbDef().getBlockDataColumnFamily().getValueCodec(),
+ getBlockDataTable());
+ if
(VersionedDatanodeFeatures.isFinalized(HDDSLayoutFeature.HBASE_SUPPORT)) {
+ processTable(batch, getTableDumpFile(getLastChunkInfoTable(), dumpDir),
+ getDbDef().getLastChunkInfoColumnFamily().getKeyCodec(),
+ getDbDef().getLastChunkInfoColumnFamily().getValueCodec(),
+ getLastChunkInfoTable());
+ }
+ processTable(batch, getTableDumpFile(getDeleteTransactionTable(),
dumpDir),
+
((DatanodeSchemaThreeDBDefinition)getDbDef()).getDeleteTransactionsColumnFamily().getKeyCodec(),
+
((DatanodeSchemaThreeDBDefinition)getDbDef()).getDeleteTransactionsColumnFamily().getValueCodec(),
+ 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.debug("SST File {} is empty. Skipping processing.",
tableDumpFile.getAbsolutePath());
+ return;
+ }
+
+ try (ManagedOptions managedOptions = new ManagedOptions();
+ ManagedSstFileReader sstFileReader = new
ManagedSstFileReader(managedOptions)) {
+ sstFileReader.open(tableDumpFile.getAbsolutePath());
+ try (ManagedReadOptions managedReadOptions = new ManagedReadOptions();
+ ManagedSstFileReaderIterator iterator =
+
ManagedSstFileReaderIterator.managed(sstFileReader.newIterator(managedReadOptions)))
{
Review Comment:
Test
--
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]