Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion bdb/attr.h
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ DEF_ATTR(COMMITDELAYMAX, commitdelaymax, QUANTITY, 0,
"the application. Occasionally useful to allow replicants to catch up "
"on startup with a very busy system.")
DEF_ATTR(SCATTERKEYS, scatterkeys, BOOLEAN, 0, "")
DEF_ATTR(SNAPISOL, snapisol, BOOLEAN, 0, NULL)
DEF_ATTR(LLOG, llog, BOOLEAN, 0, "Enables logical logging")
DEF_ATTR(LOWDISKTHRESHOLD, lowdiskthreshold, PERCENT, 95,
"Sets the low headroom threshold (percent of filesystem full) above "
"which Comdb2 will start removing logs against set policy.")
Expand Down
6 changes: 1 addition & 5 deletions bdb/bdb_api.h
Original file line number Diff line number Diff line change
Expand Up @@ -670,15 +670,11 @@ tran_type *bdb_tran_begin_socksql(bdb_state_type *, int trak, int *bdberr);
tran_type *bdb_tran_begin_readcommitted(bdb_state_type *, int trak,
int *bdberr);

tran_type *bdb_tran_begin_modsnap(bdb_state_type *, int trak,
int *bdberr);
tran_type *bdb_tran_begin_modsnap(bdb_state_type *, int trak, int *bdberr);

tran_type *bdb_tran_begin_serializable(bdb_state_type *bdb_state, int trak,
int *bdberr, int epoch, int file,
int offset, int is_ha_retry);
tran_type *bdb_tran_begin_snapisol(bdb_state_type *bdb_state, int trak,
int *bdberr, int epoch, int file, int offset,
int is_ha_retry);

/* return log bytes written so far for this transaction */
uint64_t bdb_tran_logbytes(tran_type *tran);
Expand Down
161 changes: 1 addition & 160 deletions bdb/bdb_int.h
Original file line number Diff line number Diff line change
Expand Up @@ -120,8 +120,7 @@ typedef enum {
/* TRANCLASS_QUERYISOLATION = 6, */
TRANCLASS_LOGICAL_NOROWLOCKS = 7, /* used in fetch.c for table locks */
TRANCLASS_SOSQL = 8,
TRANCLASS_SNAPISOL = 9,
TRANCLASS_MODSNAP = 10
TRANCLASS_SNAPISOL = 9
} tranclass_type;

