mirror of https://gitee.com/bigwinds/arangodb
This commit should fix cluster startup problems
This commit is contained in:
parent
17effdc065
commit
aacbb3e4cf
|
@ -33,7 +33,10 @@
|
||||||
#include "RestServer/DatabaseFeature.h"
|
#include "RestServer/DatabaseFeature.h"
|
||||||
#include "SimpleHttpClient/SimpleHttpClient.h"
|
#include "SimpleHttpClient/SimpleHttpClient.h"
|
||||||
#include "SimpleHttpClient/SimpleHttpResult.h"
|
#include "SimpleHttpClient/SimpleHttpResult.h"
|
||||||
|
#include "StorageEngine/EngineSelectorFeature.h"
|
||||||
|
#include "StorageEngine/StorageEngine.h"
|
||||||
#include "Utils/CollectionGuard.h"
|
#include "Utils/CollectionGuard.h"
|
||||||
|
#include "MMFiles/MMFilesCollection.h"
|
||||||
#include "MMFiles/MMFilesDatafileHelper.h"
|
#include "MMFiles/MMFilesDatafileHelper.h"
|
||||||
#include "MMFiles/MMFilesIndexElement.h"
|
#include "MMFiles/MMFilesIndexElement.h"
|
||||||
#include "MMFiles/MMFilesPrimaryIndex.h"
|
#include "MMFiles/MMFilesPrimaryIndex.h"
|
||||||
|
@ -1073,13 +1076,13 @@ int InitialSyncer::handleSyncKeys(arangodb::LogicalCollection* col,
|
||||||
// We do not take responsibility for the index.
|
// We do not take responsibility for the index.
|
||||||
// The LogicalCollection is protected by trx.
|
// The LogicalCollection is protected by trx.
|
||||||
// Neither it nor it's indexes can be invalidated
|
// Neither it nor it's indexes can be invalidated
|
||||||
auto idx = trx.documentCollection()->primaryIndex();
|
|
||||||
markers.reserve(idx->size());
|
markers.reserve(trx.documentCollection()->numberDocuments());
|
||||||
|
|
||||||
uint64_t iterations = 0;
|
uint64_t iterations = 0;
|
||||||
ManagedDocumentResult mmdr;
|
ManagedDocumentResult mmdr;
|
||||||
trx.invokeOnAllElements(trx.name(), [this, &trx, &mmdr, &markers, &iterations, &idx](DocumentIdentifierToken const& token) {
|
trx.invokeOnAllElements(trx.name(), [this, &trx, &mmdr, &markers, &iterations](DocumentIdentifierToken const& token) {
|
||||||
if (idx->collection()->readDocument(&trx, token, mmdr)) {
|
if (trx.documentCollection()->readDocument(&trx, token, mmdr)) {
|
||||||
markers.emplace_back(mmdr.vpack());
|
markers.emplace_back(mmdr.vpack());
|
||||||
|
|
||||||
if (++iterations % 10000 == 0) {
|
if (++iterations % 10000 == 0) {
|
||||||
|
@ -1286,7 +1289,11 @@ int InitialSyncer::handleSyncKeys(arangodb::LogicalCollection* col,
|
||||||
// We do not take responsibility for the index.
|
// We do not take responsibility for the index.
|
||||||
// The LogicalCollection is protected by trx.
|
// The LogicalCollection is protected by trx.
|
||||||
// Neither it nor it's indexes can be invalidated
|
// Neither it nor it's indexes can be invalidated
|
||||||
auto idx = trx.documentCollection()->primaryIndex();
|
|
||||||
|
// TODO Move to MMFiles
|
||||||
|
auto physical = static_cast<MMFilesCollection*>(
|
||||||
|
trx.documentCollection()->getPhysical());
|
||||||
|
auto idx = physical->primaryIndex();
|
||||||
|
|
||||||
size_t const currentChunkId = i;
|
size_t const currentChunkId = i;
|
||||||
progress = "processing keys chunk " + std::to_string(currentChunkId) +
|
progress = "processing keys chunk " + std::to_string(currentChunkId) +
|
||||||
|
@ -1886,16 +1893,6 @@ int InitialSyncer::handleCollection(VPackSlice const& parameters,
|
||||||
errorMsg = "could not create index: " +
|
errorMsg = "could not create index: " +
|
||||||
std::string(TRI_errno_string(res));
|
std::string(TRI_errno_string(res));
|
||||||
break;
|
break;
|
||||||
} else {
|
|
||||||
TRI_ASSERT(idx != nullptr);
|
|
||||||
|
|
||||||
res = physical->saveIndex(&trx, idx);
|
|
||||||
|
|
||||||
if (res != TRI_ERROR_NO_ERROR) {
|
|
||||||
errorMsg = "could not save index: " +
|
|
||||||
std::string(TRI_errno_string(res));
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -29,6 +29,8 @@
|
||||||
#include "SimpleHttpClient/GeneralClientConnection.h"
|
#include "SimpleHttpClient/GeneralClientConnection.h"
|
||||||
#include "SimpleHttpClient/SimpleHttpClient.h"
|
#include "SimpleHttpClient/SimpleHttpClient.h"
|
||||||
#include "SimpleHttpClient/SimpleHttpResult.h"
|
#include "SimpleHttpClient/SimpleHttpResult.h"
|
||||||
|
#include "StorageEngine/EngineSelectorFeature.h"
|
||||||
|
#include "StorageEngine/StorageEngine.h"
|
||||||
#include "StorageEngine/TransactionState.h"
|
#include "StorageEngine/TransactionState.h"
|
||||||
#include "Utils/CollectionGuard.h"
|
#include "Utils/CollectionGuard.h"
|
||||||
#include "Utils/OperationOptions.h"
|
#include "Utils/OperationOptions.h"
|
||||||
|
@ -565,11 +567,6 @@ int Syncer::createIndex(VPackSlice const& slice) {
|
||||||
TRI_ASSERT(physical != nullptr);
|
TRI_ASSERT(physical != nullptr);
|
||||||
std::shared_ptr<arangodb::Index> idx;
|
std::shared_ptr<arangodb::Index> idx;
|
||||||
res = physical->restoreIndex(&trx, indexSlice, idx);
|
res = physical->restoreIndex(&trx, indexSlice, idx);
|
||||||
|
|
||||||
if (res == TRI_ERROR_NO_ERROR) {
|
|
||||||
res = physical->saveIndex(&trx, idx);
|
|
||||||
}
|
|
||||||
|
|
||||||
res = trx.finish(res);
|
res = trx.finish(res);
|
||||||
|
|
||||||
return res;
|
return res;
|
||||||
|
|
|
@ -1779,17 +1779,8 @@ int RestReplicationHandler::processRestoreIndexes(VPackSlice const& collection,
|
||||||
errorMsg =
|
errorMsg =
|
||||||
"could not create index: " + std::string(TRI_errno_string(res));
|
"could not create index: " + std::string(TRI_errno_string(res));
|
||||||
break;
|
break;
|
||||||
} else {
|
|
||||||
TRI_ASSERT(idx != nullptr);
|
|
||||||
|
|
||||||
res = physical->saveIndex(&trx, idx);
|
|
||||||
|
|
||||||
if (res != TRI_ERROR_NO_ERROR) {
|
|
||||||
errorMsg =
|
|
||||||
"could not save index: " + std::string(TRI_errno_string(res));
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
TRI_ASSERT(idx != nullptr);
|
||||||
}
|
}
|
||||||
} catch (arangodb::basics::Exception const& ex) {
|
} catch (arangodb::basics::Exception const& ex) {
|
||||||
errorMsg =
|
errorMsg =
|
||||||
|
|
Loading…
Reference in New Issue