1
0
Fork 0

finalize insert()

This commit is contained in:
jsteemann 2017-03-27 11:30:30 +02:00
parent 9276d82578
commit 0d38d2c287
4 changed files with 20 additions and 11 deletions

View File

@ -34,6 +34,7 @@
#include "RocksDBEngine/RocksDBPrimaryMockIndex.h"
#include "StorageEngine/EngineSelectorFeature.h"
#include "StorageEngine/StorageEngine.h"
#include "StorageEngine/TransactionState.h"
#include "Transaction/Helpers.h"
#include "Utils/OperationOptions.h"
#include "VocBase/LogicalCollection.h"
@ -389,7 +390,8 @@ int RocksDBCollection::insert(arangodb::transaction::Methods* trx,
// }
// store the tick that was used for writing the document
// resultMarkerTick = operation.tick();
// note that we don't need it for this engine
resultMarkerTick = 0;
}
return res;
}
@ -571,11 +573,25 @@ int RocksDBCollection::insertDocument(arangodb::transaction::Methods* trx,
}
}
// TODO: handle waitForSync here?
if (result != TRI_ERROR_NO_ERROR) {
if (result != TRI_ERROR_NO_ERROR) {
rocksdb::WriteOptions writeOptions;
if (_logicalCollection->waitForSync()) {
waitForSync = true;
}
if (waitForSync) {
trx->state()->waitForSync(true);
// handle waitForSync for single operations here
if (trx->state()->isSingleOperation()) {
writeOptions.sync = true;
}
}
StorageEngine* engine = EngineSelectorFeature::ENGINE;
rocksdb::TransactionDB* db = static_cast<RocksDBEngine*>(engine)->db();
db->Write(rocksdb::WriteOptions(), &writeBatch);
db->Write(writeOptions, &writeBatch);
}
return result;

View File

@ -38,7 +38,6 @@ RocksDBTransactionCollection::RocksDBTransactionCollection(TransactionState* trx
TRI_voc_cid_t cid,
AccessMode::Type accessType)
: TransactionCollection(trx, cid),
_waitForSync(false),
_accessType(accessType),
_numOperations(0) {}
@ -137,9 +136,6 @@ int RocksDBTransactionCollection::use(int nestingLevel) {
!LogicalCollection::IsSystemName(_collection->name())) {
return TRI_ERROR_ARANGO_READ_ONLY;
}
// store the waitForSync property
_waitForSync = _collection->waitForSync();
}
return TRI_ERROR_NO_ERROR;

View File

@ -70,8 +70,6 @@ class RocksDBTransactionCollection final : public TransactionCollection {
void release() override;
private:
bool _waitForSync; // whether or not the collection has waitForSync
AccessMode::Type _accessType; // access type (read|write)
uint64_t _numOperations;
};

View File

@ -2578,7 +2578,6 @@ arangodb::LogicalCollection* transaction::Methods::documentCollection(
TRI_ASSERT(trxCollection != nullptr);
TRI_ASSERT(_state->status() == transaction::Status::RUNNING);
LOG_TOPIC(ERR, Logger::FIXME) << "accessing collection " << trxCollection->id() << ": " << trxCollection;
TRI_ASSERT(trxCollection->collection() != nullptr);
return trxCollection->collection();