8
8
9
9
package org .opensearch .indices ;
10
10
11
+ import org .opensearch .common .annotation .ExperimentalApi ;
11
12
import org .opensearch .common .annotation .PublicApi ;
12
13
import org .opensearch .common .settings .ClusterSettings ;
13
14
import org .opensearch .common .settings .Setting ;
14
15
import org .opensearch .common .settings .Setting .Property ;
15
16
import org .opensearch .common .settings .Settings ;
16
17
import org .opensearch .common .unit .TimeValue ;
17
18
import org .opensearch .index .IndexSettings ;
19
+ import org .opensearch .index .remote .RemoteStoreEnums ;
18
20
19
21
/**
20
22
* Settings for remote store
@@ -65,12 +67,41 @@ public class RemoteStoreSettings {
65
67
Property .Dynamic
66
68
);
67
69
70
+ /**
71
+ * This setting is used to set the remote store blob store path type strategy. This setting is effective only for
72
+ * remote store enabled cluster.
73
+ */
74
+ @ ExperimentalApi
75
+ public static final Setting <RemoteStoreEnums .PathType > CLUSTER_REMOTE_STORE_PATH_TYPE_SETTING = new Setting <>(
76
+ "cluster.remote_store.index.path.type" ,
77
+ RemoteStoreEnums .PathType .FIXED .toString (),
78
+ RemoteStoreEnums .PathType ::parseString ,
79
+ Property .NodeScope ,
80
+ Property .Dynamic
81
+ );
82
+
83
+ /**
84
+ * This setting is used to set the remote store blob store path hash algorithm strategy. This setting is effective only for
85
+ * remote store enabled cluster. This setting will come to effect if the {@link #CLUSTER_REMOTE_STORE_PATH_TYPE_SETTING}
86
+ * is either {@code HASHED_PREFIX} or {@code HASHED_INFIX}.
87
+ */
88
+ @ ExperimentalApi
89
+ public static final Setting <RemoteStoreEnums .PathHashAlgorithm > CLUSTER_REMOTE_STORE_PATH_HASH_ALGORITHM_SETTING = new Setting <>(
90
+ "cluster.remote_store.index.path.hash_algorithm" ,
91
+ RemoteStoreEnums .PathHashAlgorithm .FNV_1A_COMPOSITE_1 .toString (),
92
+ RemoteStoreEnums .PathHashAlgorithm ::parseString ,
93
+ Property .NodeScope ,
94
+ Property .Dynamic
95
+ );
96
+
68
97
private volatile TimeValue clusterRemoteTranslogBufferInterval ;
69
98
private volatile int minRemoteSegmentMetadataFiles ;
70
99
private volatile TimeValue clusterRemoteTranslogTransferTimeout ;
100
+ private volatile RemoteStoreEnums .PathType pathType ;
101
+ private volatile RemoteStoreEnums .PathHashAlgorithm pathHashAlgorithm ;
71
102
72
103
public RemoteStoreSettings (Settings settings , ClusterSettings clusterSettings ) {
73
- this . clusterRemoteTranslogBufferInterval = CLUSTER_REMOTE_TRANSLOG_BUFFER_INTERVAL_SETTING .get (settings );
104
+ clusterRemoteTranslogBufferInterval = CLUSTER_REMOTE_TRANSLOG_BUFFER_INTERVAL_SETTING .get (settings );
74
105
clusterSettings .addSettingsUpdateConsumer (
75
106
CLUSTER_REMOTE_TRANSLOG_BUFFER_INTERVAL_SETTING ,
76
107
this ::setClusterRemoteTranslogBufferInterval
@@ -82,11 +113,17 @@ public RemoteStoreSettings(Settings settings, ClusterSettings clusterSettings) {
82
113
this ::setMinRemoteSegmentMetadataFiles
83
114
);
84
115
85
- this . clusterRemoteTranslogTransferTimeout = CLUSTER_REMOTE_TRANSLOG_TRANSFER_TIMEOUT_SETTING .get (settings );
116
+ clusterRemoteTranslogTransferTimeout = CLUSTER_REMOTE_TRANSLOG_TRANSFER_TIMEOUT_SETTING .get (settings );
86
117
clusterSettings .addSettingsUpdateConsumer (
87
118
CLUSTER_REMOTE_TRANSLOG_TRANSFER_TIMEOUT_SETTING ,
88
119
this ::setClusterRemoteTranslogTransferTimeout
89
120
);
121
+
122
+ pathType = clusterSettings .get (CLUSTER_REMOTE_STORE_PATH_TYPE_SETTING );
123
+ clusterSettings .addSettingsUpdateConsumer (CLUSTER_REMOTE_STORE_PATH_TYPE_SETTING , this ::setPathType );
124
+
125
+ pathHashAlgorithm = clusterSettings .get (CLUSTER_REMOTE_STORE_PATH_HASH_ALGORITHM_SETTING );
126
+ clusterSettings .addSettingsUpdateConsumer (CLUSTER_REMOTE_STORE_PATH_HASH_ALGORITHM_SETTING , this ::setPathHashAlgorithm );
90
127
}
91
128
92
129
public TimeValue getClusterRemoteTranslogBufferInterval () {
@@ -112,4 +149,22 @@ public TimeValue getClusterRemoteTranslogTransferTimeout() {
112
149
private void setClusterRemoteTranslogTransferTimeout (TimeValue clusterRemoteTranslogTransferTimeout ) {
113
150
this .clusterRemoteTranslogTransferTimeout = clusterRemoteTranslogTransferTimeout ;
114
151
}
152
+
153
+ @ ExperimentalApi
154
+ public RemoteStoreEnums .PathType getPathType () {
155
+ return pathType ;
156
+ }
157
+
158
+ @ ExperimentalApi
159
+ public RemoteStoreEnums .PathHashAlgorithm getPathHashAlgorithm () {
160
+ return pathHashAlgorithm ;
161
+ }
162
+
163
+ private void setPathType (RemoteStoreEnums .PathType pathType ) {
164
+ this .pathType = pathType ;
165
+ }
166
+
167
+ private void setPathHashAlgorithm (RemoteStoreEnums .PathHashAlgorithm pathHashAlgorithm ) {
168
+ this .pathHashAlgorithm = pathHashAlgorithm ;
169
+ }
115
170
}
0 commit comments