Skip to content

Commit 817ce4b

Browse files
committed
Merge branch 'master' into HDDS-5287
2 parents c9f1419 + 9cc4194 commit 817ce4b

62 files changed

Lines changed: 582 additions & 382 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/block/SCMDeletedBlockTransactionStatusManager.java

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ public SCMDeletedBlockTransactionStatusManager(
8989
this.transactionToDNsCommitMap = new ConcurrentHashMap<>();
9090
this.transactionToRetryCountMap = new ConcurrentHashMap<>();
9191
this.scmDeleteBlocksCommandStatusManager =
92-
new SCMDeleteBlocksCommandStatusManager();
92+
new SCMDeleteBlocksCommandStatusManager(metrics);
9393
}
9494

9595
/**
@@ -104,8 +104,11 @@ protected static class SCMDeleteBlocksCommandStatusManager {
104104
private static final CmdStatus DEFAULT_STATUS = TO_BE_SENT;
105105
private static final Set<CmdStatus> STATUSES_REQUIRING_TIMEOUT = Collections.singleton(SENT);
106106

107-
public SCMDeleteBlocksCommandStatusManager() {
107+
private ScmBlockDeletingServiceMetrics metrics;
108+
109+
public SCMDeleteBlocksCommandStatusManager(ScmBlockDeletingServiceMetrics metrics) {
108110
this.scmCmdStatusRecord = new ConcurrentHashMap<>();
111+
this.metrics = metrics;
109112
}
110113

111114
/**
@@ -314,6 +317,7 @@ private void removeTimeoutScmCommand(DatanodeID dnId,
314317
if (updateTime != null &&
315318
Duration.between(updateTime, now).toMillis() > timeoutMs) {
316319
CmdStatusData state = removeScmCommand(dnId, scmCmdId);
320+
metrics.incrDNCommandsTimeout(dnId, 1);
317321
LOG.warn("SCM BlockDeletionCommand {} for Datanode: {} was removed after {}ms without update",
318322
state, dnId, timeoutMs);
319323
}

hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/block/ScmBlockDeletingServiceMetrics.java

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -179,6 +179,11 @@ public void incrDNCommandsFailure(DatanodeID id, long delta) {
179179
.incrCommandsFailure(delta);
180180
}
181181

182+
public void incrDNCommandsTimeout(DatanodeID id, long delta) {
183+
numCommandsDatanode.computeIfAbsent(id, k -> new DatanodeCommandCounts())
184+
.incrCommandsTimeout(delta);
185+
}
186+
182187
public long getNumBlockDeletionCommandSent() {
183188
return numBlockDeletionCommandSent.value();
184189
}
@@ -248,7 +253,9 @@ public void getMetrics(MetricsCollector metricsCollector, boolean all) {
248253
.addGauge(DatanodeCommandCounts.COMMANDS_SUCCESSFUL_EXECUTION_BY_DN,
249254
e.getValue().getCommandsSuccess())
250255
.addGauge(DatanodeCommandCounts.COMMANDS_FAILED_EXECUTION_BY_DN,
251-
e.getValue().getCommandsFailure());
256+
e.getValue().getCommandsFailure())
257+
.addGauge(DatanodeCommandCounts.COMMANDS_TIMEOUT_BY_DN,
258+
e.getValue().getCommandsTimeout());
252259
}
253260
recordBuilder.endRecord();
254261
}
@@ -260,6 +267,7 @@ public static final class DatanodeCommandCounts {
260267
private long commandsSent;
261268
private long commandsSuccess;
262269
private long commandsFailure;
270+
private long commandsTimeout;
263271

264272
private static final MetricsInfo COMMANDS_SENT_TO_DN = Interns.info(
265273
"CommandsSent",
@@ -270,11 +278,17 @@ public static final class DatanodeCommandCounts {
270278
private static final MetricsInfo COMMANDS_FAILED_EXECUTION_BY_DN = Interns.info(
271279
"CommandsFailed",
272280
"Number of commands sent from SCM to the datanode for deletion for which execution failed.");
281+
282+
private static final MetricsInfo COMMANDS_TIMEOUT_BY_DN = Interns.info(
283+
"CommandsTimeout",
284+
"Number of commands timeout from SCM to DN"
285+
);
273286

274287
public DatanodeCommandCounts() {
275288
this.commandsSent = 0;
276289
this.commandsSuccess = 0;
277290
this.commandsFailure = 0;
291+
this.commandsTimeout = 0;
278292
}
279293

280294
public void incrCommandsSent(long delta) {
@@ -288,6 +302,10 @@ public void incrCommandsSuccess(long delta) {
288302
public void incrCommandsFailure(long delta) {
289303
this.commandsFailure += delta;
290304
}
305+
306+
public void incrCommandsTimeout(long delta) {
307+
this.commandsTimeout += delta;
308+
}
291309

292310
public long getCommandsSent() {
293311
return commandsSent;
@@ -300,10 +318,15 @@ public long getCommandsSuccess() {
300318
public long getCommandsFailure() {
301319
return commandsFailure;
302320
}
321+
322+
public long getCommandsTimeout() {
323+
return commandsTimeout;
324+
}
303325

304326
@Override
305327
public String toString() {
306-
return "Sent=" + commandsSent + ", Success=" + commandsSuccess + ", Failed=" + commandsFailure;
328+
return "Sent=" + commandsSent + ", Success=" + commandsSuccess + ", Failed=" + commandsFailure +
329+
", Timeout=" + commandsTimeout;
307330
}
308331
}
309332

hadoop-hdds/server-scm/src/test/java/org/apache/hadoop/hdds/scm/block/TestSCMDeleteBlocksCommandStatusManager.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
import static org.junit.jupiter.api.Assertions.assertEquals;
2525
import static org.junit.jupiter.api.Assertions.assertNotNull;
2626
import static org.junit.jupiter.api.Assertions.assertNull;
27+
import static org.mockito.Mockito.mock;
2728

2829
import java.util.Arrays;
2930
import java.util.Collections;
@@ -42,6 +43,7 @@
4243
public class TestSCMDeleteBlocksCommandStatusManager {
4344

4445
private SCMDeleteBlocksCommandStatusManager manager;
46+
private ScmBlockDeletingServiceMetrics metrics;
4547
private DatanodeID dnId1;
4648
private DatanodeID dnId2;
4749
private long scmCmdId1;
@@ -55,7 +57,8 @@ public class TestSCMDeleteBlocksCommandStatusManager {
5557

5658
@BeforeEach
5759
public void setup() throws Exception {
58-
manager = new SCMDeleteBlocksCommandStatusManager();
60+
metrics = mock(ScmBlockDeletingServiceMetrics.class);
61+
manager = new SCMDeleteBlocksCommandStatusManager(metrics);
5962
// Create test data
6063
dnId1 = DatanodeID.randomID();
6164
dnId2 = DatanodeID.randomID();

hadoop-ozone/cli-shell/src/main/java/org/apache/hadoop/ozone/shell/ReplicationOptions.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,10 @@
2222
import static org.apache.hadoop.ozone.OzoneConfigKeys.OZONE_REPLICATION_TYPE;
2323

2424
import java.util.Optional;
25-
import org.apache.hadoop.fs.ozone.OzoneClientUtils;
2625
import org.apache.hadoop.hdds.client.ReplicationConfig;
2726
import org.apache.hadoop.hdds.client.ReplicationType;
2827
import org.apache.hadoop.hdds.conf.ConfigurationSource;
28+
import org.apache.hadoop.ozone.client.OzoneClientUtils;
2929

3030
/**
3131
* Common options for specifying replication config: specialized for

hadoop-ozone/cli-shell/src/main/java/org/apache/hadoop/ozone/shell/keys/ChecksumKeyHandler.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717

1818
package org.apache.hadoop.ozone.shell.keys;
1919

20-
import static org.apache.hadoop.fs.ozone.OzoneClientUtils.getFileChecksumWithCombineMode;
20+
import static org.apache.hadoop.ozone.client.OzoneClientUtils.getFileChecksumWithCombineMode;
2121

2222
import com.fasterxml.jackson.annotation.JsonAutoDetect;
2323
import java.io.IOException;

hadoop-ozone/ozonefs-common/src/main/java/org/apache/hadoop/fs/ozone/OzoneClientUtils.java renamed to hadoop-ozone/client/src/main/java/org/apache/hadoop/ozone/client/OzoneClientUtils.java

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
* limitations under the License.
1616
*/
1717

