Commit 507df175 authored by Zardosht Kasheff's avatar Zardosht Kasheff Committed by Yoni Fogel

[t:4472], merge fix to main

git-svn-id: file:///svn/toku/tokudb@39735 c7de825b-a66e-492c-adef-691d508d4ae1
parent da2862bf
...@@ -147,7 +147,6 @@ typedef enum { ...@@ -147,7 +147,6 @@ typedef enum {
#define DB_IS_RESETTING_OP 0x01000000 #define DB_IS_RESETTING_OP 0x01000000
#define DB_PRELOCKED 0x00800000 #define DB_PRELOCKED 0x00800000
#define DB_PRELOCKED_WRITE 0x00400000 #define DB_PRELOCKED_WRITE 0x00400000
#define DB_PRELOCKED_FILE_READ 0x00200000
#define DB_IS_HOT_INDEX 0x00100000 #define DB_IS_HOT_INDEX 0x00100000
#define DBC_DISABLE_PREFETCHING 0x20000000 #define DBC_DISABLE_PREFETCHING 0x20000000
#define DB_DBT_APPMALLOC 1 #define DB_DBT_APPMALLOC 1
...@@ -316,7 +315,6 @@ struct __toku_db { ...@@ -316,7 +315,6 @@ struct __toku_db {
void *app_private; /* 32-bit offset=16 size=4, 64=bit offset=32 size=8 */ void *app_private; /* 32-bit offset=16 size=4, 64=bit offset=32 size=8 */
DB_ENV *dbenv; /* 32-bit offset=20 size=4, 64=bit offset=40 size=8 */ DB_ENV *dbenv; /* 32-bit offset=20 size=4, 64=bit offset=40 size=8 */
int (*pre_acquire_fileops_lock)(DB*, DB_TXN*); int (*pre_acquire_fileops_lock)(DB*, DB_TXN*);
int (*pre_acquire_fileops_shared_lock)(DB*, DB_TXN*);
const DBT* (*dbt_pos_infty)(void) /* Return the special DBT that refers to positive infinity in the lock table.*/; const DBT* (*dbt_pos_infty)(void) /* Return the special DBT that refers to positive infinity in the lock table.*/;
const DBT* (*dbt_neg_infty)(void)/* Return the special DBT that refers to negative infinity in the lock table.*/; const DBT* (*dbt_neg_infty)(void)/* Return the special DBT that refers to negative infinity in the lock table.*/;
void (*get_max_row_size) (DB*, u_int32_t *max_key_size, u_int32_t *max_row_size); void (*get_max_row_size) (DB*, u_int32_t *max_key_size, u_int32_t *max_row_size);
...@@ -334,7 +332,7 @@ struct __toku_db { ...@@ -334,7 +332,7 @@ struct __toku_db {
int (*verify_with_progress)(DB *, int (*progress_callback)(void *progress_extra, float progress), void *progress_extra, int verbose, int keep_going); int (*verify_with_progress)(DB *, int (*progress_callback)(void *progress_extra, float progress), void *progress_extra, int verbose, int keep_going);
int (*update)(DB *, DB_TXN*, const DBT *key, const DBT *extra, u_int32_t flags); int (*update)(DB *, DB_TXN*, const DBT *key, const DBT *extra, u_int32_t flags);
int (*update_broadcast)(DB *, DB_TXN*, const DBT *extra, u_int32_t flags); int (*update_broadcast)(DB *, DB_TXN*, const DBT *extra, u_int32_t flags);
void* __toku_dummy0[10]; void* __toku_dummy0[11];
char __toku_dummy1[96]; char __toku_dummy1[96];
void *api_internal; /* 32-bit offset=236 size=4, 64=bit offset=376 size=8 */ void *api_internal; /* 32-bit offset=236 size=4, 64=bit offset=376 size=8 */
void* __toku_dummy2[5]; void* __toku_dummy2[5];
......
...@@ -148,7 +148,6 @@ typedef enum { ...@@ -148,7 +148,6 @@ typedef enum {
#define DB_IS_RESETTING_OP 0x01000000 #define DB_IS_RESETTING_OP 0x01000000
#define DB_PRELOCKED 0x00800000 #define DB_PRELOCKED 0x00800000
#define DB_PRELOCKED_WRITE 0x00400000 #define DB_PRELOCKED_WRITE 0x00400000
#define DB_PRELOCKED_FILE_READ 0x00200000
#define DB_IS_HOT_INDEX 0x00100000 #define DB_IS_HOT_INDEX 0x00100000
#define DBC_DISABLE_PREFETCHING 0x20000000 #define DBC_DISABLE_PREFETCHING 0x20000000
#define DB_DBT_APPMALLOC 1 #define DB_DBT_APPMALLOC 1
...@@ -326,7 +325,6 @@ struct __toku_db { ...@@ -326,7 +325,6 @@ struct __toku_db {
void *app_private; /* 32-bit offset=16 size=4, 64=bit offset=32 size=8 */ void *app_private; /* 32-bit offset=16 size=4, 64=bit offset=32 size=8 */
DB_ENV *dbenv; /* 32-bit offset=20 size=4, 64=bit offset=40 size=8 */ DB_ENV *dbenv; /* 32-bit offset=20 size=4, 64=bit offset=40 size=8 */
int (*pre_acquire_fileops_lock)(DB*, DB_TXN*); int (*pre_acquire_fileops_lock)(DB*, DB_TXN*);
int (*pre_acquire_fileops_shared_lock)(DB*, DB_TXN*);
const DBT* (*dbt_pos_infty)(void) /* Return the special DBT that refers to positive infinity in the lock table.*/; const DBT* (*dbt_pos_infty)(void) /* Return the special DBT that refers to positive infinity in the lock table.*/;
const DBT* (*dbt_neg_infty)(void)/* Return the special DBT that refers to negative infinity in the lock table.*/; const DBT* (*dbt_neg_infty)(void)/* Return the special DBT that refers to negative infinity in the lock table.*/;
void (*get_max_row_size) (DB*, u_int32_t *max_key_size, u_int32_t *max_row_size); void (*get_max_row_size) (DB*, u_int32_t *max_key_size, u_int32_t *max_row_size);
...@@ -344,7 +342,7 @@ struct __toku_db { ...@@ -344,7 +342,7 @@ struct __toku_db {
int (*verify_with_progress)(DB *, int (*progress_callback)(void *progress_extra, float progress), void *progress_extra, int verbose, int keep_going); int (*verify_with_progress)(DB *, int (*progress_callback)(void *progress_extra, float progress), void *progress_extra, int verbose, int keep_going);
int (*update)(DB *, DB_TXN*, const DBT *key, const DBT *extra, u_int32_t flags); int (*update)(DB *, DB_TXN*, const DBT *key, const DBT *extra, u_int32_t flags);
int (*update_broadcast)(DB *, DB_TXN*, const DBT *extra, u_int32_t flags); int (*update_broadcast)(DB *, DB_TXN*, const DBT *extra, u_int32_t flags);
void* __toku_dummy0[13]; void* __toku_dummy0[14];
char __toku_dummy1[96]; char __toku_dummy1[96];
void *api_internal; /* 32-bit offset=248 size=4, 64=bit offset=400 size=8 */ void *api_internal; /* 32-bit offset=248 size=4, 64=bit offset=400 size=8 */
void* __toku_dummy2[5]; void* __toku_dummy2[5];
......
...@@ -148,7 +148,6 @@ typedef enum { ...@@ -148,7 +148,6 @@ typedef enum {
#define DB_IS_RESETTING_OP 0x01000000 #define DB_IS_RESETTING_OP 0x01000000
#define DB_PRELOCKED 0x00800000 #define DB_PRELOCKED 0x00800000
#define DB_PRELOCKED_WRITE 0x00400000 #define DB_PRELOCKED_WRITE 0x00400000
#define DB_PRELOCKED_FILE_READ 0x00200000
#define DB_IS_HOT_INDEX 0x00100000 #define DB_IS_HOT_INDEX 0x00100000
#define DBC_DISABLE_PREFETCHING 0x20000000 #define DBC_DISABLE_PREFETCHING 0x20000000
#define DB_DBT_APPMALLOC 1 #define DB_DBT_APPMALLOC 1
...@@ -328,7 +327,6 @@ struct __toku_db { ...@@ -328,7 +327,6 @@ struct __toku_db {
void *app_private; /* 32-bit offset=16 size=4, 64=bit offset=32 size=8 */ void *app_private; /* 32-bit offset=16 size=4, 64=bit offset=32 size=8 */
DB_ENV *dbenv; /* 32-bit offset=20 size=4, 64=bit offset=40 size=8 */ DB_ENV *dbenv; /* 32-bit offset=20 size=4, 64=bit offset=40 size=8 */
int (*pre_acquire_fileops_lock)(DB*, DB_TXN*); int (*pre_acquire_fileops_lock)(DB*, DB_TXN*);
int (*pre_acquire_fileops_shared_lock)(DB*, DB_TXN*);
const DBT* (*dbt_pos_infty)(void) /* Return the special DBT that refers to positive infinity in the lock table.*/; const DBT* (*dbt_pos_infty)(void) /* Return the special DBT that refers to positive infinity in the lock table.*/;
const DBT* (*dbt_neg_infty)(void)/* Return the special DBT that refers to negative infinity in the lock table.*/; const DBT* (*dbt_neg_infty)(void)/* Return the special DBT that refers to negative infinity in the lock table.*/;
void (*get_max_row_size) (DB*, u_int32_t *max_key_size, u_int32_t *max_row_size); void (*get_max_row_size) (DB*, u_int32_t *max_key_size, u_int32_t *max_row_size);
...@@ -346,7 +344,7 @@ struct __toku_db { ...@@ -346,7 +344,7 @@ struct __toku_db {
int (*verify_with_progress)(DB *, int (*progress_callback)(void *progress_extra, float progress), void *progress_extra, int verbose, int keep_going); int (*verify_with_progress)(DB *, int (*progress_callback)(void *progress_extra, float progress), void *progress_extra, int verbose, int keep_going);
int (*update)(DB *, DB_TXN*, const DBT *key, const DBT *extra, u_int32_t flags); int (*update)(DB *, DB_TXN*, const DBT *key, const DBT *extra, u_int32_t flags);
int (*update_broadcast)(DB *, DB_TXN*, const DBT *extra, u_int32_t flags); int (*update_broadcast)(DB *, DB_TXN*, const DBT *extra, u_int32_t flags);
void* __toku_dummy0[15]; void* __toku_dummy0[16];
char __toku_dummy1[96]; char __toku_dummy1[96];
void *api_internal; /* 32-bit offset=256 size=4, 64=bit offset=416 size=8 */ void *api_internal; /* 32-bit offset=256 size=4, 64=bit offset=416 size=8 */
void* __toku_dummy2[5]; void* __toku_dummy2[5];
......
...@@ -148,7 +148,6 @@ typedef enum { ...@@ -148,7 +148,6 @@ typedef enum {
#define DB_IS_RESETTING_OP 0x01000000 #define DB_IS_RESETTING_OP 0x01000000
#define DB_PRELOCKED 0x00800000 #define DB_PRELOCKED 0x00800000
#define DB_PRELOCKED_WRITE 0x00400000 #define DB_PRELOCKED_WRITE 0x00400000
#define DB_PRELOCKED_FILE_READ 0x00200000
#define DB_IS_HOT_INDEX 0x00100000 #define DB_IS_HOT_INDEX 0x00100000
#define DBC_DISABLE_PREFETCHING 0x20000000 #define DBC_DISABLE_PREFETCHING 0x20000000
#define DB_DBT_APPMALLOC 1 #define DB_DBT_APPMALLOC 1
...@@ -328,7 +327,6 @@ struct __toku_db { ...@@ -328,7 +327,6 @@ struct __toku_db {
void *app_private; /* 32-bit offset=16 size=4, 64=bit offset=32 size=8 */ void *app_private; /* 32-bit offset=16 size=4, 64=bit offset=32 size=8 */
DB_ENV *dbenv; /* 32-bit offset=20 size=4, 64=bit offset=40 size=8 */ DB_ENV *dbenv; /* 32-bit offset=20 size=4, 64=bit offset=40 size=8 */
int (*pre_acquire_fileops_lock)(DB*, DB_TXN*); int (*pre_acquire_fileops_lock)(DB*, DB_TXN*);
int (*pre_acquire_fileops_shared_lock)(DB*, DB_TXN*);
const DBT* (*dbt_pos_infty)(void) /* Return the special DBT that refers to positive infinity in the lock table.*/; const DBT* (*dbt_pos_infty)(void) /* Return the special DBT that refers to positive infinity in the lock table.*/;
const DBT* (*dbt_neg_infty)(void)/* Return the special DBT that refers to negative infinity in the lock table.*/; const DBT* (*dbt_neg_infty)(void)/* Return the special DBT that refers to negative infinity in the lock table.*/;
void (*get_max_row_size) (DB*, u_int32_t *max_key_size, u_int32_t *max_row_size); void (*get_max_row_size) (DB*, u_int32_t *max_key_size, u_int32_t *max_row_size);
...@@ -346,7 +344,7 @@ struct __toku_db { ...@@ -346,7 +344,7 @@ struct __toku_db {
int (*verify_with_progress)(DB *, int (*progress_callback)(void *progress_extra, float progress), void *progress_extra, int verbose, int keep_going); int (*verify_with_progress)(DB *, int (*progress_callback)(void *progress_extra, float progress), void *progress_extra, int verbose, int keep_going);
int (*update)(DB *, DB_TXN*, const DBT *key, const DBT *extra, u_int32_t flags); int (*update)(DB *, DB_TXN*, const DBT *key, const DBT *extra, u_int32_t flags);
int (*update_broadcast)(DB *, DB_TXN*, const DBT *extra, u_int32_t flags); int (*update_broadcast)(DB *, DB_TXN*, const DBT *extra, u_int32_t flags);
void* __toku_dummy0[18]; void* __toku_dummy0[19];
char __toku_dummy1[96]; char __toku_dummy1[96];
void *api_internal; /* 32-bit offset=268 size=4, 64=bit offset=440 size=8 */ void *api_internal; /* 32-bit offset=268 size=4, 64=bit offset=440 size=8 */
void* __toku_dummy2[5]; void* __toku_dummy2[5];
......
...@@ -148,7 +148,6 @@ typedef enum { ...@@ -148,7 +148,6 @@ typedef enum {
#define DB_IS_RESETTING_OP 0x01000000 #define DB_IS_RESETTING_OP 0x01000000
#define DB_PRELOCKED 0x00800000 #define DB_PRELOCKED 0x00800000
#define DB_PRELOCKED_WRITE 0x00400000 #define DB_PRELOCKED_WRITE 0x00400000
#define DB_PRELOCKED_FILE_READ 0x00200000
#define DB_IS_HOT_INDEX 0x00100000 #define DB_IS_HOT_INDEX 0x00100000
#define DBC_DISABLE_PREFETCHING 0x20000000 #define DBC_DISABLE_PREFETCHING 0x20000000
#define DB_DBT_APPMALLOC 1 #define DB_DBT_APPMALLOC 1
...@@ -331,7 +330,6 @@ struct __toku_db { ...@@ -331,7 +330,6 @@ struct __toku_db {
DB_ENV *dbenv; /* 32-bit offset=24 size=4, 64=bit offset=40 size=8 */ DB_ENV *dbenv; /* 32-bit offset=24 size=4, 64=bit offset=40 size=8 */
int (*pre_acquire_table_lock)(DB*, DB_TXN*); int (*pre_acquire_table_lock)(DB*, DB_TXN*);
int (*pre_acquire_fileops_lock)(DB*, DB_TXN*); int (*pre_acquire_fileops_lock)(DB*, DB_TXN*);
int (*pre_acquire_fileops_shared_lock)(DB*, DB_TXN*);
const DBT* (*dbt_pos_infty)(void) /* Return the special DBT that refers to positive infinity in the lock table.*/; const DBT* (*dbt_pos_infty)(void) /* Return the special DBT that refers to positive infinity in the lock table.*/;
const DBT* (*dbt_neg_infty)(void)/* Return the special DBT that refers to negative infinity in the lock table.*/; const DBT* (*dbt_neg_infty)(void)/* Return the special DBT that refers to negative infinity in the lock table.*/;
void (*get_max_row_size) (DB*, u_int32_t *max_key_size, u_int32_t *max_row_size); void (*get_max_row_size) (DB*, u_int32_t *max_key_size, u_int32_t *max_row_size);
...@@ -349,7 +347,7 @@ struct __toku_db { ...@@ -349,7 +347,7 @@ struct __toku_db {
int (*verify_with_progress)(DB *, int (*progress_callback)(void *progress_extra, float progress), void *progress_extra, int verbose, int keep_going); int (*verify_with_progress)(DB *, int (*progress_callback)(void *progress_extra, float progress), void *progress_extra, int verbose, int keep_going);
int (*update)(DB *, DB_TXN*, const DBT *key, const DBT *extra, u_int32_t flags); int (*update)(DB *, DB_TXN*, const DBT *key, const DBT *extra, u_int32_t flags);
int (*update_broadcast)(DB *, DB_TXN*, const DBT *extra, u_int32_t flags); int (*update_broadcast)(DB *, DB_TXN*, const DBT *extra, u_int32_t flags);
void* __toku_dummy1[22]; void* __toku_dummy1[23];
char __toku_dummy2[80]; char __toku_dummy2[80];
void *api_internal; /* 32-bit offset=276 size=4, 64=bit offset=464 size=8 */ void *api_internal; /* 32-bit offset=276 size=4, 64=bit offset=464 size=8 */
void* __toku_dummy3[5]; void* __toku_dummy3[5];
......
...@@ -158,7 +158,7 @@ static void print_defines (void) { ...@@ -158,7 +158,7 @@ static void print_defines (void) {
printf("#define DB_IS_RESETTING_OP 0x01000000\n"); // private tokudb printf("#define DB_IS_RESETTING_OP 0x01000000\n"); // private tokudb
printf("#define DB_PRELOCKED 0x00800000\n"); // private tokudb printf("#define DB_PRELOCKED 0x00800000\n"); // private tokudb
printf("#define DB_PRELOCKED_WRITE 0x00400000\n"); // private tokudb printf("#define DB_PRELOCKED_WRITE 0x00400000\n"); // private tokudb
printf("#define DB_PRELOCKED_FILE_READ 0x00200000\n"); // private tokudb //printf("#define DB_PRELOCKED_FILE_READ 0x00200000\n"); // private tokudb. No longer supported in #4472
printf("#define DB_IS_HOT_INDEX 0x00100000\n"); // private tokudb printf("#define DB_IS_HOT_INDEX 0x00100000\n"); // private tokudb
printf("#define DBC_DISABLE_PREFETCHING 0x20000000\n"); // private tokudb printf("#define DBC_DISABLE_PREFETCHING 0x20000000\n"); // private tokudb
...@@ -585,7 +585,6 @@ int main (int argc __attribute__((__unused__)), char *const argv[] __attribute__ ...@@ -585,7 +585,6 @@ int main (int argc __attribute__((__unused__)), char *const argv[] __attribute__
"int (*stat64)(DB *, DB_TXN *, DB_BTREE_STAT64 *)", "int (*stat64)(DB *, DB_TXN *, DB_BTREE_STAT64 *)",
"int (*pre_acquire_table_lock)(DB*, DB_TXN*)", "int (*pre_acquire_table_lock)(DB*, DB_TXN*)",
"int (*pre_acquire_fileops_lock)(DB*, DB_TXN*)", "int (*pre_acquire_fileops_lock)(DB*, DB_TXN*)",
"int (*pre_acquire_fileops_shared_lock)(DB*, DB_TXN*)",
"const DBT* (*dbt_pos_infty)(void) /* Return the special DBT that refers to positive infinity in the lock table.*/", "const DBT* (*dbt_pos_infty)(void) /* Return the special DBT that refers to positive infinity in the lock table.*/",
"const DBT* (*dbt_neg_infty)(void)/* Return the special DBT that refers to negative infinity in the lock table.*/", "const DBT* (*dbt_neg_infty)(void)/* Return the special DBT that refers to negative infinity in the lock table.*/",
"void (*get_max_row_size) (DB*, u_int32_t *max_key_size, u_int32_t *max_row_size)", "void (*get_max_row_size) (DB*, u_int32_t *max_key_size, u_int32_t *max_row_size)",
......
...@@ -148,7 +148,6 @@ typedef enum { ...@@ -148,7 +148,6 @@ typedef enum {
#define DB_IS_RESETTING_OP 0x01000000 #define DB_IS_RESETTING_OP 0x01000000
#define DB_PRELOCKED 0x00800000 #define DB_PRELOCKED 0x00800000
#define DB_PRELOCKED_WRITE 0x00400000 #define DB_PRELOCKED_WRITE 0x00400000
#define DB_PRELOCKED_FILE_READ 0x00200000
#define DB_IS_HOT_INDEX 0x00100000 #define DB_IS_HOT_INDEX 0x00100000
#define DBC_DISABLE_PREFETCHING 0x20000000 #define DBC_DISABLE_PREFETCHING 0x20000000
#define DB_DBT_APPMALLOC 1 #define DB_DBT_APPMALLOC 1
...@@ -300,7 +299,6 @@ struct __toku_db { ...@@ -300,7 +299,6 @@ struct __toku_db {
DB_ENV *dbenv; DB_ENV *dbenv;
int (*pre_acquire_table_lock)(DB*, DB_TXN*); int (*pre_acquire_table_lock)(DB*, DB_TXN*);
int (*pre_acquire_fileops_lock)(DB*, DB_TXN*); int (*pre_acquire_fileops_lock)(DB*, DB_TXN*);
int (*pre_acquire_fileops_shared_lock)(DB*, DB_TXN*);
const DBT* (*dbt_pos_infty)(void) /* Return the special DBT that refers to positive infinity in the lock table.*/; const DBT* (*dbt_pos_infty)(void) /* Return the special DBT that refers to positive infinity in the lock table.*/;
const DBT* (*dbt_neg_infty)(void)/* Return the special DBT that refers to negative infinity in the lock table.*/; const DBT* (*dbt_neg_infty)(void)/* Return the special DBT that refers to negative infinity in the lock table.*/;
void (*get_max_row_size) (DB*, u_int32_t *max_key_size, u_int32_t *max_row_size); void (*get_max_row_size) (DB*, u_int32_t *max_key_size, u_int32_t *max_row_size);
......
...@@ -148,7 +148,6 @@ typedef enum { ...@@ -148,7 +148,6 @@ typedef enum {
#define DB_IS_RESETTING_OP 0x01000000 #define DB_IS_RESETTING_OP 0x01000000
#define DB_PRELOCKED 0x00800000 #define DB_PRELOCKED 0x00800000
#define DB_PRELOCKED_WRITE 0x00400000 #define DB_PRELOCKED_WRITE 0x00400000
#define DB_PRELOCKED_FILE_READ 0x00200000
#define DB_IS_HOT_INDEX 0x00100000 #define DB_IS_HOT_INDEX 0x00100000
#define DBC_DISABLE_PREFETCHING 0x20000000 #define DBC_DISABLE_PREFETCHING 0x20000000
#define DB_DBT_APPMALLOC 1 #define DB_DBT_APPMALLOC 1
...@@ -300,7 +299,6 @@ struct __toku_db { ...@@ -300,7 +299,6 @@ struct __toku_db {
DB_ENV *dbenv; DB_ENV *dbenv;
int (*pre_acquire_table_lock)(DB*, DB_TXN*); int (*pre_acquire_table_lock)(DB*, DB_TXN*);
int (*pre_acquire_fileops_lock)(DB*, DB_TXN*); int (*pre_acquire_fileops_lock)(DB*, DB_TXN*);
int (*pre_acquire_fileops_shared_lock)(DB*, DB_TXN*);
const DBT* (*dbt_pos_infty)(void) /* Return the special DBT that refers to positive infinity in the lock table.*/; const DBT* (*dbt_pos_infty)(void) /* Return the special DBT that refers to positive infinity in the lock table.*/;
const DBT* (*dbt_neg_infty)(void)/* Return the special DBT that refers to negative infinity in the lock table.*/; const DBT* (*dbt_neg_infty)(void)/* Return the special DBT that refers to negative infinity in the lock table.*/;
void (*get_max_row_size) (DB*, u_int32_t *max_key_size, u_int32_t *max_row_size); void (*get_max_row_size) (DB*, u_int32_t *max_key_size, u_int32_t *max_row_size);
......
...@@ -161,53 +161,50 @@ toku_indexer_create_indexer(DB_ENV *env, ...@@ -161,53 +161,50 @@ toku_indexer_create_indexer(DB_ENV *env,
DB_INDEXER *indexer = 0; // set later when created DB_INDEXER *indexer = 0; // set later when created
*indexerp = NULL; *indexerp = NULL;
rval = toku_grab_read_lock_on_directory (src_db, txn); XCALLOC(indexer); // init to all zeroes (thus initializing the error_callback and poll_func)
if (rval == 0) { if ( !indexer ) { rval = ENOMEM; goto create_exit; }
XCALLOC(indexer); // init to all zeroes (thus initializing the error_callback and poll_func) XCALLOC(indexer->i); // init to all zeroes (thus initializing all pointers to NULL)
if ( !indexer ) { rval = ENOMEM; goto create_exit; } if ( !indexer->i ) { rval = ENOMEM; goto create_exit; }
XCALLOC(indexer->i); // init to all zeroes (thus initializing all pointers to NULL)
if ( !indexer->i ) { rval = ENOMEM; goto create_exit; } indexer->i->env = env;
indexer->i->txn = txn;
indexer->i->env = env; indexer->i->src_db = src_db;
indexer->i->txn = txn; indexer->i->N = N;
indexer->i->src_db = src_db; indexer->i->dest_dbs = dest_dbs;
indexer->i->N = N; indexer->i->indexer_flags = indexer_flags;
indexer->i->dest_dbs = dest_dbs; indexer->i->loop_mod = 1000; // call poll_func every 1000 rows
indexer->i->indexer_flags = indexer_flags; indexer->i->estimated_rows = 0;
indexer->i->loop_mod = 1000; // call poll_func every 1000 rows indexer->i->undo_do = indexer_undo_do; // TEST export the undo do function
indexer->i->estimated_rows = 0;
indexer->i->undo_do = indexer_undo_do; // TEST export the undo do function XCALLOC_N(N, indexer->i->fnums);
if ( !indexer->i->fnums ) { rval = ENOMEM; goto create_exit; }
XCALLOC_N(N, indexer->i->fnums); for(int i=0;i<indexer->i->N;i++) {
if ( !indexer->i->fnums ) { rval = ENOMEM; goto create_exit; } indexer->i->fnums[i] = toku_cachefile_filenum(db_struct_i(dest_dbs[i])->brt->cf);
for(int i=0;i<indexer->i->N;i++) {
indexer->i->fnums[i] = toku_cachefile_filenum(db_struct_i(dest_dbs[i])->brt->cf);
}
indexer->i->filenums.num = N;
indexer->i->filenums.filenums = indexer->i->fnums;
indexer->i->test_only_flags = 0; // for test use only
indexer->set_error_callback = toku_indexer_set_error_callback;
indexer->set_poll_function = toku_indexer_set_poll_function;
indexer->build = build_index;
indexer->close = close_indexer;
indexer->abort = abort_indexer;
// create and initialize the leafentry cursor
rval = le_cursor_create(&indexer->i->lec, db_struct_i(src_db)->brt, db_txn_struct_i(txn)->tokutxn);
if ( !indexer->i->lec ) { goto create_exit; }
// 2954: add recovery and rollback entries
LSN hot_index_lsn; // not used (yet)
TOKUTXN ttxn = db_txn_struct_i(txn)->tokutxn;
FILENUMS filenums = indexer->i->filenums;
rval = toku_brt_hot_index(NULL, ttxn, filenums, 1, &hot_index_lsn);
} }
indexer->i->filenums.num = N;
indexer->i->filenums.filenums = indexer->i->fnums;
indexer->i->test_only_flags = 0; // for test use only
indexer->set_error_callback = toku_indexer_set_error_callback;
indexer->set_poll_function = toku_indexer_set_poll_function;
indexer->build = build_index;
indexer->close = close_indexer;
indexer->abort = abort_indexer;
// create and initialize the leafentry cursor
rval = le_cursor_create(&indexer->i->lec, db_struct_i(src_db)->brt, db_txn_struct_i(txn)->tokutxn);
if ( !indexer->i->lec ) { goto create_exit; }
// 2954: add recovery and rollback entries
LSN hot_index_lsn; // not used (yet)
TOKUTXN ttxn = db_txn_struct_i(txn)->tokutxn;
FILENUMS filenums = indexer->i->filenums;
rval = toku_brt_hot_index(NULL, ttxn, filenums, 1, &hot_index_lsn);
if (rval == 0) if (rval == 0) {
rval = associate_indexer_with_hot_dbs(indexer, dest_dbs, N); rval = associate_indexer_with_hot_dbs(indexer, dest_dbs, N);
}
create_exit: create_exit:
if ( rval == 0 ) { if ( rval == 0 ) {
......
...@@ -29,7 +29,6 @@ static void verify_shared_ops_fail(DB_ENV* env, DB* db) { ...@@ -29,7 +29,6 @@ static void verify_shared_ops_fail(DB_ENV* env, DB* db) {
int r; int r;
DB_TXN* txn = NULL; DB_TXN* txn = NULL;
u_int32_t flags = 0; u_int32_t flags = 0;
DBC* c = NULL;
DBT key,val; DBT key,val;
DBT in_key,in_val; DBT in_key,in_val;
uint32_t in_key_data, in_val_data = 0; uint32_t in_key_data, in_val_data = 0;
...@@ -48,14 +47,6 @@ static void verify_shared_ops_fail(DB_ENV* env, DB* db) { ...@@ -48,14 +47,6 @@ static void verify_shared_ops_fail(DB_ENV* env, DB* db) {
dbt_init(&key, "a", 4); dbt_init(&key, "a", 4);
dbt_init(&val, "a", 4); dbt_init(&val, "a", 4);
r = env->txn_begin(env, NULL, &txn, 0); CKERR(r);
r = db->pre_acquire_fileops_shared_lock(db, txn); CKERR2(r,DB_LOCK_NOTGRANTED);
r = txn->commit(txn,0); CKERR(r);
r = env->txn_begin(env, NULL, &txn, 0); CKERR(r);
r = db->cursor(db, txn, &c, 0); CKERR2(r,DB_LOCK_NOTGRANTED);
r = txn->commit(txn,0); CKERR(r);
r = env->txn_begin(env, NULL, &txn, 0); CKERR(r); r = env->txn_begin(env, NULL, &txn, 0); CKERR(r);
r = db->put( r = db->put(
db, db,
...@@ -162,34 +153,23 @@ static void verify_shared_ops_fail(DB_ENV* env, DB* db) { ...@@ -162,34 +153,23 @@ static void verify_shared_ops_fail(DB_ENV* env, DB* db) {
} }
static void verify_excl_ops_fail(DB_ENV* env, DB* db) { static void verify_excl_ops_fail(DB_ENV* env, const char* name) {
DB_TXN* txn = NULL; DB_TXN* txn = NULL;
int r; int r;
DBT extra_up; DBT extra_up;
dbt_init(&extra_up, NULL, 0); dbt_init(&extra_up, NULL, 0);
r = env->txn_begin(env, NULL, &txn, 0); CKERR(r); r = env->txn_begin(env, NULL, &txn, 0); CKERR(r);
r = db->pre_acquire_fileops_lock(db, txn); r = env->dbrename(env, txn, name, NULL, "asdf.db", 0);
CKERR2(r, DB_LOCK_NOTGRANTED); CKERR2(r, EINVAL);
r = txn->commit(txn,0); CKERR(r);
r = env->txn_begin(env, NULL, &txn, 0); CKERR(r);
r = db->update_broadcast(db, txn, &extra_up, DB_IS_RESETTING_OP);
CKERR2(r, DB_LOCK_NOTGRANTED);
r = txn->commit(txn,0); CKERR(r); r = txn->commit(txn,0); CKERR(r);
r = env->txn_begin(env, NULL, &txn, 0); CKERR(r);
r = db->change_descriptor(db, txn, &extra_up, 0);
CKERR2(r, DB_LOCK_NOTGRANTED);
r = txn->commit(txn,0); CKERR(r);
} }
int test_main (int argc, char * const argv[]) { int test_main (int argc, char * const argv[]) {
parse_args(argc, argv); parse_args(argc, argv);
int r; int r;
DBC* c1 = NULL;
DBC* c2 = NULL;
DBT in_key,in_val; DBT in_key,in_val;
uint32_t in_key_data = 123456; uint32_t in_key_data = 123456;
uint32_t in_val_data = 654321; uint32_t in_val_data = 654321;
...@@ -232,7 +212,7 @@ int test_main (int argc, char * const argv[]) { ...@@ -232,7 +212,7 @@ int test_main (int argc, char * const argv[]) {
r = env->txn_begin(env, NULL, &txna, 0); CKERR(r); r = env->txn_begin(env, NULL, &txna, 0); CKERR(r);
r = db_create(&db2, env, 0); CKERR(r); r = db_create(&db2, env, 0); CKERR(r);
r = db2->open(db2, txna, "foo2.db", NULL, DB_BTREE, DB_CREATE|DB_IS_HOT_INDEX, 0666); CKERR(r); r = db2->open(db2, txna, "foo2.db", NULL, DB_BTREE, DB_CREATE|DB_IS_HOT_INDEX, 0666); CKERR(r);
verify_excl_ops_fail(env, db2); verify_excl_ops_fail(env, "foo2.db");
r = txna->commit(txna, 0); CKERR(r); r = txna->commit(txna, 0); CKERR(r);
...@@ -242,7 +222,6 @@ int test_main (int argc, char * const argv[]) { ...@@ -242,7 +222,6 @@ int test_main (int argc, char * const argv[]) {
r = env->txn_begin(env, NULL, &txna, 0); CKERR(r); r = env->txn_begin(env, NULL, &txna, 0); CKERR(r);
r = db_create(&db, env, 0); CKERR(r); r = db_create(&db, env, 0); CKERR(r);
r = db->open(db, txna, "foo.db", NULL, DB_BTREE, DB_CREATE, 0666); CKERR(r); r = db->open(db, txna, "foo.db", NULL, DB_BTREE, DB_CREATE, 0666); CKERR(r);
verify_shared_ops_fail(env, db);
r = txna->commit(txna, 0); CKERR(r); r = txna->commit(txna, 0); CKERR(r);
// //
...@@ -255,38 +234,6 @@ int test_main (int argc, char * const argv[]) { ...@@ -255,38 +234,6 @@ int test_main (int argc, char * const argv[]) {
loader=NULL; loader=NULL;
r = txna->commit(txna, 0); CKERR(r); r = txna->commit(txna, 0); CKERR(r);
//
// preacquire fileops lock
//
r = env->txn_begin(env, NULL, &txna, 0); CKERR(r);
r = db->pre_acquire_fileops_lock(db,txna); CKERR(r);
verify_shared_ops_fail(env,db);
r = txna->commit(txna, 0); CKERR(r);
r = env->txn_begin(env, NULL, &txna, 0); CKERR(r);
r = db->pre_acquire_fileops_lock(db,txna); CKERR(r);
verify_shared_ops_fail(env,db);
r = txna->commit(txna, 0); CKERR(r);
r = env->txn_begin(env, NULL, &txna, 0); CKERR(r);
r = env->txn_begin(env, NULL, &txnb, 0); CKERR(r);
r = db->pre_acquire_fileops_shared_lock(db, txna); CKERR(r);
r = db->pre_acquire_fileops_shared_lock(db, txnb); CKERR(r);
verify_excl_ops_fail(env,db);
r = txna->abort(txna); CKERR(r);
r = txnb->abort(txnb); CKERR(r);
r = env->txn_begin(env, NULL, &txna, 0); CKERR(r);
r = env->txn_begin(env, NULL, &txnb, 0); CKERR(r);
r = db->cursor(db, txna, &c1, 0); CKERR(r);
r = db->cursor(db, txnb, &c2, 0); CKERR(r);
verify_excl_ops_fail(env,db);
c1->c_close(c1);
c2->c_close(c2);
r = txna->abort(txna); CKERR(r);
r = txnb->abort(txnb); CKERR(r);
r = env->txn_begin(env, NULL, &txna, 0); CKERR(r); r = env->txn_begin(env, NULL, &txna, 0); CKERR(r);
r = env->txn_begin(env, NULL, &txnb, 0); CKERR(r); r = env->txn_begin(env, NULL, &txnb, 0); CKERR(r);
DBT key,val; DBT key,val;
...@@ -296,7 +243,7 @@ int test_main (int argc, char * const argv[]) { ...@@ -296,7 +243,7 @@ int test_main (int argc, char * const argv[]) {
dbt_init(&key, "b", 4); dbt_init(&key, "b", 4);
dbt_init(&val, "b", 4); dbt_init(&val, "b", 4);
r = db->put(db, txnb, &key, &val, 0); CKERR(r); r = db->put(db, txnb, &key, &val, 0); CKERR(r);
verify_excl_ops_fail(env,db); verify_excl_ops_fail(env,"foo.db");
r = txna->abort(txna); CKERR(r); r = txna->abort(txna); CKERR(r);
r = txnb->abort(txnb); CKERR(r); r = txnb->abort(txnb); CKERR(r);
...@@ -306,7 +253,7 @@ int test_main (int argc, char * const argv[]) { ...@@ -306,7 +253,7 @@ int test_main (int argc, char * const argv[]) {
r = db->del(db, txna, &key, DB_DELETE_ANY); CKERR(r); r = db->del(db, txna, &key, DB_DELETE_ANY); CKERR(r);
dbt_init(&key, "b", 4); dbt_init(&key, "b", 4);
r = db->del(db, txnb, &key, DB_DELETE_ANY); CKERR(r); r = db->del(db, txnb, &key, DB_DELETE_ANY); CKERR(r);
verify_excl_ops_fail(env,db); verify_excl_ops_fail(env,"foo.db");
r = txna->abort(txna); CKERR(r); r = txna->abort(txna); CKERR(r);
r = txnb->abort(txnb); CKERR(r); r = txnb->abort(txnb); CKERR(r);
...@@ -317,30 +264,17 @@ int test_main (int argc, char * const argv[]) { ...@@ -317,30 +264,17 @@ int test_main (int argc, char * const argv[]) {
r = db->update(db, txna, &key, &val, 0); CKERR(r); r = db->update(db, txna, &key, &val, 0); CKERR(r);
dbt_init(&key, "b", 4); dbt_init(&key, "b", 4);
r = db->update(db, txnb, &key, &val, 0); CKERR(r); r = db->update(db, txnb, &key, &val, 0); CKERR(r);
verify_excl_ops_fail(env,db); verify_excl_ops_fail(env,"foo.db");
r = txna->abort(txna); CKERR(r); r = txna->abort(txna); CKERR(r);
r = txnb->abort(txnb); CKERR(r); r = txnb->abort(txnb); CKERR(r);
r = env->txn_begin(env, NULL, &txna, 0); CKERR(r); r = env->txn_begin(env, NULL, &txna, 0); CKERR(r);
r = db->update_broadcast(db, txna, &val, 0); CKERR(r); r = db->update_broadcast(db, txna, &val, 0); CKERR(r);
verify_excl_ops_fail(env,db); verify_excl_ops_fail(env,"foo.db");
r = txna->abort(txna); CKERR(r); r = txna->abort(txna); CKERR(r);
r = env->txn_begin(env, NULL, &txna, 0); CKERR(r);
r = db->update_broadcast(db, txna, &val, DB_IS_RESETTING_OP); CKERR(r);
verify_shared_ops_fail(env,db);
r = txna->abort(txna); CKERR(r);
r = env->txn_begin(env, NULL, &txna, 0); CKERR(r);
r = db->change_descriptor(db, txna, &val, 0); CKERR(r);
verify_shared_ops_fail(env,db);
r = txna->abort(txna); CKERR(r);
u_int32_t flags = 0; u_int32_t flags = 0;
r = env->txn_begin(env, NULL, &txna, 0); CKERR(r); r = env->txn_begin(env, NULL, &txna, 0); CKERR(r);
r = env->txn_begin(env, NULL, &txnb, 0); CKERR(r); r = env->txn_begin(env, NULL, &txnb, 0); CKERR(r);
dbt_init(&key, "a", 4); dbt_init(&key, "a", 4);
...@@ -357,7 +291,7 @@ int test_main (int argc, char * const argv[]) { ...@@ -357,7 +291,7 @@ int test_main (int argc, char * const argv[]) {
&key, &val, &key, &val,
1, &db, &in_key, &in_val, &flags); 1, &db, &in_key, &in_val, &flags);
CKERR(r); CKERR(r);
verify_excl_ops_fail(env,db); verify_excl_ops_fail(env,"foo.db");
r = txna->abort(txna); CKERR(r); r = txna->abort(txna); CKERR(r);
r = txnb->abort(txnb); CKERR(r); r = txnb->abort(txnb); CKERR(r);
...@@ -378,7 +312,7 @@ int test_main (int argc, char * const argv[]) { ...@@ -378,7 +312,7 @@ int test_main (int argc, char * const argv[]) {
&key, &val, &key, &val,
1, &db, &in_key, &flags); 1, &db, &in_key, &flags);
CKERR(r); CKERR(r);
verify_excl_ops_fail(env,db); verify_excl_ops_fail(env,"foo.db");
r = txna->abort(txna); CKERR(r); r = txna->abort(txna); CKERR(r);
r = txnb->abort(txnb); CKERR(r); r = txnb->abort(txnb); CKERR(r);
...@@ -407,7 +341,7 @@ int test_main (int argc, char * const argv[]) { ...@@ -407,7 +341,7 @@ int test_main (int argc, char * const argv[]) {
2, in_keys, 2, in_keys,
1, &in_val); 1, &in_val);
CKERR(r); CKERR(r);
verify_excl_ops_fail(env,db); verify_excl_ops_fail(env,"foo.db");
r = txna->abort(txna); CKERR(r); r = txna->abort(txna); CKERR(r);
r = txnb->abort(txnb); CKERR(r); r = txnb->abort(txnb); CKERR(r);
......
...@@ -245,8 +245,6 @@ int toku_db_pre_acquire_table_lock(DB *db, DB_TXN *txn, BOOL just_lock); ...@@ -245,8 +245,6 @@ int toku_db_pre_acquire_table_lock(DB *db, DB_TXN *txn, BOOL just_lock);
int toku_grab_write_lock(DB *db, DBT *key, TOKUTXN tokutxn); int toku_grab_write_lock(DB *db, DBT *key, TOKUTXN tokutxn);
int toku_grab_read_lock_on_directory(DB *db, DB_TXN *txn);
#if defined(__cplusplus) #if defined(__cplusplus)
} }
#endif #endif
......
This diff is collapsed.
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