48
48
import org .elasticsearch .common .xcontent .NamedXContentRegistry ;
49
49
import org .elasticsearch .common .xcontent .XContentHelper ;
50
50
import org .elasticsearch .core .Nullable ;
51
- import org .elasticsearch .core .PathUtils ;
52
51
import org .elasticsearch .env .Environment ;
53
52
import org .elasticsearch .index .Index ;
54
53
import org .elasticsearch .index .IndexModule ;
69
68
70
69
import java .io .IOException ;
71
70
import java .io .UnsupportedEncodingException ;
72
- import java .nio .file .Path ;
73
71
import java .time .Instant ;
74
72
import java .util .ArrayList ;
75
73
import java .util .Arrays ;
@@ -1047,7 +1045,7 @@ public void validateIndexSettings(String indexName, final Settings settings, fin
1047
1045
}
1048
1046
1049
1047
List <String > getIndexSettingsValidationErrors (final Settings settings , final boolean forbidPrivateIndexSettings ) {
1050
- List <String > validationErrors = validateIndexCustomPath (settings , env . sharedDataFile () );
1048
+ List <String > validationErrors = validateNoCustomPath (settings );
1051
1049
if (forbidPrivateIndexSettings ) {
1052
1050
validationErrors .addAll (validatePrivateSettingsNotExplicitlySet (settings , indexScopedSettings ));
1053
1051
}
@@ -1068,27 +1066,17 @@ private static List<String> validatePrivateSettingsNotExplicitlySet(Settings set
1068
1066
}
1069
1067
1070
1068
/**
1071
- * Validates that the configured index data path (if any) is a sub-path of the configured shared data path (if any)
1069
+ * Validates an index data path is not specified.
1072
1070
*
1073
1071
* @param settings the index configured settings
1074
- * @param sharedDataPath the configured `path.shared_data` (if any)
1075
- * @return a list containing validaton errors or an empty list if there aren't any errors
1072
+ * @return a list containing validation errors or an empty list if there aren't any errors
1076
1073
*/
1077
- private static List <String > validateIndexCustomPath (Settings settings , @ Nullable Path sharedDataPath ) {
1078
- String customPath = IndexMetadata .INDEX_DATA_PATH_SETTING .get (settings );
1079
- List <String > validationErrors = new ArrayList <>();
1080
- if (Strings .isEmpty (customPath ) == false ) {
1081
- if (sharedDataPath == null ) {
1082
- validationErrors .add ("path.shared_data must be set in order to use custom data paths" );
1083
- } else {
1084
- Path resolvedPath = PathUtils .get (new Path []{sharedDataPath }, customPath );
1085
- if (resolvedPath == null ) {
1086
- validationErrors .add ("custom path [" + customPath +
1087
- "] is not a sub-path of path.shared_data [" + sharedDataPath + "]" );
1088
- }
1089
- }
1074
+ static List <String > validateNoCustomPath (Settings settings ) {
1075
+ if (IndexMetadata .INDEX_DATA_PATH_SETTING .exists (settings )) {
1076
+ return List .of ("per-index custom data path using setting ["
1077
+ + IndexMetadata .INDEX_DATA_PATH_SETTING .getKey () + "] is no longer supported on new indices" );
1090
1078
}
1091
- return validationErrors ;
1079
+ return List . of () ;
1092
1080
}
1093
1081
1094
1082
/**
0 commit comments