Commit d7812705 authored by Bradley C. Kuszmaul's avatar Bradley C. Kuszmaul Committed by Yoni Fogel
Browse files

refs[t:4697] Merge xa to main. {{{svn merge -r41628:41661 ../tokudb.4697 }}} Refs #4697.

git-svn-id: file:///svn/toku/tokudb@41662 c7de825b-a66e-492c-adef-691d508d4ae1
parent 89f7051b
Loading
Loading
Loading
Loading
+10 −0
Original line number Diff line number Diff line
@@ -359,6 +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 **)",
                             NULL};

	sort_and_dump_fields("db_env", true, extra);
@@ -463,6 +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 *)",
	NULL};
    sort_and_dump_fields("db_txn", false, extra);
}
@@ -525,6 +528,13 @@ 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"
           "    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");

   //Typedef toku_off_t
    printf("#ifndef TOKU_OFF_T_DEFINED\n"
           "#define TOKU_OFF_T_DEFINED\n"
+9 −0
Original line number Diff line number Diff line
@@ -17,6 +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 */
    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;
#ifndef TOKU_OFF_T_DEFINED
#define TOKU_OFF_T_DEFINED
typedef int64_t toku_off_t;
@@ -234,6 +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 **);
  void *app_private;
  void *api1_internal;
  int  (*close) (DB_ENV *, u_int32_t);
@@ -360,6 +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 *);
  DB_ENV *mgrp /*In TokuDB, mgrp is a DB_ENV not a DB_TXNMGR*/;
  DB_TXN *parent;
  void *api_internal;
+1 −0
Original line number Diff line number Diff line
@@ -49,6 +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.)
#define ROLLBACK_NONE     ((BLOCKNUM){0})

static inline BLOCKNUM make_blocknum(int64_t b) { BLOCKNUM result={b}; return result; }
+3 −4
Original line number Diff line number Diff line
@@ -3548,11 +3548,11 @@ log_open_txn (OMTVALUE txnv, u_int32_t UU(index), void *UU(extra)) {
	return 0;
    }
    case TOKUTXN_PREPARING: {
	GID gid;
	toku_txn_get_prepared_gid(txn, &gid);
	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),
					    gid,
					    &xa_xid,
					    txn->rollentry_raw_count,
					    open_filenums,
					    txn->force_fsync_on_commit,
@@ -3562,7 +3562,6 @@ log_open_txn (OMTVALUE txnv, u_int32_t UU(index), void *UU(extra)) {
					    txn->spilled_rollback_tail,
					    txn->current_rollback);
	assert(r==0);
	toku_free(gid.gid);
	return 0;
    }
    case TOKUTXN_RETIRED:
+9 −3
Original line number Diff line number Diff line
@@ -181,7 +181,7 @@ struct tokutxn {
    TOKUTXN_STATE state;
    LSN        do_fsync_lsn;
    BOOL       do_fsync;
    GID        gid; // for prepared transactions
    XID        xa_xid; // for prepared transactions
    struct toku_list prepared_txns_link; // list of prepared transactions
};

@@ -228,8 +228,14 @@ static inline int toku_logsizeof_TXNID (TXNID txnid __attribute__((__unused__)))
    return 8;
}

static inline int toku_logsizeof_GID (GID gid __attribute__((__unused__))) {
    return DB_GID_SIZE;
static inline int toku_logsizeof_XIDP (XIDP xid) {
    assert(0<=xid->gtrid_length && xid->gtrid_length<=64);
    assert(0<=xid->bqual_length && xid->bqual_length<=64);
    return xid->gtrid_length
	+ xid->bqual_length
	+ 4  // formatID
	+ 1  // gtrid_length
	+ 1; // bqual_length
}

static inline int toku_logsizeof_FILENUMS (FILENUMS fs) {
Loading