Skip to content

Conversation

@captainzmc
Copy link
Member

What changes were proposed in this pull request?

see: https://issues.apache.org/jira/browse/HDDS-6194

How was this patch tested?

NA.

Copy link
Contributor

@sodonnel sodonnel left a comment

Choose a reason for hiding this comment

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

LGTM

@adoroszlai adoroszlai self-requested a review January 18, 2022 16:52
Comment on lines 69 to 74
Copy link
Contributor

Choose a reason for hiding this comment

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

It would be nice to keep the old option as @Deprecated for backward compatibility. It should imply --type RATIS, and be mutually exclusive with --replication.

Copy link
Contributor

Choose a reason for hiding this comment

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

STANDALONE --> STAND_ALONE ?

Copy link
Contributor

Choose a reason for hiding this comment

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

parse is returning default values even if we pass replication and type as null.
When we set the EC on bucket, ideally it's not mandatory to pass the type and replication with key as we moved the default configs to server side along with bucket.

Please refer the JIRA: HDDS-6184

@captainzmc
Copy link
Member Author

Thanks @sodonnel @adoroszlai @umamaheswararao for the review, while #2990 merged I will update this PR.

@umamaheswararao
Copy link
Contributor

umamaheswararao commented Jan 28, 2022

HI @captainzmc, JFYI The pr #2990 is committed now. You may want to resume your work. Thanks

@kaijchen
Copy link
Member

kaijchen commented Feb 10, 2022

Hi @adoroszlai @sodonnel @umamaheswararao, since @captainzmc is on vacation, I have updated the code according to your comments above. Please take another look, thanks.

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 @kaijchen for updating the patch.

ReplicationType.RATIS, factor, metadata)) {
replicationConfig, metadata)) {
contentGenerator.write(stream);
stream.flush();
Copy link
Contributor

Choose a reason for hiding this comment

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

Got this for EC key:

$ ozone freon ockg -n1 -t1 --replication 'rs-3-2-1024k' --type EC
...
NotImplementedException: The flush API is not implemented yet.
	at org.apache.hadoop.ozone.client.io.ECKeyOutputStream.flush(ECKeyOutputStream.java:468)
	at org.apache.hadoop.ozone.client.io.OzoneOutputStream.flush(OzoneOutputStream.java:55)
	at org.apache.hadoop.ozone.freon.OzoneClientKeyGenerator.lambda$createKey$0(OzoneClientKeyGenerator.java:145)
	at com.codahale.metrics.Timer.time(Timer.java:101)
	at org.apache.hadoop.ozone.freon.OzoneClientKeyGenerator.createKey(OzoneClientKeyGenerator.java:141)

Copy link
Member

Choose a reason for hiding this comment

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

Yes, this is expected. It should be fixed in another PR.

@Override
public void flush() {
throw new NotImplementedException("The flush API is not implemented yet.");
}

Copy link
Member

Choose a reason for hiding this comment

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

Should we catch this exception here in ockg?

Copy link
Contributor

Choose a reason for hiding this comment

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

Probably for now if Type is EC, ignore to invoke flush? [ We thought not to implement flush unless there is a critical req for it. ]

Copy link
Member

Choose a reason for hiding this comment

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

Probably for now if Type is EC, ignore to invoke flush? [ We thought not to implement flush unless there is a critical req for it. ]

Maybe just catch this exception? Since it's already in a try clause.
And if flush is implemented in the future, it will work without any change.

Comment on lines +116 to +123
if (spec.commandLine().getParseResult().hasMatchedOption("--factor")) {
replicationConfig = ReplicationConfig
.fromTypeAndFactor(ReplicationType.RATIS, factor);
} else {
replicationConfig = OzoneClientUtils
.validateAndGetClientReplicationConfig(replicationType, replication,
ozoneConfiguration);
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Something is wrong around option handling. Setting only replication, but neither factor nor type, a regular RATIS/3 key was created:

$ ozone freon ockg -n1 -t1 --replication 'rs-3-2-1024k' -p replication_rs-3-2-1024k
...
Successful executions: 1

$ ozone sh key info /vol1/bucket1/replication_rs-3-2-1024k/0
...
  "replicationConfig" : {
    "replicationFactor" : "THREE",
    "requiredNodes" : 3,
    "replicationType" : "RATIS"
  },
...

Copy link
Member

@kaijchen kaijchen Feb 10, 2022

Choose a reason for hiding this comment

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

It is meaningless to set replication or type only.
And it's also possible to set --type EC with --replication THREE together.

type/replication THREE rs-3-2-1024k
RATIS OK Bad
EC Bad OK

Should we bind this two options together like RATIS/THREE or EC/rs-3-2-1024k instead?

Copy link
Member

Choose a reason for hiding this comment

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

Something is wrong around option handling. Setting only replication, but neither factor nor type, a regular RATIS/3 key was created:

This is due to OzoneClientUtils#validateAndGetClientReplicationConfig, the default client config was used.

if (userPassedType == null && clientConfiguredDefaultType != null) {
clientReplicationType =
ReplicationType.valueOf(clientConfiguredDefaultType);
}

@umamaheswararao
Copy link
Contributor

Yes, that should be fine.

Copy link
Contributor

@umamaheswararao umamaheswararao left a comment

Choose a reason for hiding this comment

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

LGTM

@umamaheswararao
Copy link
Contributor

@adoroszlai do you any more comments? Otherwise I will just go ahead to merge.

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 @kaijchen for updating the patch. Works fine in valid combinations. I think we can add validations later.

@umamaheswararao umamaheswararao merged commit 2d63cc4 into apache:HDDS-3816-ec Feb 11, 2022
@kaijchen
Copy link
Member

Thanks @umamaheswararao and @adoroszlai for reviewing.

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.

5 participants