|
135 | 135 | * |- Ac1342-B_x/ - data for index "foo" which was assigned the unique id of Ac1342-B_x in the repository
|
136 | 136 | * | |- meta-20131010.dat - JSON Serialized IndexMetaData for index "foo"
|
137 | 137 | * | |- 0/ - data for shard "0" of index "foo"
|
138 |
| - * | | |- __1 \ |
139 |
| - * | | |- __2 | |
140 |
| - * | | |- __3 |- files from different segments see snapshot-* for their mappings to real segment files |
141 |
| - * | | |- __4 | |
142 |
| - * | | |- __5 / |
| 138 | + * | | |- __1 \ (files with numeric names were created by older ES versions) |
| 139 | + * | | |- __2 | |
| 140 | + * | | |- __VPO5oDMVT5y4Akv8T_AO_A |- files from different segments see snap-* for their mappings to real segment files |
| 141 | + * | | |- __1gbJy18wS_2kv1qI7FgKuQ | |
| 142 | + * | | |- __R8JvZAHlSMyMXyZc2SS8Zg / |
143 | 143 | * | | .....
|
144 | 144 | * | | |- snap-20131010.dat - JSON serialized BlobStoreIndexShardSnapshot for snapshot "20131010"
|
145 | 145 | * | | |- snap-20131011.dat - JSON serialized BlobStoreIndexShardSnapshot for snapshot "20131011"
|
@@ -1065,41 +1065,6 @@ protected void finalize(final List<SnapshotFiles> snapshots,
|
1065 | 1065 | }
|
1066 | 1066 | }
|
1067 | 1067 |
|
1068 |
| - /** |
1069 |
| - * Generates blob name |
1070 |
| - * |
1071 |
| - * @param generation the blob number |
1072 |
| - * @return the blob name |
1073 |
| - */ |
1074 |
| - protected String fileNameFromGeneration(long generation) { |
1075 |
| - return DATA_BLOB_PREFIX + Long.toString(generation, Character.MAX_RADIX); |
1076 |
| - } |
1077 |
| - |
1078 |
| - /** |
1079 |
| - * Finds the next available blob number |
1080 |
| - * |
1081 |
| - * @param blobs list of blobs in the repository |
1082 |
| - * @return next available blob number |
1083 |
| - */ |
1084 |
| - protected long findLatestFileNameGeneration(Map<String, BlobMetaData> blobs) { |
1085 |
| - long generation = -1; |
1086 |
| - for (String name : blobs.keySet()) { |
1087 |
| - if (!name.startsWith(DATA_BLOB_PREFIX)) { |
1088 |
| - continue; |
1089 |
| - } |
1090 |
| - name = canonicalName(name); |
1091 |
| - try { |
1092 |
| - long currentGen = Long.parseLong(name.substring(DATA_BLOB_PREFIX.length()), Character.MAX_RADIX); |
1093 |
| - if (currentGen > generation) { |
1094 |
| - generation = currentGen; |
1095 |
| - } |
1096 |
| - } catch (NumberFormatException e) { |
1097 |
| - logger.warn("file [{}] does not conform to the '{}' schema", name, DATA_BLOB_PREFIX); |
1098 |
| - } |
1099 |
| - } |
1100 |
| - return generation; |
1101 |
| - } |
1102 |
| - |
1103 | 1068 | /**
|
1104 | 1069 | * Loads all available snapshots in the repository
|
1105 | 1070 | *
|
@@ -1192,7 +1157,6 @@ public void snapshot(final IndexCommit snapshotIndexCommit) {
|
1192 | 1157 | throw new IndexShardSnapshotFailedException(shardId, "failed to list blobs", e);
|
1193 | 1158 | }
|
1194 | 1159 |
|
1195 |
| - long generation = findLatestFileNameGeneration(blobs); |
1196 | 1160 | Tuple<BlobStoreIndexShardSnapshots, Integer> tuple = buildBlobStoreIndexShardSnapshots(blobs);
|
1197 | 1161 | BlobStoreIndexShardSnapshots snapshots = tuple.v1();
|
1198 | 1162 | int fileListGeneration = tuple.v2();
|
@@ -1260,7 +1224,7 @@ public void snapshot(final IndexCommit snapshotIndexCommit) {
|
1260 | 1224 | indexIncrementalSize += md.length();
|
1261 | 1225 | // create a new FileInfo
|
1262 | 1226 | BlobStoreIndexShardSnapshot.FileInfo snapshotFileInfo =
|
1263 |
| - new BlobStoreIndexShardSnapshot.FileInfo(fileNameFromGeneration(++generation), md, chunkSize()); |
| 1227 | + new BlobStoreIndexShardSnapshot.FileInfo(DATA_BLOB_PREFIX + UUIDs.randomBase64UUID(), md, chunkSize()); |
1264 | 1228 | indexCommitPointFiles.add(snapshotFileInfo);
|
1265 | 1229 | filesToSnapshot.add(snapshotFileInfo);
|
1266 | 1230 | } else {
|
|
0 commit comments