|
31 | 31 | #include "Containers/FlatHashSet.h"
|
32 | 32 | #include "Futures/Utilities.h"
|
33 | 33 | #include "Logger/LogMacros.h"
|
| 34 | +#include "Logger/LogTopic.h" |
34 | 35 | #include "Network/Methods.h"
|
35 | 36 | #include "Network/NetworkFeature.h"
|
36 | 37 | #include "RestServer/VocbaseContext.h"
|
@@ -217,24 +218,39 @@ RestStatus RestIndexHandler::getIndexes() {
|
217 | 218 |
|
218 | 219 | // first fetch list of planned indexes. this includes all indexes,
|
219 | 220 | // even the in-progress indexes
|
220 |
| - std::string ap = absl::StrCat("Plan/Collections/", _vocbase.name(), "/", |
221 |
| - coll->planId().id(), "/indexes"); |
| 221 | + std::string const ap = absl::StrCat("Plan/Collections/", _vocbase.name(), |
| 222 | + "/", coll->planId().id(), "/indexes"); |
222 | 223 | auto& ac = _vocbase.server().getFeature<ClusterFeature>().agencyCache();
|
223 | 224 | // we need to wait for the latest commit index here, because otherwise
|
224 | 225 | // we may not see all indexes that were declared ready by the
|
225 | 226 | // supervision.
|
226 | 227 | ac.waitForLatestCommitIndex().get();
|
227 | 228 |
|
228 |
| - auto [plannedIndexes, idx] = ac.get(ap); |
| 229 | + auto [plannedIndexes, idx1] = ac.get(ap); |
| 230 | + auto [planVersion, idx2] = ac.get("Plan/Version"); |
229 | 231 |
|
230 |
| - // Let's wait until the ClusterInfo has processed at least this |
231 |
| - // Raft index. This means that if an index is no longer `isBuilding` |
232 |
| - // in the agency Plan, then ClusterInfo should know it. |
233 |
| - _vocbase.server() |
234 |
| - .getFeature<ClusterFeature>() |
235 |
| - .clusterInfo() |
236 |
| - .waitForPlan(idx) |
237 |
| - .wait(); |
| 232 | + uint64_t planVersionInt = 0; |
| 233 | + try { |
| 234 | + if (planVersion->slice().isNumber()) { |
| 235 | + planVersionInt = planVersion->slice().getNumber<uint64_t>(); |
| 236 | + } |
| 237 | + } catch (std::exception const&) { |
| 238 | + } |
| 239 | + |
| 240 | + if (planVersionInt > 0) { |
| 241 | + // Let's wait until the ClusterInfo has processed at least this |
| 242 | + // Raft index. This means that if an index is no longer `isBuilding` |
| 243 | + // in the agency Plan, then ClusterInfo should know it. |
| 244 | + _vocbase.server() |
| 245 | + .getFeature<ClusterFeature>() |
| 246 | + .clusterInfo() |
| 247 | + .waitForPlanVersion(planVersionInt) |
| 248 | + .wait(); |
| 249 | + } else { |
| 250 | + LOG_TOPIC("12536", WARN, Logger::CLUSTER) |
| 251 | + << "Expected numberin /arango/Plan/Version, instead found: " |
| 252 | + << planVersion->slice().toJson(); |
| 253 | + } |
238 | 254 |
|
239 | 255 | // now fetch list of ready indexes
|
240 | 256 | VPackBuilder indexes;
|
|
0 commit comments