You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@ozone.apache.org by GitBox <gi...@apache.org> on 2023/01/10 02:34:48 UTC
[GitHub] [ozone] symious commented on a diff in pull request #3648: HDDS-7083. Spread container-copy directories
symious commented on code in PR #3648:
URL: https://github.com/apache/ozone/pull/3648#discussion_r1065281795
##########
hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/keyvalue/TarContainerPacker.java:
##########
@@ -289,4 +305,40 @@ OutputStream compress(OutputStream output)
.createCompressorOutputStream(compression, output);
}
+ private byte[] innerUnpack(InputStream input, Path dbRoot, Path chunksRoot)
+ throws IOException {
+ byte[] descriptorFileContent = null;
+ try (InputStream decompressed = decompress(input);
+ ArchiveInputStream archiveInput = untar(decompressed)) {
+ ArchiveEntry entry = archiveInput.getNextEntry();
+ while (entry != null) {
+ String name = entry.getName();
+ long size = entry.getSize();
+ if (name.startsWith(DB_DIR_NAME + "/")) {
+ Path destinationPath = dbRoot
+ .resolve(name.substring(DB_DIR_NAME.length() + 1));
+ extractEntry(entry, archiveInput, size, dbRoot,
+ destinationPath);
+ } else if (name.startsWith(CHUNKS_DIR_NAME + "/")) {
+ Path destinationPath = chunksRoot
+ .resolve(name.substring(CHUNKS_DIR_NAME.length() + 1));
+ extractEntry(entry, archiveInput, size, chunksRoot,
+ destinationPath);
+ } else if (CONTAINER_FILE_NAME.equals(name)) {
+ //Don't do anything. Container file should be unpacked in a
+ //separated step by unpackContainerDescriptor call.
+ descriptorFileContent = readEntry(archiveInput, size);
+ } else {
+ throw new IllegalArgumentException(
+ "Unknown entry in the tar file: " + "" + name);
+ }
+ entry = archiveInput.getNextEntry();
+ }
+ return descriptorFileContent;
+
+ } catch (CompressorException e) {
+ throw new IOException("Can't uncompress to dbRoot: " + dbRoot +
+ ", chunksRoot: " + chunksRoot, e);
+ }
Review Comment:
The delete of dest directory is updated in KeyValueContainer#importContainerData(InputStream, ContainerPacker<KeyValueContainerData>).
The delete of tar file is under DownloadAndImportReplicator#importContainer(long, Path, HddsVolume)
--
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: issues-unsubscribe@ozone.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org