diff options
Diffstat (limited to 'src/log/log_sys.c')
-rw-r--r-- | src/log/log_sys.c | 36 |
1 files changed, 13 insertions, 23 deletions
diff --git a/src/log/log_sys.c b/src/log/log_sys.c index 0f3cfdbc14b..4eb2a8e23d2 100644 --- a/src/log/log_sys.c +++ b/src/log/log_sys.c @@ -18,31 +18,28 @@ __wt_log_system_record( { WT_DECL_ITEM(logrec_buf); WT_DECL_RET; - WT_ITEM *dummy, empty; WT_LOG *log; WT_LOG_RECORD *logrec; WT_LOGSLOT tmp; WT_MYSLOT myslot; - const char *fmt = WT_UNCHECKED_STRING(IIIU); + const char *fmt = WT_UNCHECKED_STRING(I); uint32_t rectype = WT_LOGREC_SYSTEM; size_t recsize; log = S2C(session)->log; WT_RET(__wt_logrec_alloc(session, log->allocsize, &logrec_buf)); memset((uint8_t *)logrec_buf->mem, 0, log->allocsize); - WT_CLEAR(empty); - dummy = ∅ - /* - * There is currently an unused portion of the system record for - * future use. Send in a NULL entry. - */ - WT_ERR(__wt_struct_size(session, &recsize, fmt, rectype, - lsn->l.file, lsn->l.offset, dummy)); - WT_ASSERT(session, recsize <= log->allocsize); + + WT_ERR(__wt_struct_size(session, &recsize, fmt, rectype)); WT_ERR(__wt_struct_pack(session, (uint8_t *)logrec_buf->data + logrec_buf->size, recsize, fmt, - rectype, lsn->l.file, lsn->l.offset, dummy)); + rectype)); + logrec_buf->size += recsize; + WT_ERR(__wt_logop_prev_lsn_pack(session, logrec_buf, lsn)); + WT_ASSERT(session, logrec_buf->size <= log->allocsize); + logrec = (WT_LOG_RECORD *)logrec_buf->mem; + /* * We know system records are this size. And we have to adjust * the size now because we're not going through the normal log @@ -50,9 +47,8 @@ __wt_log_system_record( * earlier. */ logrec_buf->size = logrec->len = log->allocsize; - /* - * We do not compress nor encrypt this record. - */ + + /* We do not compress nor encrypt this record. */ logrec->checksum = 0; logrec->flags = 0; __wt_log_record_byteswap(logrec); @@ -82,16 +78,10 @@ __wt_log_recover_system(WT_SESSION_IMPL *session, const uint8_t **pp, const uint8_t *end, WT_LSN *lsnp) { WT_DECL_RET; - WT_ITEM unused; - uint32_t prev_file, prev_offset; - const char *fmt = WT_UNCHECKED_STRING(IIU); - if ((ret = __wt_struct_unpack(session, *pp, WT_PTRDIFF(end, *pp), fmt, - &prev_file, &prev_offset, &unused)) != 0) + if ((ret = __wt_logop_prev_lsn_unpack(session, pp, end, lsnp)) != 0) WT_RET_MSG(session, ret, "log_recover_prevlsn: unpack failure"); - if (lsnp != NULL) - WT_SET_LSN(lsnp, prev_file, prev_offset); - *pp = end; + return (0); } |