Skip to content

Commit

Permalink
MB-54729: Add CDC Magma API to MagmaMemoryTrackingProxy
Browse files Browse the repository at this point in the history
Make new magma API available for use in MagmaKVStore

Change-Id: Idf2bf082c3ecb78b93e393c1d6b796b598e3b80b
  • Loading branch information
jimwwalker committed Jan 23, 2023
1 parent 8d301c5 commit 087b981
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 0 deletions.
1 change: 1 addition & 0 deletions engines/ep/src/kvstore/magma-kvstore/magma-kvstore.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2894,6 +2894,7 @@ RollbackResult MagmaKVStore::rollback(Vbid vbid,
case Status::NotFound:
case Status::Cancelled:
case Status::RetryCompaction:
case Status::RangeNotFound:
logger->critical("MagmaKVStore::rollback Rollback {} status:{}",
vbid,
status.String());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,14 @@ DomainAwareSeqIterator::~DomainAwareSeqIterator() {
itr.reset();
}

magma::Status DomainAwareSeqIterator::Initialize(
const magma::Magma::SeqNo startSeqno,
const magma::Magma::SeqNo endSeqno,
Mode mode) {
cb::UseArenaMallocSecondaryDomain domainGuard;
return itr->Initialize(startSeqno, endSeqno, mode);
}

magma::Status DomainAwareSeqIterator::GetStatus() {
cb::UseArenaMallocSecondaryDomain domainGuard;
return itr->GetStatus();
Expand Down Expand Up @@ -447,6 +455,17 @@ void MagmaMemoryTrackingProxy::SetNumThreads(
magma->SetNumThreads(threadType, nThreads);
}

void MagmaMemoryTrackingProxy::SetHistoryRetentionSize(size_t historyBytes) {
cb::UseArenaMallocSecondaryDomain domainGuard;
magma->SetHistoryRetentionSize(historyBytes);
}

void MagmaMemoryTrackingProxy::SetHistoryRetentionTime(
uint64_t historySeconds) {
cb::UseArenaMallocSecondaryDomain domainGuard;
magma->SetHistoryRetentionTime(historySeconds);
}

magma::Status MagmaMemoryTrackingProxy::Sync(bool flushAll) {
cb::UseArenaMallocSecondaryDomain domainGuard;
return magma->Sync(flushAll);
Expand Down Expand Up @@ -513,3 +532,15 @@ magma::Status MagmaMemoryTrackingProxy::ResumeBGCompaction(
cb::UseArenaMallocSecondaryDomain domainGuard;
return magma->ResumeBGCompaction(kvID);
}

magma::Magma::SeqNo MagmaMemoryTrackingProxy::GetOldestHistorySeqno(
magma::Magma::KVStoreID kvid) {
cb::UseArenaMallocSecondaryDomain domainGuard;
return magma->GetOldestHistorySeqno(kvid);
}

magma::Magma::SeqNo MagmaMemoryTrackingProxy::GetOldestHistorySeqno(
magma::Magma::Snapshot& snapshot) {
cb::UseArenaMallocSecondaryDomain domainGuard;
return magma->GetOldestHistorySeqno(snapshot);
}
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,9 @@ class DomainAwareSeqIterator : public magma::Magma::SeqIterator {
: itr(std::move(itr)) {
}
~DomainAwareSeqIterator() override;
magma::Status Initialize(const magma::Magma::SeqNo startSeqno,
const magma::Magma::SeqNo endSeqno,
Mode mode) override;
void Seek(const magma::Magma::SeqNo startSeqno,
const magma::Magma::SeqNo endSeqno) override;
bool Valid() override;
Expand Down Expand Up @@ -205,6 +208,9 @@ class MagmaMemoryTrackingProxy {
void EnableBlockCache(bool enable);
void SetMemoryQuota(const size_t quota);
void SetNumThreads(magma::Magma::ThreadType threadType, size_t nThreads);
void SetHistoryRetentionSize(size_t historyBytes);
void SetHistoryRetentionTime(uint64_t historySeconds);

magma::Status Sync(bool flushAll);
magma::Status SyncKVStore(const magma::Magma::KVStoreID kvID);

Expand All @@ -221,6 +227,9 @@ class MagmaMemoryTrackingProxy {
magma::Status StopBGCompaction(const magma::Magma::KVStoreID kvID);
magma::Status ResumeBGCompaction(const magma::Magma::KVStoreID kvID);

magma::Magma::SeqNo GetOldestHistorySeqno(magma::Magma::KVStoreID kvid);
magma::Magma::SeqNo GetOldestHistorySeqno(magma::Magma::Snapshot& snapshot);

private:
std::unique_ptr<magma::Magma> magma;
};

0 comments on commit 087b981

Please sign in to comment.