diff options
Diffstat (limited to 'src/third_party/wiredtiger/src/txn/txn_log.c')
-rw-r--r-- | src/third_party/wiredtiger/src/txn/txn_log.c | 28 |
1 files changed, 22 insertions, 6 deletions
diff --git a/src/third_party/wiredtiger/src/txn/txn_log.c b/src/third_party/wiredtiger/src/txn/txn_log.c index cf8e464239a..50547034d02 100644 --- a/src/third_party/wiredtiger/src/txn/txn_log.c +++ b/src/third_party/wiredtiger/src/txn/txn_log.c @@ -91,12 +91,24 @@ __txn_op_log(WT_SESSION_IMPL *session, #endif switch (upd->type) { case WT_UPDATE_MODIFY: - WT_RET(__wt_logop_row_modify_pack( - session, logrec, fileid, &cursor->key, &value)); + /* + * Write full updates to the log for size-changing + * modify operations: they aren't idempotent and + * recovery cannot guarantee that they will be applied + * exactly once. We rely on the cursor value already + * having the modify applied. + */ + if (__wt_modify_idempotent(upd->data)) + WT_RET(__wt_logop_row_modify_pack(session, + logrec, fileid, &cursor->key, &value)); + else + WT_RET( + __wt_logop_row_put_pack(session, logrec, + fileid, &cursor->key, &cursor->value)); break; case WT_UPDATE_STANDARD: - WT_RET(__wt_logop_row_put_pack( - session, logrec, fileid, &cursor->key, &value)); + WT_RET(__wt_logop_row_put_pack(session, + logrec, fileid, &cursor->key, &value)); break; case WT_UPDATE_TOMBSTONE: WT_RET(__wt_logop_row_remove_pack( @@ -110,8 +122,12 @@ __txn_op_log(WT_SESSION_IMPL *session, switch (upd->type) { case WT_UPDATE_MODIFY: - WT_RET(__wt_logop_col_modify_pack( - session, logrec, fileid, recno, &value)); + if (__wt_modify_idempotent(upd->data)) + WT_RET(__wt_logop_col_modify_pack(session, + logrec, fileid, recno, &value)); + else + WT_RET(__wt_logop_col_put_pack(session, + logrec, fileid, recno, &cursor->value)); break; case WT_UPDATE_STANDARD: WT_RET(__wt_logop_col_put_pack( |