adoroszlai opened a new pull request, #6683:
URL: https://github.com/apache/ozone/pull/6683
## What changes were proposed in this pull request?
Current client workflow:
1. chooses regular or streaming write API (by calling `createKey` or
`createStreamKey`, or similar methods)
2. opens key by making a call to OM
3. sets up hierarchy of output streams based on chosen write API
4. uses output streams to write
Streaming write is supported only for Ratis-based replication. However,
actual replication may be decided by OM based on its own config, if there
aren't any more specific settings (coming from client, or configured at bucket
level).
If client chooses streaming write and OM ends up creating an EC key, client
may run into errors when trying to use output streams in step 4.
```
ClassCastException: class ECXceiverClientGrpc cannot be cast to class
XceiverClientRatis
at
org.apache.hadoop.hdds.scm.storage.BlockDataStreamOutput.<init>(BlockDataStreamOutput.java:169)
...
```
This change fixes that by allowing the client to fall back to regular write
instead of streaming in this case. It is achieved by checking the replication
type of the open key received from OM when setting up the streams in step 3.
https://issues.apache.org/jira/browse/HDDS-10832
## How was this patch tested?
Updated `TestOzoneRpcClientWithRatis` to test streaming multipart upload
with different replication types (which client sets explicitly in its request
for simplicity).
Tested original repro steps (as described in HDDS-10832):
1. Change server-side default replication to EC in `docker-compose.yaml`:
```
OZONE-SITE.XML_ozone.server.default.replication.type: EC
OZONE-SITE.XML_ozone.server.default.replication: RS-3-2-1024k
```
2. Create bucket without setting bucket-level replication
3. Put large enough key to trigger Ratis streaming
```
$ cd hadoop-ozone/dist/target/ozone-1.5.0-SNAPSHOT/compose/ozone \
&& OZONE_DATANODES=5 ./run.sh -d \
&& docker-compose exec scm bash
$ ozone admin safemode wait -t 60
$ ozone sh bucket create -l OBJECT_STORE /s3v/bucket1
$ export AWS_ACCESS_KEY_ID=x AWS_SECRET_ACCESS_KEY=y
$ aws s3api put-object --endpoint http://s3g:9878 --bucket bucket1 --body
share/ozone/lib/rocksdbjni-7.7.3.jar --key key1
{
"ETag": "\"2fef24d99bbf1ffcb41ea812432b649b\""
}
$ ozone sh key list /s3v/bucket1
[ {
...
"name" : "key1",
"dataSize" : 57685296,
"replicationConfig" : {
"data" : 3,
"parity" : 2,
"ecChunkSize" : 1048576,
"codec" : "RS",
"requiredNodes" : 5,
"replicationType" : "EC"
},
...
} ]
```
CI:
https://github.com/adoroszlai/ozone/actions/runs/9098024548
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]