mirror of https://gitee.com/bigwinds/arangodb
do not call SyncWAL() on Windows, as it does not work
This commit is contained in:
parent
6a30df3363
commit
8c2be23d73
|
@ -974,15 +974,22 @@ std::pair<TRI_voc_tick_t, TRI_voc_cid_t> RocksDBEngine::mapObjectToCollection(
|
||||||
return it->second;
|
return it->second;
|
||||||
}
|
}
|
||||||
|
|
||||||
Result RocksDBEngine::createLoggerState(TRI_vocbase_t* vocbase,
|
bool RocksDBEngine::syncWal() {
|
||||||
VPackBuilder& builder) {
|
#ifdef _WIN32
|
||||||
Result res;
|
// SyncWAL always reports "not implemented" on Windows
|
||||||
|
return true;
|
||||||
|
#else
|
||||||
rocksdb::Status status = _db->GetBaseDB()->SyncWAL();
|
rocksdb::Status status = _db->GetBaseDB()->SyncWAL();
|
||||||
if (!status.ok()) {
|
if (!status.ok()) {
|
||||||
res = rocksutils::convertStatus(status).errorNumber();
|
return false;
|
||||||
return res;
|
|
||||||
}
|
}
|
||||||
|
return true;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
Result RocksDBEngine::createLoggerState(TRI_vocbase_t* vocbase,
|
||||||
|
VPackBuilder& builder) {
|
||||||
|
syncWal();
|
||||||
|
|
||||||
builder.add(VPackValue(VPackValueType::Object)); // Base
|
builder.add(VPackValue(VPackValueType::Object)); // Base
|
||||||
rocksdb::SequenceNumber lastTick = _db->GetLatestSequenceNumber();
|
rocksdb::SequenceNumber lastTick = _db->GetLatestSequenceNumber();
|
||||||
|
@ -1026,7 +1033,7 @@ Result RocksDBEngine::createLoggerState(TRI_vocbase_t* vocbase,
|
||||||
|
|
||||||
builder.close(); // base
|
builder.close(); // base
|
||||||
|
|
||||||
return res;
|
return Result();
|
||||||
}
|
}
|
||||||
|
|
||||||
void RocksDBEngine::determinePrunableWalFiles(TRI_voc_tick_t minTickToKeep) {
|
void RocksDBEngine::determinePrunableWalFiles(TRI_voc_tick_t minTickToKeep) {
|
||||||
|
|
|
@ -278,6 +278,7 @@ class RocksDBEngine final : public StorageEngine {
|
||||||
static std::string const FeatureName;
|
static std::string const FeatureName;
|
||||||
RocksDBCounterManager* counterManager() const;
|
RocksDBCounterManager* counterManager() const;
|
||||||
RocksDBReplicationManager* replicationManager() const;
|
RocksDBReplicationManager* replicationManager() const;
|
||||||
|
bool syncWal();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
/// single rocksdb database used in this storage engine
|
/// single rocksdb database used in this storage engine
|
||||||
|
|
|
@ -229,15 +229,7 @@ void RocksDBRestExportHandler::createCursor() {
|
||||||
options, "flush", false);
|
options, "flush", false);
|
||||||
|
|
||||||
if (flush) {
|
if (flush) {
|
||||||
rocksdb::TransactionDB* db =
|
static_cast<RocksDBEngine*>(EngineSelectorFeature::ENGINE)->syncWal();
|
||||||
static_cast<RocksDBEngine*>(EngineSelectorFeature::ENGINE)->db();
|
|
||||||
|
|
||||||
rocksdb::Status status = db->GetBaseDB()->SyncWAL();
|
|
||||||
|
|
||||||
if (!status.ok()) {
|
|
||||||
Result res = rocksutils::convertStatus(status);
|
|
||||||
THROW_ARANGO_EXCEPTION(res.errorNumber());
|
|
||||||
}
|
|
||||||
|
|
||||||
double flushWait =
|
double flushWait =
|
||||||
arangodb::basics::VelocyPackHelper::getNumericValue<double>(
|
arangodb::basics::VelocyPackHelper::getNumericValue<double>(
|
||||||
|
|
|
@ -1640,17 +1640,7 @@ void RocksDBRestReplicationHandler::handleCommandSync() {
|
||||||
config._useCollectionId = useCollectionId;
|
config._useCollectionId = useCollectionId;
|
||||||
|
|
||||||
// wait until all data in current logfile got synced
|
// wait until all data in current logfile got synced
|
||||||
// MMFilesLogfileManager::instance()->waitForSync(5.0);
|
static_cast<RocksDBEngine*>(EngineSelectorFeature::ENGINE)->syncWal();
|
||||||
rocksdb::TransactionDB* db =
|
|
||||||
static_cast<RocksDBEngine*>(EngineSelectorFeature::ENGINE)->db();
|
|
||||||
|
|
||||||
rocksdb::Status status = db->GetBaseDB()->SyncWAL();
|
|
||||||
if (!status.ok()) {
|
|
||||||
Result res = rocksutils::convertStatus(status).errorNumber();
|
|
||||||
generateError(rest::ResponseCode::BAD, res.errorNumber(),
|
|
||||||
res.errorMessage());
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
InitialSyncer syncer(_vocbase, &config, restrictCollections, restrictType,
|
InitialSyncer syncer(_vocbase, &config, restrictCollections, restrictType,
|
||||||
verbose);
|
verbose);
|
||||||
|
|
|
@ -140,20 +140,8 @@ void RocksDBRestWalHandler::flush() {
|
||||||
if (ServerState::instance()->isCoordinator()) {
|
if (ServerState::instance()->isCoordinator()) {
|
||||||
res = flushWalOnAllDBServers(waitForSync, waitForCollector);
|
res = flushWalOnAllDBServers(waitForSync, waitForCollector);
|
||||||
} else {
|
} else {
|
||||||
rocksdb::TransactionDB* db =
|
|
||||||
static_cast<RocksDBEngine*>(EngineSelectorFeature::ENGINE)->db();
|
|
||||||
|
|
||||||
if (waitForSync) {
|
if (waitForSync) {
|
||||||
rocksdb::Status status = db->GetBaseDB()->SyncWAL();
|
static_cast<RocksDBEngine*>(EngineSelectorFeature::ENGINE)->syncWal();
|
||||||
if (!status.ok()) {
|
|
||||||
res = rocksutils::convertStatus(status).errorNumber();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (waitForCollector) {
|
|
||||||
// does not make sense in rocksdb
|
|
||||||
/*rocksdb::FlushOptions flushOptions;
|
|
||||||
flushOptions.wait = true;
|
|
||||||
db->Flush(flushOptions);*/
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -46,15 +46,7 @@ static void JS_FlushWal(v8::FunctionCallbackInfo<v8::Value> const& args) {
|
||||||
TRI_V8_TRY_CATCH_BEGIN(isolate);
|
TRI_V8_TRY_CATCH_BEGIN(isolate);
|
||||||
v8::HandleScope scope(isolate);
|
v8::HandleScope scope(isolate);
|
||||||
|
|
||||||
rocksdb::TransactionDB* db =
|
static_cast<RocksDBEngine*>(EngineSelectorFeature::ENGINE)->syncWal();
|
||||||
static_cast<RocksDBEngine*>(EngineSelectorFeature::ENGINE)->db();
|
|
||||||
|
|
||||||
rocksdb::Status status = db->GetBaseDB()->SyncWAL();
|
|
||||||
|
|
||||||
if (!status.ok()) {
|
|
||||||
Result res = rocksutils::convertStatus(status);
|
|
||||||
TRI_V8_THROW_EXCEPTION(res.errorNumber());
|
|
||||||
}
|
|
||||||
|
|
||||||
TRI_V8_RETURN_TRUE();
|
TRI_V8_RETURN_TRUE();
|
||||||
TRI_V8_TRY_CATCH_END
|
TRI_V8_TRY_CATCH_END
|
||||||
|
|
Loading…
Reference in New Issue