18-
package org.apache.hadoop.fs.ozone;
18+
package org.apache.hadoop.ozone.client;
1919

2020
import static org.apache.hadoop.ozone.OzoneConfigKeys.OZONE_REPLICATION;
2121
import static org.apache.hadoop.ozone.OzoneConfigKeys.OZONE_REPLICATION_TYPE;
@@ -36,9 +36,6 @@
3636
import org.apache.hadoop.hdds.conf.ConfigurationSource;
3737
import org.apache.hadoop.hdds.protocol.proto.HddsProtos;
3838
import org.apache.hadoop.hdds.scm.OzoneClientConfig;
39-
import org.apache.hadoop.ozone.client.ObjectStore;
40-
import org.apache.hadoop.ozone.client.OzoneBucket;
41-
import org.apache.hadoop.ozone.client.OzoneVolume;
4239
import org.apache.hadoop.ozone.client.checksum.BaseFileChecksumHelper;
4340
import org.apache.hadoop.ozone.client.checksum.ChecksumHelperFactory;
4441
import org.apache.hadoop.ozone.client.protocol.ClientProtocol;

hadoop-ozone/ozonefs-common/src/test/java/org/apache/hadoop/fs/ozone/TestOzoneClientUtils.java renamed to hadoop-ozone/client/src/test/java/org/apache/hadoop/ozone/client/TestOzoneClientUtils.java

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
* limitations under the License.
1616
*/
1717

