Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HDDS-7108. Include supported EC data-parity combinations in error message #3665

Merged
merged 14 commits into from
Aug 19, 2022
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,11 @@ public ReplicationConfig validate(ReplicationConfig replicationConfig) {
replication = ecConfig.getCodec() + "-" + ecConfig.getData() +
"-" + ecConfig.getParity() + "-{CHUNK_SIZE}";
}
throw new IllegalArgumentException("Invalid replication config " +
"for type " + replicationConfig.getReplicationType() +
" and replication " + replication);
throw new IllegalArgumentException(
"Invalid data-parity replication config " +
"for type " + replicationConfig.getReplicationType() +
" and replication " + replication + "." +
" Supported data-parity are 3-2,6-3,10-4");
Comment on lines +65 to +68
Copy link
Contributor

Choose a reason for hiding this comment

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

Sorry for the late review.

This exception may be thrown for non-EC replication config, too, in which case data-parity is not applicable. The message should be different based on replication type.

CLI commands validate RATIS replication factor before reaching this check, but Java code using RpcClient#createKey directly could encounter this problem.

}
}
return replicationConfig;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,10 @@ public void testValidation() {
try {
validator.validate(new ECReplicationConfig(invalidEcConfig1));
} catch (IllegalArgumentException ex) {
GenericTestUtils.assertExceptionContains("Invalid replication " +
"config for type EC and replication xor-6-4-{CHUNK_SIZE}", ex);
GenericTestUtils.assertExceptionContains(
"Invalid data-parity replication " +
"config for type EC and replication xor-6-4-{CHUNK_SIZE}. " +
"Supported data-parity are 3-2,6-3,10-4", ex);
}

}
Expand Down