summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSusan LoVerso <sue@mongodb.com>2016-01-29 16:02:58 -0500
committerSusan LoVerso <sue@mongodb.com>2016-01-29 16:02:58 -0500
commit33d27cc15d7cab2778986230cf8e01421c8536ee (patch)
tree11e1510a1c04576dac06ad40af8f419867cf8f00
parent7880038b807a530b347e213e9d773960c45c6df0 (diff)
downloadmongo-33d27cc15d7cab2778986230cf8e01421c8536ee.tar.gz
WT-2215 Make WT_LSN simply a union. Clean up based on review.
-rw-r--r--src/conn/conn_log.c37
-rw-r--r--src/cursor/cur_log.c10
-rw-r--r--src/include/log.h46
-rw-r--r--src/include/log.i4
-rw-r--r--src/include/wt_internal.h4
-rw-r--r--src/log/log.c68
-rw-r--r--src/log/log_slot.c9
-rw-r--r--src/meta/meta_ckpt.c2
-rw-r--r--src/txn/txn_log.c6
-rw-r--r--src/txn/txn_recover.c6
10 files changed, 87 insertions, 105 deletions
diff --git a/src/conn/conn_log.c b/src/conn/conn_log.c
index f088ba47a19..60f46288072 100644
--- a/src/conn/conn_log.c
+++ b/src/conn/conn_log.c
@@ -180,10 +180,10 @@ __log_archive_once(WT_SESSION_IMPL *session, uint32_t backup_file)
* disk and the checkpoint LSN.
*/
if (backup_file != 0)
- min_lognum = WT_MIN(log->ckpt_lsn.lsn_file, backup_file);
+ min_lognum = WT_MIN(log->ckpt_lsn.l.file, backup_file);
else
min_lognum = WT_MIN(
- log->ckpt_lsn.lsn_file, log->sync_lsn.lsn_file);
+ log->ckpt_lsn.l.file, log->sync_lsn.l.file);
WT_RET(__wt_verbose(session, WT_VERB_LOG,
"log_archive: archive to log number %" PRIu32, min_lognum));
@@ -317,7 +317,7 @@ __wt_log_truncate_files(
backup_file = 0;
if (cursor != NULL)
backup_file = WT_CURSOR_BACKUP_ID(cursor);
- WT_ASSERT(session, backup_file <= log->alloc_lsn.lsn_file);
+ WT_ASSERT(session, backup_file <= log->alloc_lsn.l.file);
WT_RET(__wt_verbose(session, WT_VERB_LOG,
"log_truncate_files: Archive once up to %" PRIu32,
backup_file));
@@ -367,7 +367,7 @@ __log_file_server(void *arg)
* could see mismatched settings. If we do, yield
* until it is set. This should rarely happen.
*/
- while (log->log_close_lsn.lsn_file < filenum)
+ while (log->log_close_lsn.l.file < filenum)
__wt_yield();
if (__wt_log_cmp(
@@ -399,9 +399,9 @@ __log_file_server(void *arg)
* zeroed space.
*/
WT_ERR(__wt_ftruncate(session,
- close_fh, close_end_lsn.lsn_offset));
+ close_fh, close_end_lsn.l.offset));
WT_SET_LSN(&close_end_lsn,
- close_end_lsn.lsn_file + 1, 0);
+ close_end_lsn.l.file + 1, 0);
__wt_spin_lock(session, &log->log_sync_lock);
locked = true;
WT_ERR(__wt_close(session, &close_fh));
@@ -440,9 +440,9 @@ __log_file_server(void *arg)
* this worker thread process that older file
* immediately.
*/
- if ((log->sync_lsn.lsn_file <
- log->bg_sync_lsn.lsn_file) ||
- (log->sync_lsn.lsn_file < min_lsn.lsn_file))
+ if ((log->sync_lsn.l.file <
+ log->bg_sync_lsn.l.file) ||
+ (log->sync_lsn.l.file < min_lsn.l.file))
continue;
WT_ERR(__wt_fsync(session, log->log_fh));
__wt_spin_lock(session, &log->log_sync_lock);
@@ -454,8 +454,8 @@ __log_file_server(void *arg)
if (__wt_log_cmp(
&log->sync_lsn, &min_lsn) <= 0) {
WT_ASSERT(session,
- min_lsn.lsn_file ==
- log->sync_lsn.lsn_file);
+ min_lsn.l.file ==
+ log->sync_lsn.l.file);
log->sync_lsn = min_lsn;
WT_ERR(__wt_cond_signal(
session, log->log_sync_cond));
@@ -501,9 +501,9 @@ typedef struct {
* Return comparison of a written slot pair by LSN.
*/
#define WT_WRLSN_ENTRY_CMP_LT(entry1, entry2) \
- ((entry1).lsn.lsn_file < (entry2).lsn.lsn_file || \
- ((entry1).lsn.lsn_file == (entry2).lsn.lsn_file && \
- (entry1).lsn.lsn_offset < (entry2).lsn.lsn_offset))
+ ((entry1).lsn.l.file < (entry2).lsn.l.file || \
+ ((entry1).lsn.l.file == (entry2).lsn.l.file && \
+ (entry1).lsn.l.offset < (entry2).lsn.l.offset))
/*
* __wt_log_wrlsn --
@@ -540,7 +540,7 @@ restart:
save_i = i;
slot = &log->slot_pool[i++];
WT_ASSERT(session, slot->slot_state != 0 ||
- slot->slot_release_lsn.lsn_file >= log->write_lsn.lsn_file);
+ slot->slot_release_lsn.l.file >= log->write_lsn.l.file);
if (slot->slot_state != WT_LOG_SLOT_WRITTEN)
continue;
written[written_i].slot_index = save_i;
@@ -630,11 +630,10 @@ restart:
* the checkpoint LSN is close to the end of
* the record.
*/
- if (slot->slot_start_lsn.lsn_offset !=
+ if (slot->slot_start_lsn.l.offset !=
slot->slot_last_offset)
- WT_SET_LSN_OFFSET(
- &slot->slot_start_lsn,
- slot->slot_last_offset);
+ slot->slot_start_lsn.l.offset =
+ slot->slot_last_offset;
log->write_start_lsn = slot->slot_start_lsn;
log->write_lsn = slot->slot_end_lsn;
WT_ERR(__wt_cond_signal(
diff --git a/src/cursor/cur_log.c b/src/cursor/cur_log.c
index c5518ea5e67..3fcd8a86066 100644
--- a/src/cursor/cur_log.c
+++ b/src/cursor/cur_log.c
@@ -187,13 +187,13 @@ __curlog_kv(WT_SESSION_IMPL *session, WT_CURSOR *cursor)
if (FLD_ISSET(cursor->flags, WT_CURSTD_RAW)) {
memset(&item, 0, sizeof(item));
WT_RET(wiredtiger_struct_size((WT_SESSION *)session,
- &item.size, WT_LOGC_KEY_FORMAT, cl->cur_lsn->lsn_file,
- cl->cur_lsn->lsn_offset, key_count));
+ &item.size, WT_LOGC_KEY_FORMAT, cl->cur_lsn->l.file,
+ cl->cur_lsn->l.offset, key_count));
WT_RET(__wt_realloc(session, NULL, item.size, &cl->packed_key));
item.data = cl->packed_key;
WT_RET(wiredtiger_struct_pack((WT_SESSION *)session,
cl->packed_key, item.size, WT_LOGC_KEY_FORMAT,
- cl->cur_lsn->lsn_file, cl->cur_lsn->lsn_offset, key_count));
+ cl->cur_lsn->l.file, cl->cur_lsn->l.offset, key_count));
__wt_cursor_set_key(cursor, &item);
WT_RET(wiredtiger_struct_size((WT_SESSION *)session,
@@ -208,8 +208,8 @@ __curlog_kv(WT_SESSION_IMPL *session, WT_CURSOR *cursor)
cl->opvalue));
__wt_cursor_set_value(cursor, &item);
} else {
- __wt_cursor_set_key(cursor, cl->cur_lsn->lsn_file,
- cl->cur_lsn->lsn_offset, key_count);
+ __wt_cursor_set_key(cursor, cl->cur_lsn->l.file,
+ cl->cur_lsn->l.offset, key_count);
__wt_cursor_set_value(cursor, cl->txnid, cl->rectype, optype,
fileid, cl->opkey, cl->opvalue);
}
diff --git a/src/include/log.h b/src/include/log.h
index 246c8d901ae..6440dca891c 100644
--- a/src/include/log.h
+++ b/src/include/log.h
@@ -10,22 +10,18 @@
* WT_LSN --
* A log sequence number, representing a position in the transaction log.
*/
-struct __wt_lsn {
- union {
- struct {
+union __wt_lsn {
+ struct {
#ifdef WORDS_BIGENDIAN
- uint32_t file;
- uint32_t offset;
+ uint32_t file;
+ uint32_t offset;
#else
- uint32_t offset;
- uint32_t file;
+ uint32_t offset;
+ uint32_t file;
#endif
- } l;
- uint64_t file_offset;
- } u;
+ } l;
+ uint64_t file_offset;
};
-#define lsn_file u.l.file
-#define lsn_offset u.l.offset
#define WT_LOG_FILENAME "WiredTigerLog" /* Log file name */
#define WT_LOG_PREPNAME "WiredTigerPreplog" /* Log pre-allocated name */
@@ -37,33 +33,23 @@ struct __wt_lsn {
/*
* Atomically set the two components of the LSN.
*/
-#define lsn_file u.l.file
-#define lsn_offset u.l.offset
-#define WT_SET_LSN(l, f, o) (l)->u.file_offset = (((uint64_t)(f) << 32) + (o))
-#define WT_SET_LSN_FILE(l, f) WT_SET_LSN((l), (f), (l)->lsn_offset)
-#define WT_SET_LSN_OFFSET(l, o) WT_SET_LSN((l), (l)->lsn_file, (o))
-
-#define WT_INIT_LSN(l) do { \
- WT_SET_LSN((l), 1, 0); \
-} while (0)
+#define WT_SET_LSN(l, f, o) (l)->file_offset = (((uint64_t)(f) << 32) + (o))
-#define WT_MAX_LSN(l) do { \
- WT_SET_LSN((l), UINT32_MAX, INT32_MAX); \
-} while (0)
+#define WT_INIT_LSN(l) WT_SET_LSN((l), 1, 0)
-#define WT_ZERO_LSN(l) do { \
- WT_SET_LSN((l), 0, 0); \
-} while (0)
+#define WT_MAX_LSN(l) WT_SET_LSN((l), UINT32_MAX, INT32_MAX)
+
+#define WT_ZERO_LSN(l) WT_SET_LSN((l), 0, 0)
/*
* Initialize LSN is (1,0). We only need to shift the 1 for comparison.
*/
-#define WT_IS_INIT_LSN(l) ((l)->u.file_offset == ((uint64_t)1 << 32))
+#define WT_IS_INIT_LSN(l) ((l)->file_offset == ((uint64_t)1 << 32))
/*
* XXX Original tested INT32_MAX.
*/
-#define WT_IS_MAX_LSN(l) \
- ((l)->lsn_file == UINT32_MAX && (l)->lsn_offset == INT32_MAX)
+#define WT_IS_MAX_LSN(lsn) \
+ ((lsn)->l.file == UINT32_MAX && (lsn)->l.offset == INT32_MAX)
/*
* Both of the macros below need to change if the content of __wt_lsn
diff --git a/src/include/log.i b/src/include/log.i
index 993c405818e..9e6c36291f7 100644
--- a/src/include/log.i
+++ b/src/include/log.i
@@ -22,8 +22,8 @@ __wt_log_cmp(WT_LSN *lsn1, WT_LSN *lsn2)
* Read LSNs into local variables so that we only read each field
* once and all comparisons are on the same values.
*/
- l1 = ((volatile WT_LSN *)lsn1)->u.file_offset;
- l2 = ((volatile WT_LSN *)lsn2)->u.file_offset;
+ l1 = ((volatile WT_LSN *)lsn1)->file_offset;
+ l2 = ((volatile WT_LSN *)lsn2)->file_offset;
return (l1 < l2 ? -1 : (l1 > l2 ? 1 : 0));
}
diff --git a/src/include/wt_internal.h b/src/include/wt_internal.h
index 806a5afce0f..5aed32adfcf 100644
--- a/src/include/wt_internal.h
+++ b/src/include/wt_internal.h
@@ -218,8 +218,6 @@ struct __wt_lsm_worker_args;
typedef struct __wt_lsm_worker_args WT_LSM_WORKER_ARGS;
struct __wt_lsm_worker_cookie;
typedef struct __wt_lsm_worker_cookie WT_LSM_WORKER_COOKIE;
-struct __wt_lsn;
- typedef struct __wt_lsn WT_LSN;
struct __wt_multi;
typedef struct __wt_multi WT_MULTI;
struct __wt_myslot;
@@ -286,6 +284,8 @@ struct __wt_txn_state;
typedef struct __wt_txn_state WT_TXN_STATE;
struct __wt_update;
typedef struct __wt_update WT_UPDATE;
+union __wt_lsn;
+ typedef union __wt_lsn WT_LSN;
union __wt_rand_state;
typedef union __wt_rand_state WT_RAND_STATE;
/*
diff --git a/src/log/log.c b/src/log/log.c
index 791317ce0a8..82f859c8265 100644
--- a/src/log/log.c
+++ b/src/log/log.c
@@ -105,7 +105,7 @@ __wt_log_force_sync(WT_SESSION_IMPL *session, WT_LSN *min_lsn)
* LSN has moved into a later log file and there should be a
* log file ready to close.
*/
- while (log->sync_lsn.lsn_file < min_lsn->lsn_file) {
+ while (log->sync_lsn.l.file < min_lsn->l.file) {
WT_ERR(__wt_cond_signal(session,
S2C(session)->log_file_cond));
WT_ERR(__wt_cond_wait(session, log->log_sync_cond, 10000));
@@ -116,11 +116,11 @@ __wt_log_force_sync(WT_SESSION_IMPL *session, WT_LSN *min_lsn)
* Sync the directory if the log file entry hasn't been written
* into the directory.
*/
- if (log->sync_dir_lsn.lsn_file < min_lsn->lsn_file) {
+ if (log->sync_dir_lsn.l.file < min_lsn->l.file) {
WT_ERR(__wt_verbose(session, WT_VERB_LOG,
"log_force_sync: sync directory %s to LSN %d/%lu",
log->log_dir_fh->name,
- min_lsn->lsn_file, min_lsn->lsn_offset));
+ min_lsn->l.file, min_lsn->l.offset));
WT_ERR(__wt_directory_sync_fh(session, log->log_dir_fh));
log->sync_dir_lsn = *min_lsn;
WT_STAT_FAST_CONN_INCR(session, log_sync_dir);
@@ -131,7 +131,7 @@ __wt_log_force_sync(WT_SESSION_IMPL *session, WT_LSN *min_lsn)
if (__wt_log_cmp(&log->sync_lsn, min_lsn) < 0) {
WT_ERR(__wt_verbose(session, WT_VERB_LOG,
"log_force_sync: sync %s to LSN %d/%lu",
- log->log_fh->name, min_lsn->lsn_file, min_lsn->lsn_offset));
+ log->log_fh->name, min_lsn->l.file, min_lsn->l.offset));
WT_ERR(__wt_fsync(session, log->log_fh));
log->sync_lsn = *min_lsn;
WT_STAT_FAST_CONN_INCR(session, log_sync);
@@ -175,7 +175,7 @@ __wt_log_needs_recovery(WT_SESSION_IMPL *session, WT_LSN *ckp_lsn, bool *recp)
* we can skip recovery.
*/
WT_RET(__wt_curlog_open(session, "log:", NULL, &c));
- c->set_key(c, ckp_lsn->lsn_file, ckp_lsn->lsn_offset, 0);
+ c->set_key(c, ckp_lsn->l.file, ckp_lsn->l.offset, 0);
if ((ret = c->search(c)) == 0) {
while ((ret = c->next(c)) == 0) {
/*
@@ -279,7 +279,7 @@ __wt_log_get_all_files(WT_SESSION_IMPL *session,
/* Filter out any files that are below the checkpoint LSN. */
for (max = 0, i = 0; i < count; ) {
WT_ERR(__wt_log_extract_lognum(session, files[i], &id));
- if (active_only && id < log->ckpt_lsn.lsn_file) {
+ if (active_only && id < log->ckpt_lsn.l.file) {
__wt_free(session, files[i]);
files[i] = files[count - 1];
files[--count] = NULL;
@@ -460,8 +460,8 @@ __log_size_fit(WT_SESSION_IMPL *session, WT_LSN *lsn, uint64_t recsize)
conn = S2C(session);
log = conn->log;
- return (lsn->lsn_offset == WT_LOG_FIRST_RECORD ||
- lsn->lsn_offset + (wt_off_t)recsize < conn->log_file_max);
+ return (lsn->l.offset == WT_LOG_FIRST_RECORD ||
+ lsn->l.offset + (wt_off_t)recsize < conn->log_file_max);
}
/*
@@ -560,8 +560,7 @@ __log_fill(WT_SESSION_IMPL *session,
WT_STAT_FAST_CONN_INCRV(session, log_bytes_written, logrec->len);
if (lsnp != NULL) {
*lsnp = myslot->slot->slot_start_lsn;
- WT_SET_LSN_OFFSET(lsnp,
- lsnp->lsn_offset + (uint32_t)myslot->offset);
+ lsnp->l.offset += (uint32_t)myslot->offset;
}
err:
if (ret != 0 && myslot->slot->slot_error == 0)
@@ -892,7 +891,7 @@ __wt_log_acquire(WT_SESSION_IMPL *session, uint64_t recsize, WT_LOGSLOT *slot)
* Pre-allocate on the first real write into the log file, if it
* was just created (i.e. not pre-allocated).
*/
- if (log->alloc_lsn.lsn_offset == WT_LOG_FIRST_RECORD && created_log)
+ if (log->alloc_lsn.l.offset == WT_LOG_FIRST_RECORD && created_log)
WT_RET(__log_prealloc(session, log->log_fh));
/*
* Initialize the slot for activation.
@@ -934,8 +933,8 @@ __log_truncate(WT_SESSION_IMPL *session,
* Truncate the log file to the given LSN.
*/
WT_ERR(__log_openfile(session,
- false, &log_fh, file_prefix, lsn->lsn_file));
- WT_ERR(__wt_ftruncate(session, log_fh, lsn->lsn_offset));
+ false, &log_fh, file_prefix, lsn->l.file));
+ WT_ERR(__wt_ftruncate(session, log_fh, lsn->l.offset));
WT_ERR(__wt_fsync(session, log_fh));
WT_ERR(__wt_close(session, &log_fh));
@@ -949,8 +948,8 @@ __log_truncate(WT_SESSION_IMPL *session,
WT_LOG_FILENAME, &logfiles, &logcount));
for (i = 0; i < logcount; i++) {
WT_ERR(__wt_log_extract_lognum(session, logfiles[i], &lognum));
- if (lognum > lsn->lsn_file &&
- lognum < log->trunc_lsn.lsn_file) {
+ if (lognum > lsn->l.file &&
+ lognum < log->trunc_lsn.l.file) {
WT_ERR(__log_openfile(session,
false, &log_fh, file_prefix, lognum));
/*
@@ -1348,7 +1347,7 @@ __wt_log_release(WT_SESSION_IMPL *session, WT_LOGSLOT *slot, bool *freep)
* sync operations. The most recent one will set the LSN to the
* beginning of our file.
*/
- if (log->sync_lsn.lsn_file < slot->slot_end_lsn.lsn_file ||
+ if (log->sync_lsn.l.file < slot->slot_end_lsn.l.file ||
__wt_spin_trylock(session, &log->log_sync_lock) != 0) {
WT_ERR(__wt_cond_wait(
session, log->log_sync_cond, 10000));
@@ -1368,12 +1367,12 @@ __wt_log_release(WT_SESSION_IMPL *session, WT_LOGSLOT *slot, bool *freep)
* now if needed.
*/
if (F_ISSET(slot, WT_SLOT_SYNC_DIR) &&
- (log->sync_dir_lsn.lsn_file < sync_lsn.lsn_file)) {
+ (log->sync_dir_lsn.l.file < sync_lsn.l.file)) {
WT_ASSERT(session, log->log_dir_fh != NULL);
WT_ERR(__wt_verbose(session, WT_VERB_LOG,
"log_release: sync directory %s to LSN %u/%lu",
log->log_dir_fh->name,
- sync_lsn.lsn_file, sync_lsn.lsn_offset));
+ sync_lsn.l.file, sync_lsn.l.offset));
WT_ERR(__wt_directory_sync_fh(
session, log->log_dir_fh));
log->sync_dir_lsn = sync_lsn;
@@ -1388,7 +1387,7 @@ __wt_log_release(WT_SESSION_IMPL *session, WT_LOGSLOT *slot, bool *freep)
WT_ERR(__wt_verbose(session, WT_VERB_LOG,
"log_release: sync log %s to LSN %u/%lu",
log->log_fh->name,
- sync_lsn.lsn_file, sync_lsn.lsn_offset));
+ sync_lsn.l.file, sync_lsn.l.offset));
WT_STAT_FAST_CONN_INCR(session, log_sync);
WT_ERR(__wt_fsync(session, log->log_fh));
log->sync_lsn = sync_lsn;
@@ -1453,7 +1452,7 @@ __wt_log_scan(WT_SESSION_IMPL *session, WT_LSN *lsnp, uint32_t flags,
if (LF_ISSET(WT_LOGSCAN_RECOVER))
WT_RET(__wt_verbose(session, WT_VERB_LOG,
"__wt_log_scan truncating to %u/%u",
- log->trunc_lsn.lsn_file, log->trunc_lsn.lsn_offset));
+ log->trunc_lsn.l.file, log->trunc_lsn.l.offset));
if (log != NULL) {
allocsize = log->allocsize;
@@ -1471,8 +1470,8 @@ __wt_log_scan(WT_SESSION_IMPL *session, WT_LSN *lsnp, uint32_t flags,
"choose either a start LSN or a start flag");
/* Offsets must be on allocation boundaries. */
- if (lsnp->lsn_offset % allocsize != 0 ||
- lsnp->lsn_file > log->fileid)
+ if (lsnp->l.offset % allocsize != 0 ||
+ lsnp->l.file > log->fileid)
return (WT_NOTFOUND);
/*
@@ -1518,7 +1517,7 @@ __wt_log_scan(WT_SESSION_IMPL *session, WT_LSN *lsnp, uint32_t flags,
logfiles = NULL;
}
WT_ERR(__log_openfile(
- session, false, &log_fh, WT_LOG_FILENAME, start_lsn.lsn_file));
+ session, false, &log_fh, WT_LOG_FILENAME, start_lsn.l.file));
WT_ERR(__wt_filesize(session, log_fh, &log_size));
rd_lsn = start_lsn;
@@ -1526,7 +1525,7 @@ __wt_log_scan(WT_SESSION_IMPL *session, WT_LSN *lsnp, uint32_t flags,
WT_ERR(__wt_scr_alloc(session, 0, &decryptitem));
WT_ERR(__wt_scr_alloc(session, 0, &uncitem));
for (;;) {
- if (rd_lsn.lsn_offset + allocsize > log_size) {
+ if (rd_lsn.l.offset + allocsize > log_size) {
advance:
/*
* If we read the last record, go to the next file.
@@ -1540,15 +1539,15 @@ advance:
if (LF_ISSET(WT_LOGSCAN_RECOVER))
WT_ERR(__log_truncate(session,
&rd_lsn, WT_LOG_FILENAME, 1));
- WT_SET_LSN(&rd_lsn, rd_lsn.lsn_file + 1, 0);
+ WT_SET_LSN(&rd_lsn, rd_lsn.l.file + 1, 0);
/*
* Avoid an error message when we reach end of log
* by checking here.
*/
- if (rd_lsn.lsn_file > end_lsn.lsn_file)
+ if (rd_lsn.l.file > end_lsn.l.file)
break;
WT_ERR(__log_openfile(session,
- false, &log_fh, WT_LOG_FILENAME, rd_lsn.lsn_file));
+ false, &log_fh, WT_LOG_FILENAME, rd_lsn.l.file));
WT_ERR(__wt_filesize(session, log_fh, &log_size));
eol = false;
continue;
@@ -1558,7 +1557,7 @@ advance:
*/
WT_ASSERT(session, buf->memsize >= allocsize);
WT_ERR(__wt_read(session,
- log_fh, rd_lsn.lsn_offset, (size_t)allocsize, buf->mem));
+ log_fh, rd_lsn.l.offset, (size_t)allocsize, buf->mem));
/*
* First 4 bytes is the real record length. See if we
* need to read more than the allocation size. We expect
@@ -1579,7 +1578,7 @@ advance:
*/
if (reclen == 0) {
WT_ERR(__log_has_hole(
- session, log_fh, rd_lsn.lsn_offset, &eol));
+ session, log_fh, rd_lsn.l.offset, &eol));
if (eol)
/* Found a hole. This LSN is the end. */
break;
@@ -1593,7 +1592,7 @@ advance:
* The log file end could be the middle of this
* log record.
*/
- if (rd_lsn.lsn_offset + rdup_len > log_size)
+ if (rd_lsn.l.offset + rdup_len > log_size)
goto advance;
/*
* We need to round up and read in the full padded
@@ -1601,7 +1600,7 @@ advance:
*/
WT_ERR(__wt_buf_grow(session, buf, rdup_len));
WT_ERR(__wt_read(session, log_fh,
- rd_lsn.lsn_offset, (size_t)rdup_len, buf->mem));
+ rd_lsn.l.offset, (size_t)rdup_len, buf->mem));
WT_STAT_FAST_CONN_INCR(session, log_scan_rereads);
}
/*
@@ -1637,9 +1636,8 @@ advance:
*/
WT_STAT_FAST_CONN_INCR(session, log_scan_records);
next_lsn = rd_lsn;
- WT_SET_LSN_OFFSET(&next_lsn,
- next_lsn.lsn_offset + rdup_len);
- if (rd_lsn.lsn_offset != 0) {
+ next_lsn.l.offset += rdup_len;
+ if (rd_lsn.l.offset != 0) {
/*
* We need to manage the different buffers here.
* Buf is the buffer this function uses to read from
@@ -2064,7 +2062,7 @@ __wt_log_flush(WT_SESSION_IMPL *session, uint32_t flags)
WT_RET(__wt_verbose(session, WT_VERB_LOG,
"log_flush: flags %d LSN %u/%lu",
- flags, lsn.lsn_file, lsn.lsn_offset));
+ flags, lsn.l.file, lsn.l.offset));
/*
* If the user wants write-no-sync, there is nothing more to do.
* If the user wants background sync, set the LSN and we're done.
diff --git a/src/log/log_slot.c b/src/log/log_slot.c
index 97ff2c9b626..2844516e78f 100644
--- a/src/log/log_slot.c
+++ b/src/log/log_slot.c
@@ -31,8 +31,8 @@ __wt_log_slot_activate(WT_SESSION_IMPL *session, WT_LOGSLOT *slot)
* are reset when the slot is freed. See log_slot_free.
*/
slot->slot_start_lsn = slot->slot_end_lsn = log->alloc_lsn;
- slot->slot_start_offset = log->alloc_lsn.lsn_offset;
- slot->slot_last_offset = log->alloc_lsn.lsn_offset;
+ slot->slot_start_offset = log->alloc_lsn.l.offset;
+ slot->slot_last_offset = log->alloc_lsn.l.offset;
slot->slot_fh = log->log_fh;
slot->slot_error = 0;
slot->slot_unbuffered = 0;
@@ -96,8 +96,7 @@ retry:
slot->slot_end_lsn = slot->slot_start_lsn;
end_offset =
WT_LOG_SLOT_JOINED_BUFFERED(old_state) + slot->slot_unbuffered;
- WT_SET_LSN_OFFSET(&slot->slot_end_lsn,
- slot->slot_end_lsn.lsn_offset + end_offset);
+ slot->slot_end_lsn.l.offset += end_offset;
WT_STAT_FAST_CONN_INCRV(session,
log_slot_consolidated, end_offset);
/*
@@ -105,7 +104,7 @@ retry:
*/
log->alloc_lsn = slot->slot_end_lsn;
WT_ASSERT(session,
- log->alloc_lsn.lsn_file >= log->write_lsn.lsn_file);
+ log->alloc_lsn.l.file >= log->write_lsn.l.file);
return (0);
}
diff --git a/src/meta/meta_ckpt.c b/src/meta/meta_ckpt.c
index 0bc71c33f66..df4cd2cb4d6 100644
--- a/src/meta/meta_ckpt.c
+++ b/src/meta/meta_ckpt.c
@@ -451,7 +451,7 @@ __wt_meta_ckptlist_set(WT_SESSION_IMPL *session,
if (ckptlsn != NULL)
WT_ERR(__wt_buf_catfmt(session, buf,
",checkpoint_lsn=(%" PRIu32 ",%" PRIuMAX ")",
- ckptlsn->lsn_file, (uintmax_t)ckptlsn->lsn_offset));
+ ckptlsn->l.file, (uintmax_t)ckptlsn->l.offset));
WT_ERR(__ckpt_set(session, fname, buf->mem));
err: __wt_scr_free(session, &buf);
diff --git a/src/txn/txn_log.c b/src/txn/txn_log.c
index 8ffacb459ab..37a6e0b3711 100644
--- a/src/txn/txn_log.c
+++ b/src/txn/txn_log.c
@@ -352,13 +352,13 @@ __wt_txn_checkpoint_log(
/* Write the checkpoint log record. */
WT_ERR(__wt_struct_size(session, &recsize, fmt,
- rectype, ckpt_lsn->lsn_file, ckpt_lsn->lsn_offset,
+ rectype, ckpt_lsn->l.file, ckpt_lsn->l.offset,
txn->ckpt_nsnapshot, ckpt_snapshot));
WT_ERR(__wt_logrec_alloc(session, recsize, &logrec));
WT_ERR(__wt_struct_pack(session,
(uint8_t *)logrec->data + logrec->size, recsize, fmt,
- rectype, ckpt_lsn->lsn_file, ckpt_lsn->lsn_offset,
+ rectype, ckpt_lsn->l.file, ckpt_lsn->l.offset,
txn->ckpt_nsnapshot, ckpt_snapshot));
logrec->size += (uint32_t)recsize;
WT_ERR(__wt_log_write(session, logrec, lsnp,
@@ -492,7 +492,7 @@ __txn_printlog(WT_SESSION_IMPL *session,
WT_RET(__wt_fprintf(out,
" { \"lsn\" : [%" PRIu32 ",%" PRIu32 "],\n",
- lsnp->lsn_file, lsnp->lsn_offset));
+ lsnp->l.file, lsnp->l.offset));
WT_RET(__wt_fprintf(out,
" \"hdr_flags\" : \"%s\",\n", compressed ? "compressed" : ""));
WT_RET(__wt_fprintf(out,
diff --git a/src/txn/txn_recover.c b/src/txn/txn_recover.c
index 5b9bda91a0c..e6bd8a8d755 100644
--- a/src/txn/txn_recover.c
+++ b/src/txn/txn_recover.c
@@ -93,7 +93,7 @@ __recovery_cursor(WT_SESSION_IMPL *session, WT_RECOVERY *r,
WT_ERR(__wt_verbose((session), WT_VERB_RECOVERY, \
"%s op %d to file %d at LSN %u/%u", \
(cursor == NULL) ? "Skipping" : "Applying", \
- optype, fileid, lsnp->lsn_file, lsnp->lsn_offset)); \
+ optype, fileid, lsnp->l.file, lsnp->l.offset)); \
if (cursor == NULL) \
break
@@ -335,7 +335,7 @@ __recovery_setup_file(WT_RECOVERY *r, const char *uri, const char *config)
WT_RET(__wt_verbose(r->session, WT_VERB_RECOVERY,
"Recovering %s with id %u @ (%" PRIu32 ", %" PRIu32 ")",
- uri, fileid, lsn.lsn_file, lsn.lsn_offset));
+ uri, fileid, lsn.l.file, lsn.l.offset));
return (0);
@@ -485,7 +485,7 @@ __wt_txn_recover(WT_SESSION_IMPL *session)
r.metadata_only = false;
WT_ERR(__wt_verbose(session, WT_VERB_RECOVERY,
"Main recovery loop: starting at %u/%u",
- r.ckpt_lsn.lsn_file, r.ckpt_lsn.lsn_offset));
+ r.ckpt_lsn.l.file, r.ckpt_lsn.l.offset));
WT_ERR(__wt_log_needs_recovery(session, &r.ckpt_lsn, &needs_rec));
/*
* Check if the database was shut down cleanly. If not