-
Notifications
You must be signed in to change notification settings - Fork 616
HDDS-6194. EC: Freon ockg support EC write #2996
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
Changes from 6 commits
bb24b76
58a9c54
a918ce3
01b5181
8e9793d
d9ed09a
287a177
ac6aa13
abb01da
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -21,7 +21,10 @@ | |||||||||
| import java.util.Map; | ||||||||||
| import java.util.concurrent.Callable; | ||||||||||
|
|
||||||||||
| import org.apache.commons.lang3.NotImplementedException; | ||||||||||
| import org.apache.hadoop.fs.ozone.OzoneClientUtils; | ||||||||||
| import org.apache.hadoop.hdds.cli.HddsVersionProvider; | ||||||||||
| import org.apache.hadoop.hdds.client.ReplicationConfig; | ||||||||||
| import org.apache.hadoop.hdds.client.ReplicationFactor; | ||||||||||
| import org.apache.hadoop.hdds.client.ReplicationType; | ||||||||||
| import org.apache.hadoop.hdds.conf.OzoneConfiguration; | ||||||||||
|
|
@@ -30,7 +33,9 @@ | |||||||||
|
|
||||||||||
| import com.codahale.metrics.Timer; | ||||||||||
| import picocli.CommandLine.Command; | ||||||||||
| import picocli.CommandLine.Model.CommandSpec; | ||||||||||
| import picocli.CommandLine.Option; | ||||||||||
| import picocli.CommandLine.Spec; | ||||||||||
|
|
||||||||||
| /** | ||||||||||
| * Data generator tool test om performance. | ||||||||||
|
|
@@ -44,6 +49,8 @@ | |||||||||
| public class OzoneClientKeyGenerator extends BaseFreonGenerator | ||||||||||
| implements Callable<Void> { | ||||||||||
|
|
||||||||||
| @Spec private CommandSpec spec; | ||||||||||
|
|
||||||||||
| @Option(names = {"-v", "--volume"}, | ||||||||||
| description = "Name of the bucket which contains the test data. Will be" | ||||||||||
| + " created if missing.", | ||||||||||
|
|
@@ -67,22 +74,35 @@ public class OzoneClientKeyGenerator extends BaseFreonGenerator | |||||||||
| private int bufferSize; | ||||||||||
|
|
||||||||||
| @Option(names = { "-F", "--factor" }, | ||||||||||
| description = "Replication factor (ONE, THREE)", | ||||||||||
| description = "[Deprecated] Replication factor (ONE, THREE)", | ||||||||||
| defaultValue = "THREE" | ||||||||||
| ) | ||||||||||
| private ReplicationFactor factor = ReplicationFactor.THREE; | ||||||||||
|
|
||||||||||
| @Option( | ||||||||||
| names = "--om-service-id", | ||||||||||
| @Option(names = "--om-service-id", | ||||||||||
| description = "OM Service ID" | ||||||||||
| ) | ||||||||||
| private String omServiceID = null; | ||||||||||
| private String omServiceID; | ||||||||||
|
|
||||||||||
| @Option(names = {"--replication"}, | ||||||||||
| description = | ||||||||||
| "Replication configuration of the new key." | ||||||||||
| + "(ONE, THREE) for RATIS or STAND_ALONE, " | ||||||||||
| + "(rs-3-2-1024k, rs-6-3-1024k or rs-10-4-1024k) for EC." | ||||||||||
| ) | ||||||||||
| private String replication; | ||||||||||
|
|
||||||||||
| @Option(names = {"--type"}, | ||||||||||
| description = "Replication type of the new key. (RATIS, STAND_ALONE, EC)" | ||||||||||
| ) | ||||||||||
| private ReplicationType replicationType; | ||||||||||
|
|
||||||||||
| private Timer timer; | ||||||||||
|
|
||||||||||
| private OzoneBucket bucket; | ||||||||||
| private ContentGenerator contentGenerator; | ||||||||||
| private Map<String, String> metadata; | ||||||||||
| private ReplicationConfig replicationConfig; | ||||||||||
|
|
||||||||||
| @Override | ||||||||||
| public Void call() throws Exception { | ||||||||||
|
|
@@ -94,6 +114,15 @@ public Void call() throws Exception { | |||||||||
| contentGenerator = new ContentGenerator(keySize, bufferSize); | ||||||||||
| metadata = new HashMap<>(); | ||||||||||
|
|
||||||||||
| if (spec.commandLine().getParseResult().hasMatchedOption("--factor")) { | ||||||||||
| replicationConfig = ReplicationConfig | ||||||||||
| .fromTypeAndFactor(ReplicationType.RATIS, factor); | ||||||||||
| } else { | ||||||||||
| replicationConfig = OzoneClientUtils | ||||||||||
| .validateAndGetClientReplicationConfig(replicationType, replication, | ||||||||||
| ozoneConfiguration); | ||||||||||
| } | ||||||||||
|
|
||||||||||
| try (OzoneClient rpcClient = createOzoneClient(omServiceID, | ||||||||||
| ozoneConfiguration)) { | ||||||||||
| ensureVolumeAndBucketExist(rpcClient, volumeName, bucketName); | ||||||||||
|
|
@@ -112,9 +141,11 @@ private void createKey(long counter) throws Exception { | |||||||||
|
|
||||||||||
| timer.time(() -> { | ||||||||||
| try (OutputStream stream = bucket.createKey(key, keySize, | ||||||||||
| ReplicationType.RATIS, factor, metadata)) { | ||||||||||
| replicationConfig, metadata)) { | ||||||||||
| contentGenerator.write(stream); | ||||||||||
| stream.flush(); | ||||||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Got this for EC key:
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, this is expected. It should be fixed in another PR. ozone/hadoop-ozone/client/src/main/java/org/apache/hadoop/ozone/client/io/ECKeyOutputStream.java Lines 466 to 469 in 22e3482
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should we catch this exception here in ockg?
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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. ]
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Maybe just catch this exception? Since it's already in a try clause. |
||||||||||
| } catch (NotImplementedException e) { | ||||||||||
| // flush() is not implemented in ECKeyOutputStream | ||||||||||
| } | ||||||||||
| return null; | ||||||||||
| }); | ||||||||||
|
|
||||||||||
There was a problem hiding this comment.
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 neitherfactornortype, a regular RATIS/3 key was created:Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
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
replicationortypeonly.And it's also possible to set
--type ECwith--replication THREEtogether.Should we bind this two options together like
RATIS/THREEorEC/rs-3-2-1024kinstead?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is due to
OzoneClientUtils#validateAndGetClientReplicationConfig, the default client config was used.ozone/hadoop-ozone/ozonefs-common/src/main/java/org/apache/hadoop/fs/ozone/OzoneClientUtils.java
Lines 172 to 175 in c4aec7b