#define PAGE_KEY \
Expand All @@ -131,155 +130,12 @@ typedef enum {
#define PAGE_KEY_SIZE \
(DB_FILE_ID_LEN * sizeof(unsigned char) + sizeof(db_pgno_t))

struct lsn_list {
DB_LSN lsn;
LINKC_T(struct lsn_list) lnk;
#ifdef NEWSI_DEBUG_POOL
void *pool;
#endif
};

struct commit_list {
DB_LSN commit_lsn;
unsigned long long logical_tranid;
LINKC_T(struct commit_list) lnk;
#ifdef NEWSI_DEBUG_POOL
void *pool;
#endif
};

struct lsn_commit_list {
DB_LSN lsn;
DB_LSN commit_lsn;
LINKC_T(struct lsn_commit_list) lnk;
#ifdef NEWSI_DEBUG_POOL
void *pool;
#endif
};

struct relink_list {
db_pgno_t inh;
DB_LSN lsn;
LINKC_T(struct relink_list) lnk;
#ifdef NEWSI_DEBUG_POOL
void *pool;
#endif
};

enum { PGLOGS_QUEUE_PAGE = 1, PGLOGS_QUEUE_RELINK = 2 };

struct pglogs_queue_key {
LINKC_T(struct pglogs_queue_key) lnk;
unsigned long long logical_tranid;
int type;
db_pgno_t pgno;
db_pgno_t prev_pgno;
db_pgno_t next_pgno;
DB_LSN lsn;
DB_LSN commit_lsn;
#ifdef NEWSI_DEBUG_POOL
void *pool;
#endif
};

struct asof_cursor {
unsigned char fileid[DB_FILE_ID_LEN];
struct pglogs_queue_key *cur;
};

struct fileid_pglogs_queue {
unsigned char fileid[DB_FILE_ID_LEN];
int deleteme;
pthread_rwlock_t queue_lk;
LISTC_T(struct pglogs_queue_key) queue_keys;
};

// This is stored in a hash indexed by fileid. All cursors pointed
// at a fileid maintain a pointer to the same memory.
struct pglogs_queue_cursor {
unsigned char fileid[DB_FILE_ID_LEN];
struct fileid_pglogs_queue *queue;
struct pglogs_queue_key *last;
};

struct pglogs_queue_heads {
int index;
unsigned char **fileids;
};

struct page_logical_lsn_key {
PAGE_KEY
DB_LSN lsn;
DB_LSN commit_lsn;
};

struct pglogs_key {
PAGE_KEY
LISTC_T(struct lsn_list) lsns;
#ifdef NEWSI_DEBUG_POOL
void *pool;
#endif
};
#define PGLOGS_KEY_OFFSET (offsetof(struct pglogs_key, fileid))

struct pglogs_logical_key {
PAGE_KEY
LISTC_T(struct lsn_commit_list) lsns;
#ifdef NEWSI_DEBUG_POOL
void *pool;
#endif
};
#define PGLOGS_LOGICAL_KEY_OFFSET (offsetof(struct pglogs_logical_key, fileid))

struct pglogs_relink_key {
PAGE_KEY
LISTC_T(struct relink_list) relinks;
#ifdef NEWSI_DEBUG_POOL
void *pool;
#endif
};
#define PGLOGS_RELINK_KEY_OFFSET (offsetof(struct pglogs_relink_key, fileid))

struct ltran_pglogs_key {
unsigned long long logical_tranid;
pthread_mutex_t pglogs_mutex;
DB_LSN logical_commit_lsn; /* lsn of the physical commit of the logical
transaction */
hash_t *pglogs_hashtbl;
};

struct timestamp_lsn_key {
int32_t timestamp;
DB_LSN lsn;
unsigned long long context;
};

typedef struct pglogs_tmptbl_key {
unsigned char fileid[DB_FILE_ID_LEN];
db_pgno_t pgno;
DB_LSN commit_lsn;
DB_LSN lsn;
} pglogs_tmptbl_key;

typedef struct relinks_tmptbl_key {
unsigned char fileid[DB_FILE_ID_LEN];
db_pgno_t pgno;
DB_LSN lsn;
db_pgno_t inh;
} relinks_tmptbl_key;

struct logfile_pglogs_entry {
u_int32_t filenum;

pthread_mutex_t pglogs_lk;
struct temp_table *pglogs_tbl;
struct temp_cursor *pglogs_cur;

pthread_mutex_t relinks_lk;
struct temp_table *relinks_tbl;
struct temp_cursor *relinks_cur;
};

struct checkpoint_list {
DB_LSN lsn;
DB_LSN ckp_lsn;
Expand Down Expand Up @@ -351,16 +207,6 @@ struct tran_tag {
/* oldest logical ref point of a begin-as-of tran*/
DB_LSN asof_ref_lsn;

/* hash table for pglogs */
hash_t *pglogs_hashtbl;
/* hash table for relinks */
hash_t *relinks_hashtbl;
pthread_mutex_t pglogs_mutex;

/* hash table to keep track of
whether we have copied pglogs from the gbl structure for a given page */
hash_t *asof_hashtbl;

/* temporary: used in logical abort case */
hash_t *compensated_records;

Expand Down Expand Up @@ -467,8 +313,6 @@ struct tran_tag {
u_int32_t rc_count;
u_int64_t logbytes;

/* Newsi pglogs queue hash */
hash_t *pglogs_queue_hash;
u_int32_t flags;
int is_prepared;
};
Expand Down Expand Up @@ -1544,9 +1388,6 @@ int update_shadows_beforecommit(bdb_state_type *bdb_state, DB_LSN *lsn,
unsigned long long *commit_genid,
int is_master);

int timestamp_lsn_keycmp(void *_, int key1len, const void *key1, int key2len,
const void *key2);

/**
* Return a cursor to a shadow file, either index or data
* "create" indicate if the shadow file should be created (1)
Expand Down
23 changes: 2 additions & 21 deletions bdb/bdb_osqlcur.c
Original file line number Diff line number Diff line change
Expand Up @@ -529,10 +529,6 @@ static void free_hash(hash_t *h)
hash_free(h);
}

void bdb_return_pglogs_hashtbl(hash_t *hashtbl);
void bdb_return_pglogs_relink_hashtbl(hash_t *hashtbl);

// void bdb_destory_pglogs_hashtbl(hash_t *hashtbl);
/**
* Free all shadows upon transaction commit/rollback
*
Expand All @@ -545,21 +541,6 @@ int bdb_tran_free_shadows(bdb_state_type *bdb_state, tran_type *tran)
if (!tran)
return 0;

if (tran->asof_hashtbl) {
bdb_return_pglogs_hashtbl(tran->asof_hashtbl);
tran->asof_hashtbl = NULL;
}

if (tran->pglogs_hashtbl) {
bdb_return_pglogs_hashtbl(tran->pglogs_hashtbl);
tran->pglogs_hashtbl = NULL;
}

if (tran->relinks_hashtbl) {
bdb_return_pglogs_relink_hashtbl(tran->relinks_hashtbl);
tran->relinks_hashtbl = NULL;
}

if (!tran->tables)
return 0;

Expand Down Expand Up @@ -708,9 +689,9 @@ static int _bdb_tran_deltbl_isdeleted(bdb_cursor_ifn_t *pcur_ifn,
/* check genid cases the genid limit */
switch (cur->shadow_tran->tranclass) {
case TRANCLASS_READCOMMITTED: break;
case TRANCLASS_MODSNAP: break;
case TRANCLASS_SERIALIZABLE:
case TRANCLASS_SNAPISOL:
break;
case TRANCLASS_SERIALIZABLE:
if (/*!ignore_limit &&*/ cur->shadow_tran->startgenid &&
bdb_cmp_genids(cur->shadow_tran->startgenid, genid) < 0) {
if (cur->trak) {
Expand Down
Loading
Loading