mirror of https://gitee.com/bigwinds/arangodb
Added index ID to WAL
This commit is contained in:
parent
97681ab32a
commit
018cf68e06
|
@ -317,12 +317,15 @@ std::shared_ptr<Index> RocksDBCollection::createIndex(
|
|||
{
|
||||
VPackBuilder builder = _logicalCollection->toVelocyPackIgnore(
|
||||
{"path", "statusString"}, true, /*forPersistence*/ false);
|
||||
|
||||
VPackBuilder indexInfo;
|
||||
idx->toVelocyPack(indexInfo, false, true);
|
||||
int res =
|
||||
static_cast<RocksDBEngine*>(engine)->writeCreateCollectionMarker(
|
||||
_logicalCollection->vocbase()->id(), _logicalCollection->cid(),
|
||||
builder.slice(),
|
||||
RocksDBLogValue::IndexCreate(_logicalCollection->vocbase()->id(),
|
||||
_logicalCollection->cid(), info));
|
||||
_logicalCollection->cid(), indexInfo.slice()));
|
||||
if (res != TRI_ERROR_NO_ERROR) {
|
||||
// We could not persist the index creation. Better abort
|
||||
// Remove the Index in the local list again.
|
||||
|
@ -395,6 +398,9 @@ int RocksDBCollection::restoreIndex(transaction::Methods* trx,
|
|||
{
|
||||
VPackBuilder builder = _logicalCollection->toVelocyPackIgnore(
|
||||
{"path", "statusString"}, true, /*forPersistence*/ false);
|
||||
VPackBuilder indexInfo;
|
||||
idx->toVelocyPack(indexInfo, false, true);
|
||||
|
||||
RocksDBEngine* engine =
|
||||
static_cast<RocksDBEngine*>(EngineSelectorFeature::ENGINE);
|
||||
TRI_ASSERT(engine != nullptr);
|
||||
|
@ -402,7 +408,7 @@ int RocksDBCollection::restoreIndex(transaction::Methods* trx,
|
|||
_logicalCollection->vocbase()->id(), _logicalCollection->cid(),
|
||||
builder.slice(),
|
||||
RocksDBLogValue::IndexCreate(_logicalCollection->vocbase()->id(),
|
||||
_logicalCollection->cid(), info));
|
||||
_logicalCollection->cid(), indexInfo.slice()));
|
||||
if (res != TRI_ERROR_NO_ERROR) {
|
||||
// We could not persist the index creation. Better abort
|
||||
// Remove the Index in the local list again.
|
||||
|
|
|
@ -204,11 +204,13 @@ class WALParser : public rocksdb::WriteBatch::Handler {
|
|||
}
|
||||
switch (RocksDBKey::type(key)) {
|
||||
case RocksDBEntryType::Collection: {
|
||||
if (_lastLogType == RocksDBLogType::IndexCreate ||
|
||||
_lastLogType == RocksDBLogType::IndexDrop) {
|
||||
return;
|
||||
}
|
||||
TRI_ASSERT(_lastLogType == RocksDBLogType::CollectionCreate ||
|
||||
_lastLogType == RocksDBLogType::CollectionChange ||
|
||||
_lastLogType == RocksDBLogType::CollectionRename ||
|
||||
_lastLogType == RocksDBLogType::IndexCreate ||
|
||||
_lastLogType == RocksDBLogType::IndexDrop);
|
||||
_lastLogType == RocksDBLogType::CollectionRename);
|
||||
TRI_ASSERT(_currentDbId != 0 && _currentCollectionId != 0);
|
||||
_builder.openObject();
|
||||
_builder.add("tick", VPackValue(std::to_string(_currentSequence)));
|
||||
|
|
Loading…
Reference in New Issue