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-10832. Client should switch to streaming based on OpenKeySession replication #6683

Merged
merged 1 commit into from
May 22, 2024

Conversation

adoroszlai
Copy link
Contributor

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
  1. Create bucket without setting bucket-level replication
  2. 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

@adoroszlai adoroszlai self-assigned this May 15, 2024
@adoroszlai adoroszlai requested a review from szetszwo May 15, 2024 18:40
Copy link
Contributor

@szetszwo szetszwo left a comment

Choose a reason for hiding this comment

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

+1 the change looks good.

@adoroszlai
Copy link
Contributor Author

This is likely to conflict with #6607, so let's wait until that one is merged.

@adoroszlai adoroszlai merged commit c1bcdea into apache:master May 22, 2024
39 checks passed
@adoroszlai adoroszlai deleted the HDDS-10832 branch May 22, 2024 08:43
@adoroszlai
Copy link
Contributor Author

Thanks @szetszwo for the review.

jojochuang pushed a commit to jojochuang/ozone that referenced this pull request May 23, 2024
errose28 added a commit to errose28/ozone that referenced this pull request May 28, 2024
…concile-cli

* HDDS-10239-container-reconciliation: (296 commits)
  HDDS-10897. Refactor OzoneQuota (apache#6714)
  HDDS-10422. Fix some warnings about exposing internal representation in hdds-common (apache#6351)
  HDDS-10899. Refactor Lease callbacks (apache#6715)
  HDDS-10890. Increase default value for hdds.container.ratis.log.appender.queue.num-elements (apache#6711)
  HDDS-10832. Client should switch to streaming based on OpenKeySession replication (apache#6683)
  HDDS-10435. Support S3 object tags for existing requests (apache#6607)
  HDDS-10883. Improve logging in Recon for finalising DN logic. (apache#6704)
  HDDS-8752. Enable TestOzoneRpcClientAbstract#testOverWriteKeyWithAndWithOutVersioning (apache#6702)
  HDDS-10875. XceiverRatisServer#getRaftPeersInPipeline should be called before XceiverRatisServer#removeGroup (apache#6696)
  HDDS-10514. Recon - Provide DN decommissioning detailed status and info inline with current CLI command output. (apache#6376)
  HDDS-10878. Bump zstd-jni to 1.5.6-3 (apache#6701)
  HDDS-10877. Bump Dropwizard metrics to 3.2.6 (apache#6699)
  HDDS-10876. Bump jackson to 2.16.2 (apache#6697)
  HDDS-6116. Remove flaky tag from TestSCMInstallSnapshot (apache#6695)
  HDDS-2643. TestOzoneDelegationTokenSecretManager#testRenewTokenFailureRenewalTime fails intermittently.
  HDDS-10699. Refactor ContainerBalancerTask and TestContainerBalancerTask (apache#6537)
  HDDS-10861. Ozone cli supports default ozone.om.service.id (apache#6680)
  HDDS-10859. Improve error messages when decommission and maintenance fail-early (apache#6678)
  HDDS-9031. Upgrade acceptance tests to Docker Compose v2 (apache#6667)
  HDDS-10559. Add a warning or a check to run repair tool as System user (apache#6574)
  ...

Conflicts:
    hadoop-ozone/dist/src/main/smoketest/admincli/container.robot
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants