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