diff options
author | Keith Bostic <keith@wiredtiger.com> | 2013-06-07 09:11:37 -0400 |
---|---|---|
committer | Keith Bostic <keith@wiredtiger.com> | 2013-06-07 09:11:37 -0400 |
commit | 24bf94eaaa9089cdd21f584b36d9f518ad365053 (patch) | |
tree | c699d369d535633ec5df715e62d13486f43e0e48 | |
parent | 1cfa52505617baed6b18fc61bf39b0d7c4c1e2c9 (diff) | |
download | mongo-24bf94eaaa9089cdd21f584b36d9f518ad365053.tar.gz |
The extension code needs to know what a transaction ID looks like,
replace wt_txnid_t with uint64_t.
-rw-r--r-- | src/btree/rec_write.c | 6 | ||||
-rw-r--r-- | src/include/btmem.h | 10 | ||||
-rw-r--r-- | src/include/extern.h | 2 | ||||
-rw-r--r-- | src/include/txn.h | 23 | ||||
-rw-r--r-- | src/include/txn.i | 12 | ||||
-rw-r--r-- | src/include/wt_internal.h | 2 | ||||
-rw-r--r-- | src/txn/txn.c | 20 |
7 files changed, 35 insertions, 40 deletions
diff --git a/src/btree/rec_write.c b/src/btree/rec_write.c index 37af35e79cd..9e3259c0453 100644 --- a/src/btree/rec_write.c +++ b/src/btree/rec_write.c @@ -26,9 +26,9 @@ typedef struct { WT_ITEM dsk; /* Temporary disk-image buffer */ /* Track whether all changes to the page are written. */ - wt_txnid_t max_txn; + uint64_t max_txn; uint32_t orig_write_gen; - int upd_skipped; /* Skipped a page's update */ + int upd_skipped; /* Skipped a page's update */ /* * Track if reconciliation has seen any overflow items. Leaf pages with @@ -599,7 +599,7 @@ static inline int __rec_txn_read( WT_SESSION_IMPL *session, WT_RECONCILE *r, WT_UPDATE *upd, WT_UPDATE **updp) { - wt_txnid_t txnid; + uint64_t txnid; int skip; *updp = __wt_txn_read_skip(session, upd, &skip); diff --git a/src/include/btmem.h b/src/include/btmem.h index f12a76d60b4..1afefa43df5 100644 --- a/src/include/btmem.h +++ b/src/include/btmem.h @@ -139,10 +139,10 @@ struct __wt_page_modify { * times if a snapshot is keeping old versions pinned (e.g., in a * checkpoint). */ - wt_txnid_t disk_snap_min; + uint64_t disk_snap_min; /* The largest transaction ID written to disk, for clean pages. */ - wt_txnid_t disk_txn; + uint64_t disk_txn; union { WT_PAGE *split; /* Resulting split */ @@ -196,7 +196,7 @@ struct __wt_page_modify { } *track; /* Array of tracked objects */ uint32_t track_entries; /* Total track slots */ - wt_txnid_t first_id; /* Earliest transactional update, used + uint64_t first_id; /* Earliest transactional update, used * to avoid errors from transaction ID * wraparound. */ @@ -422,7 +422,7 @@ struct __wt_ref { uint64_t recno; /* Column-store: starting recno */ void *key; /* Row-store: on-page cell or WT_IKEY */ } u; - wt_txnid_t txnid; /* Transaction ID */ + uint64_t txnid; /* Transaction ID */ volatile WT_PAGE_STATE state; /* Page state */ }; @@ -616,7 +616,7 @@ struct __wt_update { #define WT_UPDATE_DELETED_ISSET(upd) ((upd)->size == UINT32_MAX) #define WT_UPDATE_DELETED_SET(upd) ((upd)->size = UINT32_MAX) uint32_t size; /* update length */ - wt_txnid_t txnid; /* update transaction */ + uint64_t txnid; /* update transaction */ WT_UPDATE *next; /* forward-linked list */ diff --git a/src/include/extern.h b/src/include/extern.h index 445f9fcdee1..20df371fc1b 100644 --- a/src/include/extern.h +++ b/src/include/extern.h @@ -1271,7 +1271,7 @@ extern void __wt_stat_clear_connection_stats(void *stats_arg); extern int __wt_txnid_cmp(const void *v1, const void *v2); extern void __wt_txn_release_snapshot(WT_SESSION_IMPL *session); extern void __wt_txn_refresh(WT_SESSION_IMPL *session, - wt_txnid_t max_id, + uint64_t max_id, int get_snapshot); extern void __wt_txn_get_evict_snapshot(WT_SESSION_IMPL *session); extern int __wt_txn_begin(WT_SESSION_IMPL *session, const char *cfg[]); diff --git a/src/include/txn.h b/src/include/txn.h index 9fc0958753d..9eeed343a0b 100644 --- a/src/include/txn.h +++ b/src/include/txn.h @@ -5,11 +5,6 @@ * See the file LICENSE for redistribution information. */ -/* - * Transaction ID type: transaction IDs are 64-bit integers. - */ -typedef uint64_t wt_txnid_t; - #define WT_TXN_NONE 0 /* No txn running in a session. */ #define WT_TXN_ABORTED UINT64_MAX /* Update rolled back, ignore. */ @@ -27,18 +22,18 @@ typedef uint64_t wt_txnid_t; ((t1) != (t2) && TXNID_LE(t1, t2)) struct __wt_txn_state { - volatile wt_txnid_t id; - volatile wt_txnid_t snap_min; + volatile uint64_t id; + volatile uint64_t snap_min; }; struct __wt_txn_global { - volatile wt_txnid_t current; /* Current transaction ID. */ + volatile uint64_t current; /* Current transaction ID. */ /* * The oldest transaction ID that is not yet visible to some * transaction in the system. */ - volatile wt_txnid_t oldest_id; + volatile uint64_t oldest_id; volatile uint32_t gen; /* Completed transaction generation */ volatile uint32_t scan_gen; /* Snapshot scan generation */ @@ -53,7 +48,7 @@ enum __wt_txn_isolation { }; struct __wt_txn { - wt_txnid_t id; + uint64_t id; WT_TXN_ISOLATION isolation; @@ -63,12 +58,12 @@ struct __wt_txn { * ids > snap_max are invisible, * everything else is visible unless it is in the snapshot. */ - wt_txnid_t snap_min, snap_max; - wt_txnid_t *snapshot; + uint64_t snap_min, snap_max; + uint64_t *snapshot; uint32_t snapshot_count; /* Saved global state, to avoid repeating scans. */ - wt_txnid_t last_id; + uint64_t last_id; uint32_t last_gen; uint32_t last_scan_gen; @@ -76,7 +71,7 @@ struct __wt_txn { * Arrays of txn IDs in WT_UPDATE or WT_REF structures created or * modified by this transaction. */ - wt_txnid_t **mod; + uint64_t **mod; size_t mod_alloc; u_int mod_count; diff --git a/src/include/txn.i b/src/include/txn.i index 46d8210dbfd..f96a56117fb 100644 --- a/src/include/txn.i +++ b/src/include/txn.i @@ -13,7 +13,7 @@ static inline void __wt_txn_read_last(WT_SESSION_IMPL *session); * Mark a WT_UPDATE object modified by the current transaction. */ static inline int -__wt_txn_modify(WT_SESSION_IMPL *session, wt_txnid_t *id) +__wt_txn_modify(WT_SESSION_IMPL *session, uint64_t *id) { WT_TXN *txn; @@ -78,7 +78,7 @@ __wt_txn_unmodify(WT_SESSION_IMPL *session) * Can the current transaction see the given ID? */ static inline int -__wt_txn_visible(WT_SESSION_IMPL *session, wt_txnid_t id) +__wt_txn_visible(WT_SESSION_IMPL *session, uint64_t id) { WT_TXN *txn; @@ -124,7 +124,7 @@ __wt_txn_visible(WT_SESSION_IMPL *session, wt_txnid_t id) return (1); return (bsearch(&id, txn->snapshot, txn->snapshot_count, - sizeof(wt_txnid_t), __wt_txnid_cmp) == NULL); + sizeof(uint64_t), __wt_txnid_cmp) == NULL); } /* @@ -133,10 +133,10 @@ __wt_txn_visible(WT_SESSION_IMPL *session, wt_txnid_t id) * all sessions in the system will see the transaction ID. */ static inline int -__wt_txn_visible_all(WT_SESSION_IMPL *session, wt_txnid_t id) +__wt_txn_visible_all(WT_SESSION_IMPL *session, uint64_t id) { WT_TXN_GLOBAL *txn_global; - wt_txnid_t oldest_id; + uint64_t oldest_id; txn_global = &S2C(session)->txn_global; oldest_id = txn_global->oldest_id; @@ -279,8 +279,8 @@ __wt_txn_am_oldest(WT_SESSION_IMPL *session) WT_TXN *txn; WT_TXN_GLOBAL *txn_global; WT_TXN_STATE *s; + uint64_t id, my_id; uint32_t i, session_cnt; - wt_txnid_t id, my_id; /* Cache the result: if we're the oldest, don't keep checking. */ txn = &session->txn; diff --git a/src/include/wt_internal.h b/src/include/wt_internal.h index 690d8c9fba3..248ddf46cb0 100644 --- a/src/include/wt_internal.h +++ b/src/include/wt_internal.h @@ -207,7 +207,6 @@ struct __wt_update; #include "mutex.h" #include "posix.h" -#include "txn.h" /* typedef for wt_txnid_t */ #include "stat.h" /* required by dhandle.h */ #include "dhandle.h" /* required by btree.h */ @@ -227,6 +226,7 @@ struct __wt_update; #include "meta.h" #include "os.h" #include "schema.h" +#include "txn.h" #include "session.h" /* required by connection.h */ #include "connection.h" diff --git a/src/txn/txn.c b/src/txn/txn.c index b847925b418..e2519d39f3a 100644 --- a/src/txn/txn.c +++ b/src/txn/txn.c @@ -14,10 +14,10 @@ int __wt_txnid_cmp(const void *v1, const void *v2) { - wt_txnid_t id1, id2; + uint64_t id1, id2; - id1 = *(wt_txnid_t *)v1; - id2 = *(wt_txnid_t *)v2; + id1 = *(uint64_t *)v1; + id2 = *(uint64_t *)v2; return ((id1 == id2) ? 0 : TXNID_LT(id1, id2) ? -1 : 1); } @@ -27,14 +27,14 @@ __wt_txnid_cmp(const void *v1, const void *v2) * Sort a snapshot for faster searching and set the min/max bounds. */ static void -__txn_sort_snapshot(WT_SESSION_IMPL *session, uint32_t n, wt_txnid_t id) +__txn_sort_snapshot(WT_SESSION_IMPL *session, uint32_t n, uint64_t id) { WT_TXN *txn; txn = &session->txn; if (n > 1) - qsort(txn->snapshot, n, sizeof(wt_txnid_t), __wt_txnid_cmp); + qsort(txn->snapshot, n, sizeof(uint64_t), __wt_txnid_cmp); txn->snapshot_count = n; txn->snap_max = id; txn->snap_min = (n == 0 || TXNID_LT(id, txn->snapshot[0])) ? @@ -60,13 +60,13 @@ __wt_txn_release_snapshot(WT_SESSION_IMPL *session) * Allocate a transaction ID and/or a snapshot. */ void -__wt_txn_refresh(WT_SESSION_IMPL *session, wt_txnid_t max_id, int get_snapshot) +__wt_txn_refresh(WT_SESSION_IMPL *session, uint64_t max_id, int get_snapshot) { WT_CONNECTION_IMPL *conn; WT_TXN *txn; WT_TXN_GLOBAL *txn_global; WT_TXN_STATE *s, *txn_state; - wt_txnid_t current_id, id, snap_min, oldest_id; + uint64_t current_id, id, snap_min, oldest_id; uint32_t i, n, session_cnt; conn = S2C(session); @@ -168,7 +168,7 @@ void __wt_txn_get_evict_snapshot(WT_SESSION_IMPL *session) { WT_TXN_GLOBAL *txn_global; - wt_txnid_t oldest_id; + uint64_t oldest_id; txn_global = &S2C(session)->txn_global; @@ -199,7 +199,7 @@ __wt_txn_begin(WT_SESSION_IMPL *session, const char *cfg[]) WT_TXN *txn; WT_TXN_GLOBAL *txn_global; WT_TXN_STATE *txn_state; - wt_txnid_t current_id; + uint64_t current_id; conn = S2C(session); txn = &session->txn; @@ -332,8 +332,8 @@ int __wt_txn_rollback(WT_SESSION_IMPL *session, const char *cfg[]) { WT_TXN *txn; - wt_txnid_t **m; WT_REF **rp; + uint64_t **m; u_int i; WT_UNUSED(cfg); |