8000 increase timeout for index creation (#4915) · Sandychuang/arangodb@cd219bd · GitHub
[go: up one dir, main page]

Skip to content

Commit cd219bd

Browse files
authored
increase timeout for index creation (arangodb#4915)
1 parent b8ca34c commit cd219bd

File tree

4 files changed

+15
-4
lines changed

4 files changed

+15
-4
lines changed

arangod/Cluster/ClusterFeature.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,10 @@ void ClusterFeature::collectOptions(std::shared_ptr<ProgramOptions> options) {
133133
options->addHiddenOption("--cluster.create-waits-for-sync-replication",
134134
"active coordinator will wait for all replicas to create collection",
135135
new BooleanParameter(&_createWaitsForSyncReplication));
136+
137+
options->addHiddenOption("--cluster.index-create-timeout",
138+
"amount of time (in seconds) the coordinator will wait for an index to be created before giving up",
139+
new DoubleParameter(&_indexCreationTimeout));
136140
}
137141

138142
void ClusterFeature::validateOptions(std::shared_ptr<ProgramOptions> options) {

arangod/Cluster/ClusterFeature.h

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ class ClusterFeature : public application_features::ApplicationFeature {
5050
return _agencyEndpoints;
5151
}
5252

53-
std::string agencyPrefix() {
53+
std::string agencyPrefix() const {
5454
return _agencyPrefix;
5555
}
5656

@@ -61,6 +61,7 @@ class ClusterFeature : public application_features::ApplicationFeature {
6161
std::string _myAddress;
6262
uint32_t _systemReplicationFactor = 2;
6363
bool _createWaitsForSyncReplication = true;
64+
double _indexCreationTimeout = 3600.0;
6465

6566
private:
6667
void reportRole(ServerState::RoleEnum);
@@ -79,7 +80,8 @@ class ClusterFeature : public application_features::ApplicationFeature {
7980
};
8081

8182
void setUnregisterOnShutdown(bool);
82-
bool createWaitsForSyncReplication() { return _createWaitsForSyncReplication; };
83+
bool createWaitsForSyncReplication() const { return _createWaitsForSyncReplication; };
84+
double indexCreationTimeout() const { return _indexCreationTimeout; }
8385
uint32_t systemReplicationFactor() { return _systemReplicationFactor; };
8486

8587
void stop() override final;

arangod/RestHandler/RestReplicationHandler.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1651,6 +1651,8 @@ int RestReplicationHandler::processRestoreIndexesCoordinator(
16511651
return TRI_ERROR_ARANGO_COLLECTION_NOT_FOUND;
16521652
}
16531653
TRI_ASSERT(col != nullptr);
1654+
1655+
auto cluster = application_features::ApplicationServer::getFeature<ClusterFeature>("Cluster");
16541656

16551657
int res = TRI_ERROR_NO_ERROR;
16561658
for (VPackSlice const& idxDef : VPackArrayIterator(indexes)) {
@@ -1671,7 +1673,7 @@ int RestReplicationHandler::processRestoreIndexesCoordinator(
16711673
arangodb::Index::Compare,
16721674
tmp,
16731675
errorMsg,
1674-
3600.0
1676+
cluster->indexCreationTimeout()
16751677
);
16761678

16771679
if (res != TRI_ERROR_NO_ERROR) {

arangod/VocBase/Methods/Indexes.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
#include "Basics/VelocyPackHelper.h"
2929
#include "Basics/conversions.h"
3030
#include "Basics/tri-strings.h"
31+
#include "Cluster/ClusterFeature.h"
3132
#include "Cluster/ClusterInfo.h"
3233
#include "Cluster/ClusterMethods.h"
3334
#include "Cluster/ServerState.h"
@@ -309,9 +310,11 @@ Result Indexes::ensureIndexCoordinator(
309310
auto& dbName = collection->vocbase()->name();
310311
auto cid = std::to_string(collection->id());
311312
std::string errorMsg;
313+
314+
auto cluster = application_features::ApplicationServer::getFeature<ClusterFeature>("Cluster");
312315
int res = ClusterInfo::instance()->ensureIndexCoordinator(
313316
dbName, cid, indexDef, create, &arangodb::Index::Compare, resultBuilder,
314-
errorMsg, 360.0);
317+
errorMsg, cluster->indexCreationTimeout());
315318
return Result(res, errorMsg);
316319
}
317320

0 commit comments

Comments
 (0)
0