18-
package org.apache.hadoop.fs.ozone;
18+
package org.apache.hadoop.ozone.client;
1919

2020
import static org.junit.jupiter.api.Assertions.assertEquals;
2121
import static org.junit.jupiter.api.Assertions.assertNull;
@@ -32,8 +32,6 @@
3232
import org.apache.hadoop.hdds.protocol.proto.HddsProtos;
3333
import org.apache.hadoop.hdds.scm.OzoneClientConfig;
3434
import org.apache.hadoop.ozone.OzoneConfigKeys;
35-
import org.apache.hadoop.ozone.client.OzoneBucket;
36-
import org.apache.hadoop.ozone.client.OzoneVolume;
3735
import org.apache.hadoop.ozone.client.protocol.ClientProtocol;
3836
import org.junit.jupiter.api.Test;
3937

hadoop-ozone/dist/src/main/compose/common/ec-test.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,3 +30,5 @@ docker-compose up -d --no-recreate --scale datanode=3
3030
execute_robot_test scm -v PREFIX:${prefix} -N read-3-datanodes ec/read.robot
3131
docker-compose up -d --no-recreate --scale datanode=5
3232
execute_robot_test scm -v container:1 -v count:5 -N EC-recovery replication/wait.robot
33+
docker-compose up -d --no-recreate --scale datanode=9
34+
execute_robot_test scm -N S3-EC-Storage ec/awss3ecstorage.robot
Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
# Licensed to the Apache Software Foundation (ASF) under one or more
2+
# contributor license agreements. See the NOTICE file distributed with
3+
# this work for additional information regarding copyright ownership.
4+
# The ASF licenses this file to You under the Apache License, Version 2.0
5+
# (the "License"); you may not use this file except in compliance with
6+
# the License. You may obtain a copy of the License at
7+
#
8+
# http://www.apache.org/licenses/LICENSE-2.0
9+
#
10+
# Unless required by applicable law or agreed to in writing, software
11+
# distributed under the License is distributed on an "AS IS" BASIS,
12+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
# See the License for the specific language governing permissions and
14+
# limitations under the License.
15+
16+
*** Settings ***
17+
Documentation S3 gateway test with aws cli with STANDARD_IA storage class
18+
Library OperatingSystem
19+
Library String
20+
Resource ../commonlib.robot
21+
Resource ../s3/commonawslib.robot
22+
Resource ../s3/mpu_lib.robot
23+
Resource ../ozone-lib/shell.robot
24+
Test Timeout 5 minutes
25+
Suite Setup Setup EC Multipart Tests
26+
Suite Teardown Teardown EC Multipart Tests
27+
Test Setup Generate random prefix
28+
29+
*** Keywords ***
30+
Setup EC Multipart Tests
31+
Setup s3 tests
32+
Create Random File KB 1023 /tmp/1mb
33+
34+
Teardown EC Multipart Tests
35+
Remove Files /tmp/1mb
36+
37+
*** Variables ***
38+
${ENDPOINT_URL} http://s3g:9878
39+
${BUCKET} generated
40+
41+
*** Test Cases ***
42+
43+
Put Object with STANDARD_IA storage class
44+
${file_checksum} = Execute md5sum /tmp/1mb | awk '{print $1}'
45+
46+
${result} = Execute AWSS3ApiCli put-object --bucket ${BUCKET} --key ${PREFIX}/ecKey32 --body /tmp/1mb --storage-class STANDARD_IA
47+
${eTag} = Execute echo '${result}' | jq -r '.ETag'
48+
Should Be Equal ${eTag} \"${file_checksum}\"
49+
Verify Key EC Replication Config /s3v/${BUCKET}/${PREFIX}/ecKey32 RS 3 2 1048576
50+
51+
${result} = Execute AWSS3ApiCli put-object --bucket ${BUCKET} --key ${PREFIX}/ecKey63 --body /tmp/1mb --storage-class STANDARD_IA --metadata="storage-config=rs-6-3-1024k"
52+
${eTag} = Execute echo '${result}' | jq -r '.ETag'
53+
Should Be Equal ${eTag} \"${file_checksum}\"
54+
Verify Key EC Replication Config /s3v/${BUCKET}/${PREFIX}/ecKey63 RS 6 3 1048576
55+
56+
Test multipart upload with STANDARD_IA storage
57+
${uploadID} = Initiate MPU ${BUCKET} ${PREFIX}/ecmultipartKey32 0 --storage-class STANDARD_IA
58+
${eTag1} = Upload MPU part ${BUCKET} ${PREFIX}/ecmultipartKey32 ${uploadID} 1 /tmp/1mb
59+
${result} = Execute AWSS3APICli list-parts --bucket ${BUCKET} --key ${PREFIX}/ecmultipartKey32 --upload-id ${uploadID}
60+
${part1} = Execute echo '${result}' | jq -r '.Parts[0].ETag'
61+
Should Be equal ${part1} ${eTag1}
62+
Should contain ${result} STANDARD_IA
63+
Complete MPU ${BUCKET} ${PREFIX}/ecmultipartKey32 ${uploadID} {ETag=${eTag1},PartNumber=1}
64+
Verify Key EC Replication Config /s3v/${BUCKET}/${PREFIX}/ecmultipartKey32 RS 3 2 1048576
65+
66+
${uploadID} = Initiate MPU ${BUCKET} ${PREFIX}/ecmultipartKey63 0 --storage-class STANDARD_IA --metadata="storage-config=rs-6-3-1024k"
67+
${eTag1} = Upload MPU part ${BUCKET} ${PREFIX}/ecmultipartKey63 ${uploadID} 1 /tmp/part1
68+
${result} = Execute AWSS3APICli list-parts --bucket ${BUCKET} --key ${PREFIX}/ecmultipartKey63 --upload-id ${uploadID}
69+
${part1} = Execute echo '${result}' | jq -r '.Parts[0].ETag'
70+
Should Be equal ${part1} ${eTag1}
71+
Should contain ${result} STANDARD_IA
72+
Complete MPU ${BUCKET} ${PREFIX}/ecmultipartKey63 ${uploadID} {ETag=${eTag1},PartNumber=1}
73+
Verify Key EC Replication Config /s3v/${BUCKET}/${PREFIX}/ecmultipartKey63 RS 6 3 1048576
74+
75+
Copy Object change storage class to STANDARD_IA
76+
${file_checksum} = Execute md5sum /tmp/1mb | awk '{print $1}'
77+
${result} = Execute AWSS3ApiCli put-object --bucket ${BUCKET} --key ${PREFIX}/copyobject/Key1 --body /tmp/1mb
78+
${eTag} = Execute echo '${result}' | jq -r '.ETag'
79+
Should Be Equal ${eTag} \"${file_checksum}\"
80+
81+
${result} = Execute AWSS3APICli copy-object --storage-class STANDARD_IA --bucket ${BUCKET} --key ${PREFIX}/copyobject/Key1 --copy-source ${BUCKET}/${PREFIX}/copyobject/Key1
82+
Should contain ${result} ETag
83+
${eTag} = Execute echo '${result}' | jq -r '.CopyObjectResult.ETag'
84+
Should Be Equal ${eTag} \"${file_checksum}\"
85+
86+
${result} = Execute AWSS3APICli copy-object --storage-class STANDARD_IA --metadata="storage-config=rs-6-3-1024k" --bucket ${BUCKET} --key ${PREFIX}/copyobject/Key1 --copy-source ${BUCKET}/${PREFIX}/copyobject/Key1
87+
Should contain ${result} ETag
88+
${eTag} = Execute echo '${result}' | jq -r '.CopyObjectResult.ETag'
89+
Should Be Equal ${eTag} \"${file_checksum}\"
90+
## TODO: Verify Key EC Replication Config when we support changing storage class

hadoop-ozone/dist/src/main/smoketest/s3/awss3.robot

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,14 @@ File upload and directory list
4646
Should not contain ${result} testfile
4747
Should not contain ${result} dir1
4848
Should contain ${result} file
49+
# Verify S3 storage class if file is replicated or erasure coded.
50+
${result} = Execute AWSS3CliDebug ls s3://${BUCKET}/dir1/dir2/file
51+
IF '${BUCKET}' == 'erasure'
52+
Should contain ${result} STANDARD_IA
53+
ELSE
54+
Should contain ${result} STANDARD
55+
Should not contain ${result} STANDARD_IA
56+
END
4957

5058
File upload with special chars
5159
Execute date > /tmp/testfile

0 commit comments

Comments
 (0)