Skip to content

Commit 6537759

Browse files
authored
HDDS-15108. Remove duplicate keys from ozone-default.xml (#10121)
1 parent e0e821f commit 6537759

15 files changed

Lines changed: 71 additions & 127 deletions

File tree

dev-support/ci/xml_to_md.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,12 +64,19 @@ def parse_xml_file(xml_content, properties):
6464
raise ValueError(f"Property '{name}' is missing a description.")
6565
tag = prop.findtext('tag', '')
6666

67-
properties[name] = Property(
67+
p = Property(
6868
name=name.strip(),
6969
value=prop.findtext('value', '').strip(),
7070
tag=tag,
7171
description=' '.join(description.split()).strip()
7272
)
73+
if name in properties and p != properties[name]:
74+
msg = f"Duplicate property '{name}'"
75+
print(msg)
76+
print(properties[name])
77+
print(p)
78+
raise ValueError(msg)
79+
properties[name] = p
7380
return properties
7481

7582
def format_properties(properties):

hadoop-hdds/client/src/main/java/org/apache/hadoop/hdds/scm/OzoneClientConfig.java

Lines changed: 29 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -189,8 +189,11 @@ public class OzoneClientConfig {
189189

190190
@Config(key = "ozone.client.max.ec.stripe.write.retries",
191191
defaultValue = "10",
192-
description = "Ozone EC client to retry stripe to new block group on" +
193-
" failures.",
192+
description = "When EC stripe write failed, client will request to allocate new block group "
193+
+ "and write the failed stripe into new block group. If the same stripe failure "
194+
+ "continued in newly acquired block group also, then it will retry by requesting "
195+
+ "to allocate new block group again. This configuration is used to limit these "
196+
+ "number of retries. By default the number of retries are 10.",
194197
tags = ConfigTag.CLIENT)
195198
private int maxECStripeWriteRetries = 10;
196199

@@ -244,8 +247,12 @@ public class OzoneClientConfig {
244247
@Config(key = "ozone.client.fs.default.bucket.layout",
245248
defaultValue = "FILE_SYSTEM_OPTIMIZED",
246249
type = ConfigType.STRING,
247-
description = "The bucket layout used by buckets created using OFS. " +
248-
"Valid values include FILE_SYSTEM_OPTIMIZED and LEGACY",
250+
description =
251+
"Default bucket layout value used when buckets are created using OFS. "
252+
+ "Supported values are LEGACY and FILE_SYSTEM_OPTIMIZED. "
253+
+ "FILE_SYSTEM_OPTIMIZED: This layout allows the bucket to support atomic rename/delete operations and "
254+
+ "also allows interoperability between S3 and FS APIs. Keys written via S3 API with a '/' delimiter "
255+
+ "will create intermediate directories.",
249256
tags = ConfigTag.CLIENT)
250257
private String fsDefaultBucketLayout = "FILE_SYSTEM_OPTIMIZED";
251258

@@ -650,4 +657,22 @@ public enum ChecksumCombineMode {
650657
MD5MD5CRC, // MD5 of block checksums, which are MD5 over chunk CRCs
651658
COMPOSITE_CRC // Block/chunk-independent composite CRC
652659
}
660+
661+
/**
662+
* String keys for tests and grep.
663+
*/
664+
public static final class Keys {
665+
public static final String OZONE_CLIENT_FS_DEFAULT_BUCKET_LAYOUT =
666+
"ozone.client.fs.default.bucket.layout";
667+
public static final String OZONE_CLIENT_MAX_EC_STRIPE_WRITE_RETRIES =
668+
"ozone.client.max.ec.stripe.write.retries";
669+
}
670+
671+
/**
672+
* Default values for tests.
673+
*/
674+
public static final class Defaults {
675+
public static final String OZONE_CLIENT_FS_DEFAULT_BUCKET_LAYOUT =
676+
OzoneConfigKeys.OZONE_BUCKET_LAYOUT_FILE_SYSTEM_OPTIMIZED;
677+
}
653678
}

hadoop-hdds/common/src/main/java/org/apache/hadoop/hdds/scm/ScmConfig.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,16 +33,16 @@ public class ScmConfig extends ReconfigurableConfig {
3333

3434
@Config(key = "hdds.scm.kerberos.principal",
3535
type = ConfigType.STRING,
36-
defaultValue = "",
37-
tags = { ConfigTag.SECURITY, ConfigTag.OZONE },
38-
description = "This Kerberos principal is used by the SCM service."
36+
defaultValue = "SCM/_HOST@REALM",
37+
tags = { ConfigTag.SCM, ConfigTag.SECURITY, ConfigTag.OZONE },
38+
description = "The SCM service principal. e.g. scm/_HOST@REALM.COM"
3939
)
4040
private String principal;
4141

4242
@Config(key = "hdds.scm.kerberos.keytab.file",
4343
type = ConfigType.STRING,
44-
defaultValue = "",
45-
tags = { ConfigTag.SECURITY, ConfigTag.OZONE },
44+
defaultValue = "/etc/security/keytabs/SCM.keytab",
45+
tags = { ConfigTag.SCM, ConfigTag.SECURITY, ConfigTag.OZONE },
4646
description = "The keytab file used by SCM daemon to login as " +
4747
"its service principal."
4848
)

hadoop-hdds/common/src/main/java/org/apache/hadoop/hdds/scm/ScmConfigKeys.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -627,6 +627,7 @@ public final class ScmConfigKeys {
627627

628628
public static final String OZONE_SCM_HA_RATIS_SERVER_RPC_FIRST_ELECTION_TIMEOUT
629629
= "ozone.scm.ha.raft.server.rpc.first-election.timeout";
630+
public static final String HDDS_SCM_HTTP_AUTH_TYPE = "hdds.scm.http.auth.type";
630631

631632
/**
632633
* Never constructed.

hadoop-hdds/common/src/main/java/org/apache/hadoop/ozone/OzoneConfigKeys.java

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -177,10 +177,6 @@ public final class OzoneConfigKeys {
177177
"ozone.scm.block.size";
178178
public static final String OZONE_SCM_BLOCK_SIZE_DEFAULT = "256MB";
179179

180-
public static final String OZONE_CLIENT_MAX_EC_STRIPE_WRITE_RETRIES =
181-
"ozone.client.max.ec.stripe.write.retries";
182-
public static final String OZONE_CLIENT_MAX_EC_STRIPE_WRITE_RETRIES_DEFAULT =
183-
"10";
184180
public static final String OZONE_CLIENT_EC_GRPC_RETRIES_ENABLED =
185181
"ozone.client.ec.grpc.retries.enabled";
186182
public static final boolean OZONE_CLIENT_EC_GRPC_RETRIES_ENABLED_DEFAULT
@@ -629,11 +625,6 @@ public final class OzoneConfigKeys {
629625
public static final String OZONE_BUCKET_LAYOUT_OBJECT_STORE =
630626
"OBJECT_STORE";
631627

632-
public static final String OZONE_CLIENT_FS_DEFAULT_BUCKET_LAYOUT =
633-
"ozone.client.fs.default.bucket.layout";
634-
public static final String OZONE_CLIENT_FS_BUCKET_LAYOUT_DEFAULT =
635-
OZONE_BUCKET_LAYOUT_FILE_SYSTEM_OPTIMIZED;
636-
637628
public static final String OZONE_S3G_DEFAULT_BUCKET_LAYOUT_KEY =
638629
"ozone.s3g.default.bucket.layout";
639630
public static final String OZONE_S3G_DEFAULT_BUCKET_LAYOUT_DEFAULT =

hadoop-hdds/common/src/main/resources/ozone-default.xml

Lines changed: 1 addition & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -800,16 +800,6 @@
800800
Then maximum 500000/(100/8) = 40000 blocks will be sent to each DN in every interval.
801801
</description>
802802
</property>
803-
<property>
804-
<name>ozone.scm.block.deletion.per.dn.distribution.factor</name>
805-
<value>8</value>
806-
<tag>OZONE, SCM</tag>
807-
<description>
808-
Factor with which number of delete blocks sent to each datanode in every interval.
809-
If total number of DNs are 100 and hdds.scm.block.deletion.per-interval.max is 500000
810-
Then maximum 500000/(100/8) = 40000 blocks will be sent to each DN in every interval.
811-
</description>
812-
</property>
813803
<property>
814804
<name>ozone.scm.block.size</name>
815805
<value>256MB</value>
@@ -1822,37 +1812,6 @@
18221812
</description>
18231813
</property>
18241814

1825-
<property>
1826-
<name>hdds.scm.kerberos.keytab.file</name>
1827-
<value>/etc/security/keytabs/SCM.keytab</value>
1828-
<tag>SCM, SECURITY, KERBEROS</tag>
1829-
<description> The keytab file used by SCM daemon to login as its service principal.
1830-
</description>
1831-
</property>
1832-
<property>
1833-
<name>hdds.scm.kerberos.principal</name>
1834-
<value>SCM/_HOST@REALM</value>
1835-
<tag>SCM, SECURITY, KERBEROS</tag>
1836-
<description>The SCM service principal. e.g. scm/_HOST@REALM.COM</description>
1837-
</property>
1838-
<property>
1839-
<name>hdds.scm.http.auth.kerberos.principal</name>
1840-
<value>HTTP/_HOST@REALM</value>
1841-
<tag>SCM, SECURITY, KERBEROS</tag>
1842-
<description>
1843-
SCM http server service principal if SPNEGO is enabled for SCM http server.
1844-
</description>
1845-
</property>
1846-
<property>
1847-
<name>hdds.scm.http.auth.kerberos.keytab</name>
1848-
<value>/etc/security/keytabs/HTTP.keytab</value>
1849-
<tag>SCM, SECURITY, KERBEROS</tag>
1850-
<description>
1851-
The keytab file used by SCM http server to login as its service
1852-
principal if SPNEGO is enabled for SCM http server.
1853-
</description>
1854-
</property>
1855-
18561815
<property>
18571816
<name>ozone.s3.administrators</name>
18581817
<value/>
@@ -4235,7 +4194,7 @@
42354194
<value>60000</value>
42364195
<tag>OZONE, PERFORMANCE, S3GATEWAY</tag>
42374196
<description>
4238-
OM/SCM/DN/S3GATEWAY Server connection timeout in milliseconds.
4197+
Ozone HTTP server connection timeout in milliseconds.
42394198
</description>
42404199
</property>
42414200

@@ -4299,18 +4258,6 @@
42994258
</description>
43004259
</property>
43014260

4302-
<property>
4303-
<name>ozone.client.max.ec.stripe.write.retries</name>
4304-
<value>10</value>
4305-
<tag>CLIENT</tag>
4306-
<description>
4307-
When EC stripe write failed, client will request to allocate new block group and write the failed stripe into new
4308-
block group. If the same stripe failure continued in newly acquired block group also, then it will retry by
4309-
requesting to allocate new block group again. This configuration is used to limit these number of retries. By
4310-
default the number of retries are 10.
4311-
</description>
4312-
</property>
4313-
43144261
<property>
43154262
<name>ozone.client.ec.grpc.retries.enabled</name>
43164263
<value>true</value>
@@ -4391,18 +4338,6 @@
43914338
</property>
43924339

43934340
<property>
4394-
<name>ozone.client.fs.default.bucket.layout</name>
4395-
<value>FILE_SYSTEM_OPTIMIZED</value>
4396-
<tag>OZONE, CLIENT</tag>
4397-
<description>
4398-
Default bucket layout value used when buckets are created using OFS.
4399-
Supported values are LEGACY and FILE_SYSTEM_OPTIMIZED.
4400-
FILE_SYSTEM_OPTIMIZED: This layout allows the bucket to support atomic rename/delete operations and
4401-
also allows interoperability between S3 and FS APIs. Keys written via S3 API with a "/" delimiter
4402-
will create intermediate directories.
4403-
</description>
4404-
</property>
4405-
<property>
44064341
<name>ozone.om.namespace.s3.strict</name>
44074342
<value>true</value>
44084343
<tag>OZONE, OM</tag>

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

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -30,21 +30,20 @@ public class SCMHTTPServerConfig {
3030

3131
@Config(key = "hdds.scm.http.auth.kerberos.principal",
3232
type = ConfigType.STRING,
33-
defaultValue = "",
34-
tags = {ConfigTag.SECURITY},
35-
description = "This Kerberos principal is used when communicating to " +
36-
"the HTTP server of SCM.The protocol used is SPNEGO."
33+
defaultValue = "HTTP/_HOST@REALM",
34+
tags = { ConfigTag.KERBEROS, ConfigTag.SCM, ConfigTag.SECURITY },
35+
description = "SCM http server service principal if SPNEGO is enabled for SCM http server."
3736
)
38-
private String principal = "";
37+
private String principal;
3938

4039
@Config(key = "hdds.scm.http.auth.kerberos.keytab",
4140
type = ConfigType.STRING,
42-
defaultValue = "",
43-
tags = {ConfigTag.SECURITY},
41+
defaultValue = "/etc/security/keytabs/HTTP.keytab",
42+
tags = { ConfigTag.KERBEROS, ConfigTag.SCM, ConfigTag.SECURITY },
4443
description = "The keytab file used by SCM http server to login" +
45-
" as its service principal."
44+
" as its service principal if SPNEGO is enabled for SCM http server."
4645
)
47-
private String keytab = "";
46+
private String keytab;
4847

4948
public void setKerberosPrincipal(String kerberosPrincipal) {
5049
this.principal = kerberosPrincipal;
@@ -76,9 +75,6 @@ public static class ConfigStrings {
7675
SCMHTTPServerConfig.class.getAnnotation(ConfigGroup.class).prefix() +
7776
".";
7877

79-
public static final String HDDS_SCM_HTTP_AUTH_TYPE =
80-
HDDS_SCM_HTTP_AUTH_CONFIG_PREFIX + "type";
81-
8278
public static final String HDDS_SCM_HTTP_KERBEROS_PRINCIPAL_KEY =
8379
HDDS_SCM_HTTP_AUTH_CONFIG_PREFIX + "kerberos.principal";
8480

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ public StorageContainerManagerHttpServer(MutableConfigurationSource conf,
8383

8484
@Override
8585
protected String getHttpAuthType() {
86-
return SCMHTTPServerConfig.ConfigStrings.HDDS_SCM_HTTP_AUTH_TYPE;
86+
return ScmConfigKeys.HDDS_SCM_HTTP_AUTH_TYPE;
8787
}
8888

8989
@Override

hadoop-ozone/cli-debug/src/main/java/org/apache/hadoop/ozone/debug/kerberos/HttpAuthProbe.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919

2020
import org.apache.hadoop.hdds.HddsConfigKeys;
2121
import org.apache.hadoop.hdds.conf.OzoneConfiguration;
22-
import org.apache.hadoop.hdds.scm.server.SCMHTTPServerConfig;
22+
import org.apache.hadoop.hdds.scm.ScmConfigKeys;
2323
import org.apache.hadoop.ozone.om.OMConfigKeys;
2424
import org.apache.hadoop.ozone.recon.ReconServerConfigKeys;
2525

@@ -41,7 +41,7 @@ public String name() {
4141
public ProbeResult test(OzoneConfiguration conf) {
4242

4343
print(conf, OMConfigKeys.OZONE_OM_HTTP_AUTH_TYPE);
44-
print(conf, SCMHTTPServerConfig.ConfigStrings.HDDS_SCM_HTTP_AUTH_TYPE);
44+
print(conf, ScmConfigKeys.HDDS_SCM_HTTP_AUTH_TYPE);
4545
print(conf, HddsConfigKeys.HDDS_DATANODE_HTTP_AUTH_TYPE);
4646
print(conf, ReconServerConfigKeys.OZONE_RECON_HTTP_AUTH_TYPE);
4747
//Used key directly to avoid cyclic dependency

hadoop-ozone/client/src/test/java/org/apache/hadoop/ozone/client/TestOzoneECClient.java

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@
4444
import org.apache.hadoop.hdds.protocol.DatanodeDetails;
4545
import org.apache.hadoop.hdds.protocol.datanode.proto.ContainerProtos;
4646
import org.apache.hadoop.hdds.protocol.proto.HddsProtos;
47+
import org.apache.hadoop.hdds.scm.OzoneClientConfig;
4748
import org.apache.hadoop.hdds.scm.XceiverClientFactory;
4849
import org.apache.hadoop.hdds.scm.container.common.helpers.ContainerNotOpenException;
4950
import org.apache.hadoop.hdds.scm.pipeline.Pipeline;
@@ -694,7 +695,7 @@ public void testStripeWriteRetriesOnAllNodeFailures() throws Exception {
694695
public void testStripeWriteRetriesOn4FailuresWith3RetriesAllowed()
695696
throws Exception {
696697
OzoneConfiguration con = createConfiguration();
697-
con.setInt(OzoneConfigKeys.OZONE_CLIENT_MAX_EC_STRIPE_WRITE_RETRIES, 3);
698+
con.setInt(OzoneClientConfig.Keys.OZONE_CLIENT_MAX_EC_STRIPE_WRITE_RETRIES, 3);
698699

699700
int[] nodesIndexesToMarkFailure = new int[4];
700701
nodesIndexesToMarkFailure[0] = 0;
@@ -895,7 +896,7 @@ public void testLargeWriteOfMultipleStripesWithStripeFailure()
895896
OzoneConfiguration con = createConfiguration();
896897
// block size of 3KB could hold 3 full stripes
897898
con.setStorageSize(OzoneConfigKeys.OZONE_SCM_BLOCK_SIZE, 3, StorageUnit.KB);
898-
con.setInt(OzoneConfigKeys.OZONE_CLIENT_MAX_EC_STRIPE_WRITE_RETRIES, 3);
899+
con.setInt(OzoneClientConfig.Keys.OZONE_CLIENT_MAX_EC_STRIPE_WRITE_RETRIES, 3);
899900
MultiNodePipelineBlockAllocator blkAllocator =
900901
new MultiNodePipelineBlockAllocator(con, dataBlocks + parityBlocks,
901902
15);
@@ -968,7 +969,7 @@ public void testPartialStripeWithPartialChunkRetry()
968969
OzoneConfiguration con = createConfiguration();
969970
// block size of 3KB could hold 3 full stripes
970971
con.setStorageSize(OzoneConfigKeys.OZONE_SCM_BLOCK_SIZE, 3, StorageUnit.KB);
971-
con.setInt(OzoneConfigKeys.OZONE_CLIENT_MAX_EC_STRIPE_WRITE_RETRIES, 3);
972+
con.setInt(OzoneClientConfig.Keys.OZONE_CLIENT_MAX_EC_STRIPE_WRITE_RETRIES, 3);
972973
MultiNodePipelineBlockAllocator blkAllocator =
973974
new MultiNodePipelineBlockAllocator(con, dataBlocks + parityBlocks, 15);
974975
createNewClient(con, blkAllocator);
@@ -1029,7 +1030,7 @@ void testDiscardPreAllocatedBlocksPreventRetryExceeds()
10291030
close();
10301031
OzoneConfiguration con = createConfiguration();
10311032
int maxRetries = 3;
1032-
con.setInt(OzoneConfigKeys.OZONE_CLIENT_MAX_EC_STRIPE_WRITE_RETRIES,
1033+
con.setInt(OzoneClientConfig.Keys.OZONE_CLIENT_MAX_EC_STRIPE_WRITE_RETRIES,
10331034
maxRetries);
10341035
MultiNodePipelineBlockAllocator blkAllocator =
10351036
new MultiNodePipelineBlockAllocator(con, dataBlocks + parityBlocks,

0 commit comments

Comments
 (0)