@@ -869,7 +869,7 @@ StorageProperties MagmaKVStore::getStorageProperties() const {
869
869
StorageProperties::AutomaticDeduplication::No,
870
870
StorageProperties::PrepareCounting::No,
871
871
StorageProperties::CompactionStaleItemCallbacks::Yes,
872
- StorageProperties::HistoryRetentionAvailable::No );
872
+ StorageProperties::HistoryRetentionAvailable::Yes );
873
873
return rv;
874
874
}
875
875
@@ -1695,8 +1695,7 @@ std::unique_ptr<BySeqnoScanContext> MagmaKVStore::initBySeqnoScanContext(
1695
1695
getDroppedStatus.String ());
1696
1696
}
1697
1697
1698
- // @todo:assign this using magma->GetOldestHistorySeqno(snapshot);
1699
- auto historyStartSeqno = 0 ;
1698
+ auto historyStartSeqno = magma->GetOldestHistorySeqno (snapshot);
1700
1699
if (logger->should_log (spdlog::level::info)) {
1701
1700
logger->info (
1702
1701
" MagmaKVStore::initBySeqnoScanContext {} seqno:{} endSeqno:{}"
@@ -1809,8 +1808,7 @@ std::unique_ptr<ByIdScanContext> MagmaKVStore::initByIdScanContext(
1809
1808
return nullptr ;
1810
1809
}
1811
1810
1812
- // @todo:assign this using magma->GetOldestHistorySeqno(snapshot);
1813
- auto historyStartSeqno = 0 ;
1811
+ auto historyStartSeqno = magma->GetOldestHistorySeqno (snapshot);
1814
1812
logger->info (
1815
1813
" MagmaKVStore::initByIdScanContext {} historyStartSeqno:{} "
1816
1814
" KeyIterator:{}" ,
@@ -1830,13 +1828,16 @@ std::unique_ptr<ByIdScanContext> MagmaKVStore::initByIdScanContext(
1830
1828
historyStartSeqno);
1831
1829
}
1832
1830
1831
+ scan_error_t MagmaKVStore::scan (BySeqnoScanContext& ctx) const {
1832
+ return scan (ctx, magma::Magma::SeqIterator::Mode::Snapshot);
1833
+ }
1834
+
1833
1835
scan_error_t MagmaKVStore::scanAllVersions (BySeqnoScanContext& ctx) const {
1834
- // @todo use magma's mode
1835
- // return scan(ctx, magma::Magma::SeqIterator::Mode::History);
1836
- return scan (ctx);
1836
+ return scan (ctx, magma::Magma::SeqIterator::Mode::History);
1837
1837
}
1838
1838
1839
- scan_error_t MagmaKVStore::scan (BySeqnoScanContext& ctx) const {
1839
+ scan_error_t MagmaKVStore::scan (BySeqnoScanContext& ctx,
1840
+ magma::Magma::SeqIterator::Mode mode) const {
1840
1841
if (ctx.lastReadSeqno == ctx.maxSeqno ) {
1841
1842
logger->TRACE (" MagmaKVStore::scan {} lastReadSeqno:{} == maxSeqno:{}" ,
1842
1843
ctx.vbid ,
@@ -1849,7 +1850,8 @@ scan_error_t MagmaKVStore::scan(BySeqnoScanContext& ctx) const {
1849
1850
startSeqno = ctx.lastReadSeqno + 1 ;
1850
1851
}
1851
1852
auto & mctx = dynamic_cast <MagmaScanContext&>(ctx);
1852
- for (mctx.itr ->Seek (startSeqno, ctx.maxSeqno ); mctx.itr ->Valid ();
1853
+ for (mctx.itr ->Initialize (startSeqno, ctx.maxSeqno , mode);
1854
+ mctx.itr ->Valid ();
1853
1855
mctx.itr ->Next ()) {
1854
1856
Slice keySlice, metaSlice, valSlice;
1855
1857
uint64_t seqno;
@@ -3722,3 +3724,7 @@ std::pair<Status, uint64_t> MagmaKVStore::getOldestRollbackableHighSeqno(
3722
3724
3723
3725
return {status, seqno};
3724
3726
}
3727
+
3728
+ void MagmaKVStore::setHistoryRetentionBytes (size_t size) {
3729
+ magma->SetHistoryRetentionSize (size);
3730
+ }
0 commit comments