/* * __wt_meta_track_update -- * Track a metadata update operation. */ int __wt_meta_track_update(WT_SESSION_IMPL *session, const char *key) { WT_DECL_RET; WT_META_TRACK *trk; WT_RET(__meta_track_next(session, &trk)); trk->op = WT_ST_SET; WT_ERR(__wt_strdup(session, key, &trk->a)); /* * If there was a previous value, keep it around -- if not, then this * "update" is really an insert. */ if ((ret = __wt_metadata_search(session, key, &trk->b)) == WT_NOTFOUND) { trk->op = WT_ST_REMOVE; ret = 0; } WT_ERR(ret); return (0); err: __meta_track_err(session); return (ret); }
/* * __wt_meta_track_on -- * Turn on metadata operation tracking. */ int __wt_meta_track_on(WT_SESSION_IMPL *session) { if (session->meta_track_nest++ == 0) WT_RET(__meta_track_next(session, NULL)); return (0); }
/* * __wt_meta_track_insert -- * Track an insert operation. */ int __wt_meta_track_insert(WT_SESSION_IMPL *session, const char *key) { WT_META_TRACK *trk; WT_RET(__meta_track_next(session, &trk)); trk->op = WT_ST_REMOVE; WT_RET(__wt_strdup(session, key, &trk->a)); return (0); }
/* * __wt_meta_track_checkpoint -- * Track a handle involved in a checkpoint. */ int __wt_meta_track_checkpoint(WT_SESSION_IMPL *session) { WT_META_TRACK *trk; WT_ASSERT(session, session->dhandle != NULL); WT_RET(__meta_track_next(session, &trk)); trk->op = WT_ST_CHECKPOINT; trk->dhandle = session->dhandle; return (0); }
/* * __wt_meta_track_handle_lock -- * Track a locked handle. */ int __wt_meta_track_handle_lock(WT_SESSION_IMPL *session, bool created) { WT_META_TRACK *trk; WT_ASSERT(session, session->dhandle != NULL); WT_RET(__meta_track_next(session, &trk)); trk->op = WT_ST_LOCK; trk->dhandle = session->dhandle; trk->created = created; return (0); }
/* * __wt_meta_track_fileop -- * Track a filesystem operation. */ int __wt_meta_track_fileop( WT_SESSION_IMPL *session, const char *olduri, const char *newuri) { WT_META_TRACK *trk; WT_RET(__meta_track_next(session, &trk)); trk->op = WT_ST_FILEOP; if (olduri != NULL) WT_RET(__wt_strdup(session, olduri, &trk->a)); if (newuri != NULL) WT_RET(__wt_strdup(session, newuri, &trk->b)); return (0); }
/* * __wt_meta_track_drop -- * Track a file drop, where the remove is deferred until commit. */ int __wt_meta_track_drop( WT_SESSION_IMPL *session, const char *filename) { WT_DECL_RET; WT_META_TRACK *trk; WT_RET(__meta_track_next(session, &trk)); trk->op = WT_ST_DROP_COMMIT; WT_ERR(__wt_strdup(session, filename, &trk->a)); return (0); err: __meta_track_err(session); return (ret); }
/* * __wt_meta_track_on -- * Turn on metadata operation tracking. */ int __wt_meta_track_on(WT_SESSION_IMPL *session) { if (session->meta_track_nest++ == 0) { if (!F_ISSET(&session->txn, WT_TXN_RUNNING)) { #ifdef WT_ENABLE_SCHEMA_TXN WT_RET(__wt_txn_begin(session, NULL)); __wt_errx(session, "TRACK: Using internal schema txn"); #endif F_SET(session, WT_SESSION_SCHEMA_TXN); } WT_RET(__meta_track_next(session, NULL)); } return (0); }
/* * __wt_meta_track_fileop -- * Track a filesystem operation. */ int __wt_meta_track_fileop( WT_SESSION_IMPL *session, const char *olduri, const char *newuri) { WT_DECL_RET; WT_META_TRACK *trk; WT_RET(__meta_track_next(session, &trk)); trk->op = WT_ST_FILEOP; WT_ERR(__wt_strdup(session, olduri, &trk->a)); WT_ERR(__wt_strdup(session, newuri, &trk->b)); return (0); err: __meta_track_err(session); return (ret); }