You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@ozone.apache.org by "errose28 (via GitHub)" <gi...@apache.org> on 2024/04/10 06:30:49 UTC
[PR] HDDS-10372. SCM and Datanode communication for reconciliation [ozone]
errose28 opened a new pull request, #6506:
URL: https://github.com/apache/ozone/pull/6506
(WIP, still needs tests)
## What changes were proposed in this pull request?
A lot of boilerplate code to do something very simple:
- Tell SCM to start reconciliation for a container from the CLI.
- Have SCM tell Datanodes to reconcile that container with their peers.
- Datanodes send back a placeholder container data checksum which we can fill in with reconciliation implementation later.
- SCM updates its replica info based on the container report received after the Datanodes reconcile.
I've tried to avoid making any design related decisions in this PR. It is intended as a skeleton we can use to plug in the reconciliation implementation for end to end testing as we work on implementation.
### In scope for this change
- Add new `ozone admin container reconcile <container-id>` command.
- New command should be restricted to admins
- Audit logging for new command
- Blocking reconciliation of invalid containers (EC, 1 replica, still open)
- Datanode queue metrics for reconciliation commands
- Datanode and SCM application logs to follow the command as it moves through the system.
- SCM saves container replicas' data checksums in memory, and they can be retrieved with `ozone admin container info --json`
### Out of scope for this change (but will be handled in later tasks)
- Any actual checksum related implementations
- Currently strings are used as placeholders just to move filler data around for testing.
- Recon integration with container data checksums
- This includes Recon's `ContainerReplicaHistoryProto`
- Finalized protobuf changes
- Since the change is going to a feature branch we have the flexibility to evolve the protos later.
- Good UX 😄
- This includes flags for the `reconcile` command, an easy way to track reconciliation progress, and reading containers from stdin like other `container` subcommands support.
- These will need some discussion so are probably best done as their own set of changes.
## What is the link to the Apache JIRA
HDDS-10372
## How was this patch tested?
Currently manual testing works, except that errors from the CLI are currently treated as retriable. This might be larger problem with error handling for SCM admin CLI in general, but I'm still investigating.
The follow automated tests need to be added before the PR is moved out of draft:
- End to end testing in `admincli/container.robot`
- New command shows up in suggestions
- admin only
- invalid inputs
- e2e tests that checksum makes it back from the datanode to SCM
- Tests for SCM receiving the command
- Add new `TestReconcileContainerEventHandler` similar to `TestCloseContainerEventHandler`
- Tests for Datanodes receiving the command
- Add new `TestReconcileContainerCommandHandler` similar to `TestCloseContainerCommandHandler`
- Includes tests for `queueCount` and `invocationCount` metrics
- Test counts for the new command in `TestStateContext#testCommandQueueSummary`
- Tests for Datanodes sending the value back in the heartbeat
- Add checks to `TestHeartbeatEndpoint`
- Tests for SCM receiving the container report
- Add checks to `TestContainerReportHandler`
- Add checks to `TestIncrementalContainerReportHandler`
- Check data checksum is present in replica output of `TestInfoSubCommand`
--
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: issues-unsubscribe@ozone.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org
Re: [PR] HDDS-10372. SCM and Datanode communication for reconciliation [ozone]
Posted by "errose28 (via GitHub)" <gi...@apache.org>.
errose28 commented on code in PR #6506:
URL: https://github.com/apache/ozone/pull/6506#discussion_r1608739605
##########
.github/workflows/repeat-acceptance.yml:
##########
@@ -81,6 +81,8 @@ jobs:
steps:
- name: Checkout project
uses: actions/checkout@v4
+ with:
Review Comment:
Yeah this was a mistake, I just removed it.
--
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: issues-unsubscribe@ozone.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org
Re: [PR] HDDS-10372. SCM and Datanode communication for reconciliation [ozone]
Posted by "errose28 (via GitHub)" <gi...@apache.org>.
errose28 commented on code in PR #6506:
URL: https://github.com/apache/ozone/pull/6506#discussion_r1608748520
##########
hadoop-hdds/common/src/main/java/org/apache/hadoop/hdds/scm/container/ContainerReplicaInfo.java:
##########
@@ -35,6 +40,8 @@ public final class ContainerReplicaInfo {
private long keyCount;
private long bytesUsed;
private int replicaIndex = -1;
+ @JsonSerialize(using = LongToHexJsonSerializer.class)
+ private long dataChecksum;
Review Comment:
Yeah. That seemed standard but we could use a different format if there's a better option.
--
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: issues-unsubscribe@ozone.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org
Re: [PR] HDDS-10372. SCM and Datanode communication for reconciliation [ozone]
Posted by "errose28 (via GitHub)" <gi...@apache.org>.
errose28 commented on code in PR #6506:
URL: https://github.com/apache/ozone/pull/6506#discussion_r1608747102
##########
hadoop-hdds/common/src/main/java/org/apache/hadoop/hdds/scm/client/ScmClient.java:
##########
@@ -454,4 +454,12 @@ DecommissionScmResponseProto decommissionScm(
String scmId) throws IOException;
String getMetrics(String query) throws IOException;
+
+ /**
+ * Trigger a reconcile command to datanodes for the current container ID.
Review Comment:
Fixed, will push in the next batch of updates.
--
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: issues-unsubscribe@ozone.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org
Re: [PR] HDDS-10372. SCM and Datanode communication for reconciliation [ozone]
Posted by "kerneltime (via GitHub)" <gi...@apache.org>.
kerneltime merged PR #6506:
URL: https://github.com/apache/ozone/pull/6506
--
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: issues-unsubscribe@ozone.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org
Re: [PR] HDDS-10372. SCM and Datanode communication for reconciliation [ozone]
Posted by "aswinshakil (via GitHub)" <gi...@apache.org>.
aswinshakil commented on code in PR #6506:
URL: https://github.com/apache/ozone/pull/6506#discussion_r1617674426
##########
hadoop-ozone/dist/src/main/smoketest/admincli/container.robot:
##########
@@ -96,5 +96,36 @@ Cannot close container without admin privilege
Cannot create container without admin privilege
Requires admin privilege ozone admin container create
+Cannot reconcile container without admin privilege
+ Requires admin privilege ozone admin container reconcile "${CONTAINER}"
+
Reset user
Run Keyword if '${SECURITY_ENABLED}' == 'true' Kinit test user testuser testuser.keytab
+
+Cannot reconcile open container
+ # At this point we should have an open Ratis Three container.
+ ${container} = Execute ozone admin container list --state OPEN | jq -r 'select(.replicationConfig.replicationFactor == "THREE") | .containerID' | head -n1
+ Execute and check rc ozone admin container reconcile "${container}" 255
+ # The container should not yet have any replica checksums.
+ # TODO When the scanner is computing checksums automatically, this test may need to be updated.
+ ${data_checksum} = Execute ozone admin container info "${container}" --json | jq -r '.replicas[].dataChecksum' | head -n1
+ # 0 is the hex value of an empty checksum.
+ Should Be Equal As Strings 0 ${data_checksum}
+
+Close container
+ ${container} = Execute ozone admin container list --state OPEN | jq -r 'select(.replicationConfig.replicationFactor == "THREE") | .containerID' | head -1
+ Execute ozone admin container close "${container}"
+ ${output} = Execute ozone admin container info "${container}"
+ Should contain ${output} CLOS
Review Comment:
```suggestion
Should contain ${output} CLOSED
```
##########
hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/container/reconciliation/package-info.java:
##########
@@ -0,0 +1,21 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with this
+ * work for additional information regarding copyright ownership. The ASF
+ * licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+
+package org.apache.hadoop.hdds.scm.container.reconiliation;
Review Comment:
```suggestion
package org.apache.hadoop.hdds.scm.container.reconciliation;
```
--
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: issues-unsubscribe@ozone.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org
Re: [PR] HDDS-10372. SCM and Datanode communication for reconciliation [ozone]
Posted by "errose28 (via GitHub)" <gi...@apache.org>.
errose28 commented on code in PR #6506:
URL: https://github.com/apache/ozone/pull/6506#discussion_r1617916838
##########
hadoop-ozone/dist/src/main/smoketest/admincli/container.robot:
##########
@@ -96,5 +96,36 @@ Cannot close container without admin privilege
Cannot create container without admin privilege
Requires admin privilege ozone admin container create
+Cannot reconcile container without admin privilege
+ Requires admin privilege ozone admin container reconcile "${CONTAINER}"
+
Reset user
Run Keyword if '${SECURITY_ENABLED}' == 'true' Kinit test user testuser testuser.keytab
+
+Cannot reconcile open container
+ # At this point we should have an open Ratis Three container.
+ ${container} = Execute ozone admin container list --state OPEN | jq -r 'select(.replicationConfig.replicationFactor == "THREE") | .containerID' | head -n1
+ Execute and check rc ozone admin container reconcile "${container}" 255
+ # The container should not yet have any replica checksums.
+ # TODO When the scanner is computing checksums automatically, this test may need to be updated.
+ ${data_checksum} = Execute ozone admin container info "${container}" --json | jq -r '.replicas[].dataChecksum' | head -n1
+ # 0 is the hex value of an empty checksum.
+ Should Be Equal As Strings 0 ${data_checksum}
+
+Close container
+ ${container} = Execute ozone admin container list --state OPEN | jq -r 'select(.replicationConfig.replicationFactor == "THREE") | .containerID' | head -1
+ Execute ozone admin container close "${container}"
+ ${output} = Execute ozone admin container info "${container}"
+ Should contain ${output} CLOS
Review Comment:
`CLOS` is used here (and in the existing `close container` test) because the state may either be `CLOSING` or `CLOSED` between when the container close command finishes and the container info command is executed. After this, we wait until the final state finishes moving to CLOSED. I can add a comment explaining this.
##########
hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/container/reconciliation/package-info.java:
##########
@@ -0,0 +1,21 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with this
+ * work for additional information regarding copyright ownership. The ASF
+ * licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+
+package org.apache.hadoop.hdds.scm.container.reconiliation;
Review Comment:
oh good catch
--
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: issues-unsubscribe@ozone.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org
Re: [PR] HDDS-10372. SCM and Datanode communication for reconciliation [ozone]
Posted by "kerneltime (via GitHub)" <gi...@apache.org>.
kerneltime commented on code in PR #6506:
URL: https://github.com/apache/ozone/pull/6506#discussion_r1606301331
##########
.github/workflows/repeat-acceptance.yml:
##########
@@ -81,6 +81,8 @@ jobs:
steps:
- name: Checkout project
uses: actions/checkout@v4
+ with:
Review Comment:
I believe this file can be dropped?
--
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: issues-unsubscribe@ozone.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org
Re: [PR] HDDS-10372. SCM and Datanode communication for reconciliation [ozone]
Posted by "errose28 (via GitHub)" <gi...@apache.org>.
errose28 commented on PR #6506:
URL: https://github.com/apache/ozone/pull/6506#issuecomment-2097374187
At last the CI is [green](https://github.com/errose28/ozone/actions/runs/8974355092/job/24647255284)
--
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: issues-unsubscribe@ozone.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org
Re: [PR] HDDS-10372. SCM and Datanode communication for reconciliation [ozone]
Posted by "kerneltime (via GitHub)" <gi...@apache.org>.
kerneltime commented on code in PR #6506:
URL: https://github.com/apache/ozone/pull/6506#discussion_r1597694205
##########
hadoop-hdds/common/src/main/java/org/apache/hadoop/hdds/scm/client/ScmClient.java:
##########
@@ -454,4 +454,12 @@ DecommissionScmResponseProto decommissionScm(
String scmId) throws IOException;
String getMetrics(String query) throws IOException;
+
+ /**
+ * Trigger a reconcile command to datanodes for the current container ID.
Review Comment:
```suggestion
* Trigger a reconcile command to datanodes for a container ID.
```
##########
hadoop-hdds/tools/src/main/java/org/apache/hadoop/hdds/scm/cli/container/ReconcileSubcommand.java:
##########
@@ -0,0 +1,50 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ * <p>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p>
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.hadoop.hdds.scm.cli.container;
+
+import java.io.IOException;
+
+import org.apache.hadoop.hdds.cli.HddsVersionProvider;
+import org.apache.hadoop.hdds.scm.cli.ScmSubcommand;
+import org.apache.hadoop.hdds.scm.client.ScmClient;
+
+import picocli.CommandLine;
+import picocli.CommandLine.Command;
+
+/**
+ * This is the handler that process container list command.
+ */
+@Command(
+ name = "reconcile",
+ description = "Reconcile container replicas",
+ mixinStandardHelpOptions = true,
+ versionProvider = HddsVersionProvider.class)
+public class ReconcileSubcommand extends ScmSubcommand {
+
+ @CommandLine.Parameters(description = "ID of the container to reconcile")
+ private long containerId;
+
+ @Override
+ public void execute(ScmClient scmClient) throws IOException {
+ scmClient.reconcileContainer(containerId);
+ System.out.println("Reconciliation has been triggered for container " + containerId);
+ // TODO a better option to check status may be added later.
+ System.out.println("Use \"ozone admin container info --json " + containerId + "\" to see the checksums of each " +
+ "container replica");
+ }
Review Comment:
```suggestion
System.out.println("Once reconciliation is complete, use \"ozone admin container info --json " + containerId + "\" to see the checksums of each " +
"container replica");
}
```
##########
hadoop-hdds/common/src/main/java/org/apache/hadoop/hdds/scm/container/ContainerReplicaInfo.java:
##########
@@ -35,6 +40,8 @@ public final class ContainerReplicaInfo {
private long keyCount;
private long bytesUsed;
private int replicaIndex = -1;
+ @JsonSerialize(using = LongToHexJsonSerializer.class)
+ private long dataChecksum;
Review Comment:
Q: Hex for printing to make it more human friendly?
--
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: issues-unsubscribe@ozone.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org