Skip to content

Conversation

@cchenax
Copy link
Contributor

@cchenax cchenax commented Apr 29, 2021

What changes were proposed in this pull request?

fix if the metadatafile or chunksfile missing import export container error

What is the link to the Apache JIRA

https://issues.apache.org/jira/projects/HDDS/issues/HDDS-5149?filter=addedrecently

How was this patch tested?

unittest

cchenaxchen added 4 commits April 29, 2021 14:19
…anode,but the target datanode container file missing,import error
…anode,but the target datanode container file missing,import error
…anode,but the target datanode container file missing,import error
…anode,but the target datanode container file missing,import error
Copy link
Contributor

@adoroszlai adoroszlai left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @cchenax for working on this. The idea that container export/import may perform more sanity checks sounds good to me.

Comment on lines +159 to +172
if (!containerData.getDbFile().exists()) {
LOG.warn("DBfile {} not exist",
containerData.getDbFile().toPath().toString());
return;
} else if (!new File(containerData.getChunksPath()).exists()) {
LOG.warn("Chunkfile {} not exist",
containerData.getDbFile().toPath().toString());
return;
} else if (!container.getContainerFile().exists()) {
LOG.warn("Containerfile {} not exist",
containerData.getDbFile().toPath().toString());
return;
}

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would it make sense to utilize Container.scanMetadata() instead? More complete checks without introducing duplication.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok,I will change it.thank you very much!

Comment on lines +285 to +287
container.importContainerData(fis, packer);
} catch (Exception ex) {
assertTrue(ex instanceof NullPointerException);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • This passes even if importContainerData does not throw, which is not expected.
  • Some exception other than NullPointerException may better describe the error.
  • Assert.assertThrows or LambdaTestUtils.intercept could provide more details if the assertion fails (eg. if not the expected kind of exception was thrown).

Comment on lines +124 to +129
// if tar is null, the tar size is 45 bytes
if (bytes <= 45) {
task.setStatus(Status.FAILED);
LOG.warn("Container {} is downloaded with size {}, " +
"if size less than 45 bytes the tar file is null",
containerID, bytes);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think these kind of tar-specific details should be handled by TarContainerPacker.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hello,I think it should be check in the DownloadAndImportReplicator,because of the source datanode will through outputstream to the tar,if tar is null,the task status should be set failed,the tar size check in TarContainerPacker I think is not useful.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please consider the case if someone wanted to introduce a new implementation of ContainerPacker, eg. based on zip. This check would not make sense, or at least would need different number of minimum bytes, for the other implementation.

@adoroszlai
Copy link
Contributor

Continued in #2376.

@adoroszlai adoroszlai closed this Jun 29, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants