|
26 | 26 | #include "Aql/Query.h"
|
27 | 27 | #include "Aql/QueryRegistry.h"
|
28 | 28 | #include "Basics/ConditionLocker.h"
|
| 29 | +#include "Basics/NumberUtils.h" |
29 | 30 | #include "Basics/ReadLocker.h"
|
30 | 31 | #include "Basics/Result.h"
|
31 | 32 | #include "Basics/RocksDBUtils.h"
|
@@ -958,7 +959,6 @@ void RestReplicationHandler::handleCommandRestoreCollection() {
|
958 | 959 |
|
959 | 960 | bool overwrite = _request->parsedValue<bool>("overwrite", false);
|
960 | 961 | bool force = _request->parsedValue<bool>("force", false);
|
961 |
| - ; |
962 | 962 | bool ignoreDistributeShardsLikeErrors =
|
963 | 963 | _request->parsedValue<bool>("ignoreDistributeShardsLikeErrors", false);
|
964 | 964 | uint64_t numberOfShards = _request->parsedValue<uint64_t>("numberOfShards", 0);
|
@@ -1279,6 +1279,19 @@ Result RestReplicationHandler::processRestoreCollectionCoordinator(
|
1279 | 1279 | TRI_ASSERT(numberOfShards > 0);
|
1280 | 1280 | toMerge.add(StaticStrings::NumberOfShards, VPackValue(numberOfShards));
|
1281 | 1281 | }
|
| 1282 | + |
| 1283 | + if (parameters.get(StaticStrings::DataSourceGuid).isString()) { |
| 1284 | + std::string const uuid = parameters.get(StaticStrings::DataSourceGuid).copyString(); |
| 1285 | + bool valid = false; |
| 1286 | + NumberUtils::atoi_positive<uint64_t>(uuid.data(), uuid.data() + uuid.size(), valid); |
| 1287 | + if (valid) { |
| 1288 | + // globallyUniqueId is only numeric. This causes ambiguities later |
| 1289 | + // and can only happen for collections created with v3.3.0 (the GUID |
| 1290 | + // generation process was changed in v3.3.1 already to fix this issue). |
| 1291 | + // remove the globallyUniqueId so a new one will be generated server.side |
| 1292 | + toMerge.add(StaticStrings::DataSourceGuid, VPackSlice::nullSlice()); |
| 1293 | + } |
| 1294 | + } |
1282 | 1295 |
|
1283 | 1296 | // Replication Factor. Will be overwritten if not existent
|
1284 | 1297 | VPackSlice const replFactorSlice = parameters.get(StaticStrings::ReplicationFactor);
|
@@ -2856,11 +2869,22 @@ int RestReplicationHandler::createCollection(VPackSlice slice,
|
2856 | 2869 | // because the collection is effectively NEW
|
2857 | 2870 | VPackBuilder patch;
|
2858 | 2871 | patch.openObject();
|
2859 |
| - patch.add("version", VPackValue(LogicalCollection::VERSION_31)); |
| 2872 | + patch.add("version", VPackValue(static_cast<int>(LogicalCollection::currentVersion()))); |
2860 | 2873 | if (!name.empty() && name[0] == '_' && !slice.hasKey("isSystem")) {
|
2861 | 2874 | // system collection?
|
2862 | 2875 | patch.add("isSystem", VPackValue(true));
|
2863 | 2876 | }
|
| 2877 | + if (!uuid.empty()) { |
| 2878 | + bool valid = false; |
| 2879 | + NumberUtils::atoi_positive<uint64_t>(uuid.data(), uuid.data() + uuid.size(), valid); |
| 2880 | + if (valid) { |
| 2881 | + // globallyUniqueId is only numeric. This causes ambiguities later |
| 2882 | + // and can only happen for collections created with v3.3.0 (the GUID |
| 2883 | + // generation process was changed in v3.3.1 already to fix this issue). |
| 2884 | + // remove the globallyUniqueId so a new one will be generated server.side |
| 2885 | + patch.add(StaticStrings::DataSourceGuid, VPackSlice::nullSlice()); |
| 2886 | + } |
| 2887 | + } |
2864 | 2888 | patch.add("objectId", VPackSlice::nullSlice());
|
2865 | 2889 | patch.add("cid", VPackSlice::nullSlice());
|
2866 | 2890 | patch.add("id", VPackSlice::nullSlice());
|
|
0 commit comments