diff options
author | Susan LoVerso <sue@wiredtiger.com> | 2014-07-31 11:13:52 -0400 |
---|---|---|
committer | Susan LoVerso <sue@wiredtiger.com> | 2014-07-31 11:13:52 -0400 |
commit | 49612be47e8ee8b333ce617bba1934af635f693b (patch) | |
tree | a2c8bb55df01469479c2a81143048b4846c23fa1 /examples | |
parent | 7d33c466cc2ed0f594b11f5e8c99b90f683e8ec7 (diff) | |
download | mongo-49612be47e8ee8b333ce617bba1934af635f693b.tar.gz |
Add a few comments about the saved LSN.
Diffstat (limited to 'examples')
-rw-r--r-- | examples/c/ex_log.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/examples/c/ex_log.c b/examples/c/ex_log.c index 61c2510a5db..b208df103f9 100644 --- a/examples/c/ex_log.c +++ b/examples/c/ex_log.c @@ -77,6 +77,11 @@ walk_log(WT_SESSION *session) /*! [log cursor get_key] */ ret = cursor->get_key(cursor, &lsn.file, &lsn.offset); /*! [log cursor get_key] */ + /* + * Save one of the LSNs we get back to search for it + * later. Doesn't matter which one. We know there are + * more than 3, so just pick 3 here. + */ if (++i == 3) lsnsave = lsn; /*! [log cursor get_value] */ @@ -86,6 +91,10 @@ walk_log(WT_SESSION *session) WALK_PRINT(lsn); } cursor->reset(cursor); + /* + * Search for the LSN we saved earlier. Confirm the key + * does not change. + */ /*! [log cursor set_key] */ cursor->set_key(cursor, lsnsave.file, lsnsave.offset); /*! [log cursor set_key] */ @@ -183,6 +192,12 @@ step_log(WT_SESSION *session) ret = cursor->get_key(cursor, &lsn.file, &lsn.offset, &opcount); /*! [log step get_key] */ + /* + * Save one of the LSNs we get back to search for it + * later. Pick a later one because we want to walk from + * that LSN to the end (where the multi-step transaction + * was performed). Just choose the record that is MAX_KEYS. + */ if (++i == MAX_KEYS) lsnsave = lsn; /*! [log step get_value] */ |