diff options
author | Susan LoVerso <sue@wiredtiger.com> | 2014-08-11 15:41:21 -0400 |
---|---|---|
committer | Susan LoVerso <sue@wiredtiger.com> | 2014-08-11 15:41:21 -0400 |
commit | 306099fc4aebcf0827e1baf9a01ba6a462c5ef74 (patch) | |
tree | 21ea3d19e548a6fd6f69a87c0fd6d9ee36234d73 | |
parent | 8e6f9467947e68bf00ea1998ecec0856ea308df3 (diff) | |
download | mongo-306099fc4aebcf0827e1baf9a01ba6a462c5ef74.tar.gz |
Add "all" and "now" support. Add macro for modification operation.
-rw-r--r-- | api/leveldb/hyper_wt.cc | 31 | ||||
-rw-r--r-- | api/leveldb/leveldb_wt.h | 17 |
2 files changed, 32 insertions, 16 deletions
diff --git a/api/leveldb/hyper_wt.cc b/api/leveldb/hyper_wt.cc index 3cce85941d4..81e507cd3aa 100644 --- a/api/leveldb/hyper_wt.cc +++ b/api/leveldb/hyper_wt.cc @@ -170,10 +170,7 @@ ReplayIteratorImpl::Next() { break; // Next() is only interested in modification operations. // Continue for any other type of record. - if (optype == WT_LOGOP_COL_PUT || - optype == WT_LOGOP_COL_REMOVE || - optype == WT_LOGOP_ROW_PUT || - optype == WT_LOGOP_ROW_REMOVE) { + if (WT_VALID_OPERATION(fileid, optype)) { valid_ = true; break; } @@ -207,10 +204,7 @@ ReplayIteratorImpl::SkipToLast() { break; // We're only interested in modification operations. // Continue for any other type of record. - if (optype == WT_LOGOP_COL_PUT || - optype == WT_LOGOP_COL_REMOVE || - optype == WT_LOGOP_ROW_PUT || - optype == WT_LOGOP_ROW_REMOVE) { + if (WT_VALID_OPERATION(fileid, optype)) { valid_ = true; last_lsn = lsn_; } @@ -230,6 +224,20 @@ ReplayIteratorImpl::SkipTo(const std::string& timestamp) { WT_LSN target_lsn; int ret = 0; + if (timestamp == "all") { + if (cursor_ != NULL) { + ret = cursor_->reset(cursor_); + status_ = WiredTigerErrorToStatus(ret); + if (ret != 0) + return; + Next(); + return; + } + } + if (timestamp == "now") { + SkipToLast(); + return; + } sscanf(timestamp.c_str(), WT_TIMESTAMP_FORMAT, &target_lsn.file, &target_lsn.offset); SkipTo(&target_lsn); @@ -263,10 +271,7 @@ ReplayIteratorImpl::SkipTo(WT_LSN *target_lsn) { valid_ = true; // We're only interested in modification operations. // Continue for any other type of record. - if (optype == WT_LOGOP_COL_PUT || - optype == WT_LOGOP_COL_REMOVE || - optype == WT_LOGOP_ROW_PUT || - optype == WT_LOGOP_ROW_REMOVE) + if (WT_VALID_OPERATION(fileid, optype)) Next(); } } @@ -311,6 +316,7 @@ DbImpl::ValidateTimestamp(const std::string& timestamp) OperationContext *context = GetContext(); ReplayIteratorImpl *iter = new ReplayIteratorImpl(context); + // The SkipTo function will handle "all" or "now". iter->SkipTo(timestamp); valid = iter->Valid(); ReleaseReplayIterator(iter); @@ -326,6 +332,7 @@ DbImpl::CompareTimestamps(const std::string& lhs, const std::string& rhs) ReplayIteratorImpl *rhiter = new ReplayIteratorImpl(context); int cmp = 0; + // The SkipTo function will handle "all" or "now". lhiter->SkipTo(lhs); rhiter->SkipTo(rhs); if (lhiter->Valid() && rhiter->Valid()) diff --git a/api/leveldb/leveldb_wt.h b/api/leveldb/leveldb_wt.h index 848efec5f49..4a9252bd8c7 100644 --- a/api/leveldb/leveldb_wt.h +++ b/api/leveldb/leveldb_wt.h @@ -45,13 +45,22 @@ #include "wiredtiger.h" #define WT_URI "table:data" -#define WT_CONN_CONFIG "log=(enabled),checkpoint=(wait=180),checkpoint_sync=false," \ - "session_max=8192,mmap=false,eviction_workers=4," \ - "transaction_sync=(enabled=true,method=none)," +#define WT_CONN_CONFIG "log=(enabled),checkpoint=(wait=180)," \ + "checkpoint_sync=false,session_max=8192,eviction_workers=4," \ + "mmap=false,transaction_sync=(enabled=true,method=none)," // Note: LSM doesn't split, build full pages from the start -#define WT_TABLE_CONFIG "type=lsm,split_pct=100,leaf_item_max=1KB," \ +#define WT_TABLE_CONFIG "type=lsm,split_pct=100,leaf_item_max=1KB," \ "lsm=(chunk_size=100MB,bloom_config=(leaf_page_max=8MB))," #define WT_TIMESTAMP_FORMAT "%d.%llu" +// We're also only interested in operations to the user file. Skip over +// any changes to the metadata. +// XXX - Currently assume metadata fileid is 0. +#define WT_VALID_OPERATION(fileid, optype) \ + ((fileid) != 0 && \ + ((optype) == WT_LOGOP_COL_PUT || \ + (optype) == WT_LOGOP_COL_REMOVE || \ + (optype) == WT_LOGOP_ROW_PUT || \ + (optype) == WT_LOGOP_ROW_REMOVE)) using leveldb::Cache; using leveldb::FilterPolicy; |