Commit de9326db authored by Bradley C. Kuszmaul's avatar Bradley C. Kuszmaul Committed by Yoni Fogel

close[t:4707] Rename xid_t to avoid conflicts with the handlerton. Closes #4707.

git-svn-id: file:///svn/toku/tokudb@41667 c7de825b-a66e-492c-adef-691d508d4ae1
parent b1854428
......@@ -359,8 +359,8 @@ void print_db_env_struct (void) {
"void (*set_update) (DB_ENV *env, int (*update_function)(DB *, const DBT *key, const DBT *old_val, const DBT *extra, void (*set_val)(const DBT *new_val, void *set_extra), void *set_extra))",
"int (*set_lock_timeout) (DB_ENV *env, uint64_t lock_wait_time_msec)",
"int (*get_lock_timeout) (DB_ENV *env, uint64_t *lock_wait_time_msec)",
"int (*txn_xa_recover) (DB_ENV*, XID list[/*count*/], long count, /*out*/ long *retp, u_int32_t flags)",
"int (*get_txn_from_xid) (DB_ENV*, /*in*/ XID *, /*out*/ DB_TXN **)",
"int (*txn_xa_recover) (DB_ENV*, TOKU_XA_XID list[/*count*/], long count, /*out*/ long *retp, u_int32_t flags)",
"int (*get_txn_from_xid) (DB_ENV*, /*in*/ TOKU_XA_XID *, /*out*/ DB_TXN **)",
NULL};
sort_and_dump_fields("db_env", true, extra);
......@@ -465,7 +465,7 @@ static void print_db_txn_struct (void) {
"struct toku_list open_txns",
"int (*commit_with_progress)(DB_TXN*, uint32_t, TXN_PROGRESS_POLL_FUNCTION, void*)",
"int (*abort_with_progress)(DB_TXN*, TXN_PROGRESS_POLL_FUNCTION, void*)",
"int (*xa_prepare) (DB_TXN*, XID *)",
"int (*xa_prepare) (DB_TXN*, TOKU_XA_XID *)",
NULL};
sort_and_dump_fields("db_txn", false, extra);
}
......@@ -528,12 +528,12 @@ int main (int argc, char *const argv[] __attribute__((__unused__))) {
#endif
dodefine(DB_GID_SIZE);
printf("typedef struct xid_t { /* This struct is intended to be binary compatible with the XID in the XA architecture. See source:/import/opengroup.org/C193.pdf */\n"
printf("typedef struct toku_xa_xid_s { /* This struct is intended to be binary compatible with the XID in the XA architecture. See source:/import/opengroup.org/C193.pdf */\n"
" long formatID; /* format identifier */\n"
" long gtrid_length; /* value from 1 through 64 */\n"
" long bqual_length; /* value from 1 through 64 */\n"
" char data[DB_GID_SIZE];\n"
"} XID;\n");
"} TOKU_XA_XID;\n");
//Typedef toku_off_t
printf("#ifndef TOKU_OFF_T_DEFINED\n"
......
......@@ -17,12 +17,12 @@ extern "C" {
#define DB_VERSION_PATCH 119
#define DB_VERSION_STRING "Tokutek: TokuDB 4.6.119"
#define DB_GID_SIZE 128
typedef struct xid_t { /* This struct is intended to be binary compatible with the XID in the XA architecture. See source:/import/opengroup.org/C193.pdf */
typedef struct toku_xa_xid_s { /* This struct is intended to be binary compatible with the XID in the XA architecture. See source:/import/opengroup.org/C193.pdf */
long formatID; /* format identifier */
long gtrid_length; /* value from 1 through 64 */
long bqual_length; /* value from 1 through 64 */
char data[DB_GID_SIZE];
} XID;
} TOKU_XA_XID;
#ifndef TOKU_OFF_T_DEFINED
#define TOKU_OFF_T_DEFINED
typedef int64_t toku_off_t;
......@@ -240,8 +240,8 @@ struct __toku_db_env {
void (*set_update) (DB_ENV *env, int (*update_function)(DB *, const DBT *key, const DBT *old_val, const DBT *extra, void (*set_val)(const DBT *new_val, void *set_extra), void *set_extra));
int (*set_lock_timeout) (DB_ENV *env, uint64_t lock_wait_time_msec);
int (*get_lock_timeout) (DB_ENV *env, uint64_t *lock_wait_time_msec);
int (*txn_xa_recover) (DB_ENV*, XID list[/*count*/], long count, /*out*/ long *retp, u_int32_t flags);
int (*get_txn_from_xid) (DB_ENV*, /*in*/ XID *, /*out*/ DB_TXN **);
int (*txn_xa_recover) (DB_ENV*, TOKU_XA_XID list[/*count*/], long count, /*out*/ long *retp, u_int32_t flags);
int (*get_txn_from_xid) (DB_ENV*, /*in*/ TOKU_XA_XID *, /*out*/ DB_TXN **);
void *app_private;
void *api1_internal;
int (*close) (DB_ENV *, u_int32_t);
......@@ -368,7 +368,7 @@ struct __toku_db_txn {
struct toku_list open_txns;
int (*commit_with_progress)(DB_TXN*, uint32_t, TXN_PROGRESS_POLL_FUNCTION, void*);
int (*abort_with_progress)(DB_TXN*, TXN_PROGRESS_POLL_FUNCTION, void*);
int (*xa_prepare) (DB_TXN*, XID *);
int (*xa_prepare) (DB_TXN*, TOKU_XA_XID *);
DB_ENV *mgrp /*In TokuDB, mgrp is a DB_ENV not a DB_TXNMGR*/;
DB_TXN *parent;
void *api_internal;
......
......@@ -49,7 +49,7 @@ typedef u_int64_t TXNID;
typedef struct blocknum_s { int64_t b; } BLOCKNUM; // make a struct so that we will notice type problems.
typedef struct gid_s { uint8_t *gid; } GID; // the gid is of size [DB_GID_SIZE]
typedef XID *XIDP; // this is the type that's passed to the logger code (so that we don't have to copy all 152 bytes when only a subset are even valid.)
typedef TOKU_XA_XID *XIDP; // this is the type that's passed to the logger code (so that we don't have to copy all 152 bytes when only a subset are even valid.)
#define ROLLBACK_NONE ((BLOCKNUM){0})
static inline BLOCKNUM make_blocknum(int64_t b) { BLOCKNUM result={b}; return result; }
......
......@@ -3548,7 +3548,7 @@ log_open_txn (OMTVALUE txnv, u_int32_t UU(index), void *UU(extra)) {
return 0;
}
case TOKUTXN_PREPARING: {
XID xa_xid;
TOKU_XA_XID xa_xid;
toku_txn_get_prepared_xa_xid(txn, &xa_xid);
int r = toku_log_xstillopenprepared(logger, NULL, 0,
toku_txn_get_txnid(txn),
......
......@@ -181,7 +181,7 @@ struct tokutxn {
TOKUTXN_STATE state;
LSN do_fsync_lsn;
BOOL do_fsync;
XID xa_xid; // for prepared transactions
TOKU_XA_XID xa_xid; // for prepared transactions
struct toku_list prepared_txns_link; // list of prepared transactions
};
......
......@@ -975,7 +975,7 @@ int toku_fread_TXNID (FILE *f, TXNID *txnid, struct x1764 *checksum, u_int32_t
int toku_fread_XIDP (FILE *f, XIDP *xidp, struct x1764 *checksum, u_int32_t *len) {
// These reads are verbose because XA defined the fields as "long", but we use 4 bytes, 1 byte and 1 byte respectively.
XID *XMALLOC(xid);
TOKU_XA_XID *XMALLOC(xid);
{
u_int32_t formatID;
toku_fread_u_int32_t(f, &formatID, checksum, len);
......
......@@ -187,7 +187,7 @@ live_list_reverse_note_txn_start(TOKUTXN txn) {
return r;
}
static void invalidate_xa_xid (XID *xid) {
static void invalidate_xa_xid (TOKU_XA_XID *xid) {
ANNOTATE_NEW_MEMORY(xid, sizeof(*xid)); // consider it to be all invalid for valgrind
xid->formatID = -1; // According to the XA spec, -1 means "invalid data"
}
......@@ -503,7 +503,7 @@ int toku_txn_abort_with_lsn(TOKUTXN txn, YIELDF yield, void *yieldv, LSN oplsn,
return r;
}
static void copy_xid (XID *dest, XID *source) {
static void copy_xid (TOKU_XA_XID *dest, TOKU_XA_XID *source) {
ANNOTATE_NEW_MEMORY(dest, sizeof(*dest));
dest->formatID = source->formatID;
dest->gtrid_length = source->gtrid_length;
......@@ -511,7 +511,7 @@ static void copy_xid (XID *dest, XID *source) {
memcpy(dest->data, source->data, source->gtrid_length+source->bqual_length);
}
int toku_txn_prepare_txn (TOKUTXN txn, XID *xa_xid) {
int toku_txn_prepare_txn (TOKUTXN txn, TOKU_XA_XID *xa_xid) {
assert(txn->state==TOKUTXN_LIVE);
txn->state = TOKUTXN_PREPARING; // This state transition must be protected against begin_checkpoint. Right now it uses the ydb lock.
if (txn->parent) return 0; // nothing to do if there's a parent.
......@@ -523,11 +523,11 @@ int toku_txn_prepare_txn (TOKUTXN txn, XID *xa_xid) {
return toku_log_xprepare(txn->logger, &txn->do_fsync_lsn, 0, txn->txnid64, xa_xid);
}
void toku_txn_get_prepared_xa_xid (TOKUTXN txn, XID *xid) {
void toku_txn_get_prepared_xa_xid (TOKUTXN txn, TOKU_XA_XID *xid) {
copy_xid(xid, &txn->xa_xid);
}
int toku_logger_get_txn_from_xid (TOKULOGGER logger, XID *xid, DB_TXN **txnp) {
int toku_logger_get_txn_from_xid (TOKULOGGER logger, TOKU_XA_XID *xid, DB_TXN **txnp) {
int num_live_txns = toku_omt_size(logger->live_txns);
for (int i = 0; i < num_live_txns; i++) {
OMTVALUE v;
......
......@@ -54,10 +54,10 @@ int toku_txn_abort_with_lsn(TOKUTXN txn, YIELDF yield, void *yieldv, LSN oplsn,
TXN_PROGRESS_POLL_FUNCTION poll, void *poll_extra,
bool release_multi_operation_client_lock);
int toku_txn_prepare_txn (TOKUTXN txn, XID *xid) __attribute__((warn_unused_result));
int toku_txn_prepare_txn (TOKUTXN txn, TOKU_XA_XID *xid) __attribute__((warn_unused_result));
// Effect: Do the internal work of preparing a transaction (does not log the prepare record).
void toku_txn_get_prepared_xa_xid (TOKUTXN, XID *);
void toku_txn_get_prepared_xa_xid (TOKUTXN, TOKU_XA_XID *);
// Effect: Fill in the XID information for a transaction. The caller allocates the XID and the function fills in values.
int toku_txn_maybe_fsync_log(TOKULOGGER logger, LSN do_fsync_lsn, BOOL do_fsync, YIELDF yield, void *yieldv);
......@@ -132,11 +132,11 @@ int toku_txn_ignore_contains(TOKUTXN txn, FILENUM filenum);
TOKUTXN_STATE toku_txn_get_state(TOKUTXN txn);
struct tokulogger_preplist {
XID xid;
TOKU_XA_XID xid;
DB_TXN *txn;
};
int toku_logger_recover_txn (TOKULOGGER logger, struct tokulogger_preplist preplist[/*count*/], long count, /*out*/ long *retp, u_int32_t flags);
int toku_logger_get_txn_from_xid (TOKULOGGER logger, XID *xid, DB_TXN **txnp);
int toku_logger_get_txn_from_xid (TOKULOGGER logger, TOKU_XA_XID *xid, DB_TXN **txnp);
#if defined(__cplusplus) || defined(__cilkplusplus)
}
......
......@@ -79,7 +79,7 @@ export.def: export.map Makefile
buildlocktrees: $(LOCKTREE) $(RANGETREE) ;
$(LIBRARY): $(OBJS) $(LOCKTREE) $(RANGETREE) $(NEWBRT) $(DEPEND_COMPILE) $(DEPEND_LINK)
$(LIBRARY): $(OBJS) $(LOCKTREE) $(RANGETREE) ../lib/libnewbrt.a $(DEPEND_COMPILE) $(DEPEND_LINK)
$(LIBRARY): LINK_FILES=$(OBJS) $(LOCKTREE) $(RANGETREE) ../lib/libnewbrt.a $(LZMA_A)
ifeq ($(CC),icc)
ifeq ($(HAVE_CILK),1)
......
......@@ -33,9 +33,9 @@ static void setup_env_and_prepare (DB_ENV **envp, const char *envdir, bool commi
DBT key={.size=4, .data="foo"};
CKERR(db->put(db, txn, &key, &key, 0));
CHK(db->close(db, 0));
XID x = {.formatID = myformatid,
.gtrid_length = 8,
.bqual_length = 9};
TOKU_XA_XID x = {.formatID = myformatid,
.gtrid_length = 8,
.bqual_length = 9};
for (int i=0; i<8+9; i++) x.data[i] = 42+i;
CKERR(txn->xa_prepare(txn, &x));
if (commit)
......@@ -49,7 +49,7 @@ static void test1 (void) {
DB_ENV *env;
setup_env_and_prepare(&env, ENVDIR, false);
{
XID l[1];
TOKU_XA_XID l[1];
long count=-1;
CKERR(env->txn_xa_recover(env, l, 1, &count, DB_FIRST));
printf("%s:%d count=%ld\n", __FILE__, __LINE__, count);
......@@ -78,7 +78,7 @@ static void test1 (void) {
setup_env(&env, ENVDIR);
{
XID l[1];
TOKU_XA_XID l[1];
long count=-1;
{
int r = env->txn_xa_recover(env, l, 1, &count, DB_FIRST);
......
......@@ -1499,7 +1499,7 @@ locked_env_close(DB_ENV * env, u_int32_t flags) {
}
static int
toku_env_txn_xa_recover (DB_ENV *env, XID xids[/*count*/], long count, /*out*/ long *retp, u_int32_t flags) {
toku_env_txn_xa_recover (DB_ENV *env, TOKU_XA_XID xids[/*count*/], long count, /*out*/ long *retp, u_int32_t flags) {
struct tokulogger_preplist *MALLOC_N(count,preps);
int r = toku_logger_recover_txn(env->i->logger, preps, count, retp, flags);
if (r==0) {
......@@ -1536,7 +1536,7 @@ locked_env_txn_recover (DB_ENV *env, DB_PREPLIST preplist[/*count*/], long count
return r;
}
static int
locked_env_txn_xa_recover (DB_ENV *env, XID xids[/*count*/], long count, /*out*/ long *retp, u_int32_t flags) {
locked_env_txn_xa_recover (DB_ENV *env, TOKU_XA_XID xids[/*count*/], long count, /*out*/ long *retp, u_int32_t flags) {
toku_ydb_lock();
int r = toku_env_txn_xa_recover(env, xids, count, retp, flags);
toku_ydb_unlock();
......@@ -1544,12 +1544,12 @@ locked_env_txn_xa_recover (DB_ENV *env, XID xids[/*count*/], long count, /*out*/
}
static int
toku_env_get_txn_from_xid (DB_ENV *env, /*in*/XID *xid, /*out*/ DB_TXN **txnp) {
toku_env_get_txn_from_xid (DB_ENV *env, /*in*/ TOKU_XA_XID *xid, /*out*/ DB_TXN **txnp) {
return toku_logger_get_txn_from_xid(env->i->logger, xid, txnp);
}
static int
locked_env_get_txn_from_xid (DB_ENV *env, /*in*/XID *xid, /*out*/ DB_TXN **txnp) {
locked_env_get_txn_from_xid (DB_ENV *env, /*in*/ TOKU_XA_XID *xid, /*out*/ DB_TXN **txnp) {
toku_ydb_lock();
int r = toku_env_get_txn_from_xid(env, xid, txnp);
toku_ydb_unlock();
......
......@@ -217,7 +217,7 @@ toku_txn_abort_only(DB_TXN * txn,
}
static int
toku_txn_xa_prepare (DB_TXN *txn, XID *xid) {
toku_txn_xa_prepare (DB_TXN *txn, TOKU_XA_XID *xid) {
if (!txn) return EINVAL;
if (txn->parent) return EINVAL;
HANDLE_PANICKED_ENV(txn->mgrp);
......@@ -244,7 +244,7 @@ toku_txn_xa_prepare (DB_TXN *txn, XID *xid) {
static int
toku_txn_prepare (DB_TXN *txn, u_int8_t gid[DB_GID_SIZE]) {
XID xid;
TOKU_XA_XID xid;
ANNOTATE_NEW_MEMORY(&xid, sizeof(xid));
xid.formatID=0x756b6f54; // "Toku"
xid.gtrid_length=DB_GID_SIZE/2; // The maximum allowed gtrid length is 64. See the XA spec in source:/import/opengroup.org/C193.pdf page 20.
......@@ -336,7 +336,7 @@ locked_txn_prepare (DB_TXN *txn, u_int8_t gid[DB_GID_SIZE]) {
}
static int
locked_txn_xa_prepare (DB_TXN *txn, XID *xid) {
locked_txn_xa_prepare (DB_TXN *txn, TOKU_XA_XID *xid) {
toku_ydb_lock(); int r = toku_txn_xa_prepare (txn, xid); toku_ydb_unlock(); return r;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment