@@ -863,7 +863,7 @@ StorageProperties MagmaKVStore::getStorageProperties() const {
863
863
StorageProperties::AutomaticDeduplication::No,
864
864
StorageProperties::PrepareCounting::No,
865
865
StorageProperties::CompactionStaleItemCallbacks::Yes,
866
- StorageProperties::HistoryRetentionAvailable::No );
866
+ StorageProperties::HistoryRetentionAvailable::Yes );
867
867
return rv;
868
868
}
869
869
@@ -1683,8 +1683,7 @@ std::unique_ptr<BySeqnoScanContext> MagmaKVStore::initBySeqnoScanContext(
1683
1683
getDroppedStatus.String ());
1684
1684
}
1685
1685
1686
- // @todo:assign this using magma->GetOldestHistorySeqno(snapshot);
1687
- auto historyStartSeqno = 0 ;
1686
+ auto historyStartSeqno = magma->GetOldestHistorySeqno (snapshot);
1688
1687
if (logger->should_log (spdlog::level::info)) {
1689
1688
logger->info (
1690
1689
" MagmaKVStore::initBySeqnoScanContext {} seqno:{} endSeqno:{}"
@@ -1797,8 +1796,7 @@ std::unique_ptr<ByIdScanContext> MagmaKVStore::initByIdScanContext(
1797
1796
return nullptr ;
1798
1797
}
1799
1798
1800
- // @todo:assign this using magma->GetOldestHistorySeqno(snapshot);
1801
- auto historyStartSeqno = 0 ;
1799
+ auto historyStartSeqno = magma->GetOldestHistorySeqno (snapshot);
1802
1800
logger->info (
1803
1801
" MagmaKVStore::initByIdScanContext {} historyStartSeqno:{} "
1804
1802
" KeyIterator:{}" ,
@@ -1818,13 +1816,16 @@ std::unique_ptr<ByIdScanContext> MagmaKVStore::initByIdScanContext(
1818
1816
historyStartSeqno);
1819
1817
}
1820
1818
1819
+ scan_error_t MagmaKVStore::scan (BySeqnoScanContext& ctx) const {
1820
+ return scan (ctx, magma::Magma::SeqIterator::Mode::Snapshot);
1821
+ }
1822
+
1821
1823
scan_error_t MagmaKVStore::scanAllVersions (BySeqnoScanContext& ctx) const {
1822
- // @todo use magma's mode
1823
- // return scan(ctx, magma::Magma::SeqIterator::Mode::History);
1824
- return scan (ctx);
1824
+ return scan (ctx, magma::Magma::SeqIterator::Mode::History);
1825
1825
}
1826
1826
1827
- scan_error_t MagmaKVStore::scan (BySeqnoScanContext& ctx) const {
1827
+ scan_error_t MagmaKVStore::scan (BySeqnoScanContext& ctx,
1828
+ magma::Magma::SeqIterator::Mode mode) const {
1828
1829
if (ctx.lastReadSeqno == ctx.maxSeqno ) {
1829
1830
logger->TRACE (" MagmaKVStore::scan {} lastReadSeqno:{} == maxSeqno:{}" ,
1830
1831
ctx.vbid ,
@@ -1837,7 +1838,8 @@ scan_error_t MagmaKVStore::scan(BySeqnoScanContext& ctx) const {
1837
1838
startSeqno = ctx.lastReadSeqno + 1 ;
1838
1839
}
1839
1840
auto & mctx = dynamic_cast <MagmaScanContext&>(ctx);
1840
- for (mctx.itr ->Seek (startSeqno, ctx.maxSeqno ); mctx.itr ->Valid ();
1841
+ for (mctx.itr ->Initialize (startSeqno, ctx.maxSeqno , mode);
1842
+ mctx.itr ->Valid ();
1841
1843
mctx.itr ->Next ()) {
1842
1844
Slice keySlice, metaSlice, valSlice;
1843
1845
uint64_t seqno;
@@ -3710,3 +3712,7 @@ std::pair<Status, uint64_t> MagmaKVStore::getOldestRollbackableHighSeqno(
3710
3712
3711
3713
return {status, seqno};
3712
3714
}
3715
+
3716
+ void MagmaKVStore::setHistoryRetentionBytes (size_t size) {
3717
+ magma->SetHistoryRetentionSize (size);
3718
+ }
0 commit comments