[
https://issues.apache.org/jira/browse/HDDS-8665?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17726124#comment-17726124
]
Tsz-wo Sze commented on HDDS-8665:
----------------------------------
The code was changed recently. To reproduce the failure, change the following:
{code}
+++
b/hadoop-ozone/common/src/main/java/org/apache/hadoop/ozone/om/helpers/SnapshotInfo.java
@@ -58,7 +58,7 @@ public final class SnapshotInfo implements Auditable {
// FIXME: HDDS-8665 Deep copy will cause failures
// - TestOMSnapshotDeleteRequest NullPointerException
// - TestOMSnapshotPurgeRequestAndResponse AssertionFailedError
- DelegatedCodec.CopyType.SHALLOW);
+ DelegatedCodec.CopyType.DEEP);
public static Codec<SnapshotInfo> getCodec() {
return CODEC;
{code}
- TestOMSnapshotDeleteRequest.testValidateAndUpdateCache
{code}
java.lang.NullPointerException
at
org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos$SnapshotInfo$Builder.setSnapshotID(OzoneManagerProtocolProtos.java:64456)
at
org.apache.hadoop.ozone.om.helpers.SnapshotInfo.getProtobuf(SnapshotInfo.java:378)
at
org.apache.hadoop.hdds.utils.db.DelegatedCodec.copyObject(DelegatedCodec.java:120)
at
org.apache.hadoop.hdds.utils.db.CodecRegistry.copyObject(CodecRegistry.java:114)
at org.apache.hadoop.hdds.utils.db.TypedTable.get(TypedTable.java:193)
at
org.apache.hadoop.ozone.om.request.snapshot.OMSnapshotDeleteRequest.validateAndUpdateCache(OMSnapshotDeleteRequest.java:150)
at
org.apache.hadoop.ozone.om.request.snapshot.TestOMSnapshotDeleteRequest.testValidateAndUpdateCache(TestOMSnapshotDeleteRequest.java:204)
{code}
- TestOMSnapshotPurgeRequestAndResponse.testSnapshotChainCleanup
{code}
org.opentest4j.AssertionFailedError:
Expected :b6f62767-272a-45fa-a56a-2b234fcc8b70
Actual :null
<Click to see difference>
at org.junit.jupiter.api.AssertionUtils.fail(AssertionUtils.java:55)
at
org.junit.jupiter.api.AssertionUtils.failNotEqual(AssertionUtils.java:62)
at
org.junit.jupiter.api.AssertEquals.assertEquals(AssertEquals.java:182)
at
org.junit.jupiter.api.AssertEquals.assertEquals(AssertEquals.java:177)
at org.junit.jupiter.api.Assertions.assertEquals(Assertions.java:1141)
at
org.apache.hadoop.ozone.om.request.snapshot.TestOMSnapshotPurgeRequestAndResponse.testSnapshotChainCleanup(TestOMSnapshotPurgeRequestAndResponse.java:297)
{code}
> OmDBSnapshotInfoCodec.copyObject(..) does not follow the general contract of
> copy.
> ----------------------------------------------------------------------------------
>
> Key: HDDS-8665
> URL: https://issues.apache.org/jira/browse/HDDS-8665
> Project: Apache Ozone
> Issue Type: Bug
> Components: OM, Snapshot
> Reporter: Tsz-wo Sze
> Priority: Major
> Attachments: HDDS-8665_bug.patch
>
>
> OmDBSnapshotInfoCodec.copyObject(..) is a shallow copy -- it simply returns
> the same object. However, if it is changed to return a deep copy as below,
> TestOMSnapshotDeleteRequest and TestOMSnapshotPurgeRequestAndResponse will
> fail. These two tests depend on the behavior that, after copying, changing
> one copy will also change the other copy.
> {code}
> +++
> b/hadoop-ozone/interface-storage/src/main/java/org/apache/hadoop/ozone/om/codec/OmDBSnapshotInfoCodec.java
> @@ -52,7 +52,13 @@ public SnapshotInfo fromPersistedFormat(byte[] rawData)
>
> @Override
> public SnapshotInfo copyObject(SnapshotInfo object) {
> - // Note: Not really a "copy". from OMDBSnapshotInfoCodec
> - return object;
> + // FIXME: Deep copy will cause failures
> + // - TestOMSnapshotDeleteRequest NullPointerException
> + // - TestOMSnapshotPurgeRequestAndResponse AssertionFailedError
> + try {
> + return fromPersistedFormat(toPersistedFormat(object));
> + } catch (IOException e) {
> + throw new IllegalStateException(e);
> + }
> }
> }{code}
--
This message was sent by Atlassian Jira
(v8.20.10#820010)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]