Skip to content

Commit

Permalink
corrected implementation that compiles and works with stardog
Browse files Browse the repository at this point in the history
  • Loading branch information
matthewvon committed Jan 23, 2025
1 parent d461c0b commit 04aae03
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
10 changes: 8 additions & 2 deletions db/db_impl/db_impl_compaction_flush.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1704,15 +1704,13 @@ Status DBImpl::Flush(const FlushOptions& flush_options,
ROCKS_LOG_INFO(immutable_db_options_.info_log, "[%s] Manual flush start.",
cfh->GetName().c_str());
Status s;
cfh->imm.BeginManualOperation();
if (immutable_db_options_.atomic_flush) {
s = AtomicFlushMemTables({cfh->cfd()}, flush_options,
FlushReason::kManualFlush);
} else {
s = FlushMemTable(cfh->cfd(), flush_options, FlushReason::kManualFlush);
}

cfh->imm.CompleteManualOperation();
ROCKS_LOG_INFO(immutable_db_options_.info_log,
"[%s] Manual flush finished, status: %s\n",
cfh->GetName().c_str(), s.ToString().c_str());
Expand Down Expand Up @@ -1991,6 +1989,10 @@ Status DBImpl::FlushMemTable(ColumnFamilyData* cfd,
}
}

if (flush_reason == FlushReason::kManualCompaction
|| flush_reason == FlushReason::kManualFlush) {
cfd->imm()->BeginManualOperation();
} // if
autovector<FlushRequest> flush_reqs;
autovector<uint64_t> memtable_ids_to_wait;
{
Expand Down Expand Up @@ -2109,6 +2111,10 @@ Status DBImpl::FlushMemTable(ColumnFamilyData* cfd,
tmp_cfd->UnrefAndTryDelete();
}
}
if (flush_reason == FlushReason::kManualCompaction
|| flush_reason == FlushReason::kManualFlush) {
cfd->imm()->CompleteManualOperation();
} // if
TEST_SYNC_POINT("DBImpl::FlushMemTable:FlushMemTableFinished");
return s;
}
Expand Down
6 changes: 3 additions & 3 deletions db/memtable_list.h
Original file line number Diff line number Diff line change
Expand Up @@ -391,11 +391,11 @@ class MemTableList {
void RemoveOldMemTables(uint64_t log_number,
autovector<MemTable*>* to_delete);

void BeginManualOperation() {++active_manuals_};
void BeginManualOperation() {++active_manuals_;};

void CompleteManualOperation() {
assert(active_manuals >= 1);
--active_manuals_};
assert(active_manuals_ >= 1);
--active_manuals_;};

private:
friend Status InstallMemtableAtomicFlushResults(
Expand Down

0 comments on commit 04aae03

Please sign in to comment.