Commit fd6bf4a6 authored by Yoni Fogel's avatar Yoni Fogel

refs #25. Fix (test-only) bug where db_env_set_toku_product_name would not...

refs #25.  Fix (test-only) bug where db_env_set_toku_product_name would not get called for some tests because they were lower than ydb layer
parent 78540c6d
...@@ -6209,6 +6209,8 @@ int toku_ft_layer_init(void) { ...@@ -6209,6 +6209,8 @@ int toku_ft_layer_init(void) {
//Portability must be initialized first //Portability must be initialized first
r = toku_portability_init(); r = toku_portability_init();
if (r) { goto exit; } if (r) { goto exit; }
r = db_env_set_toku_product_name("tokudb");
if (r) { goto exit; }
partitioned_counters_init(); partitioned_counters_init();
status_init(); status_init();
......
...@@ -1170,3 +1170,22 @@ toku_single_process_unlock(int *lockfd) { ...@@ -1170,3 +1170,22 @@ toku_single_process_unlock(int *lockfd) {
return 0; return 0;
} }
int tokudb_num_envs = 0;
int
db_env_set_toku_product_name(const char *name) {
if (tokudb_num_envs > 0) {
return EINVAL;
}
if (!name || strlen(name) < 1) {
return EINVAL;
}
if (strlen(name) >= sizeof(toku_product_name)) {
return ENAMETOOLONG;
}
if (strncmp(toku_product_name, name, sizeof(toku_product_name))) {
strcpy(toku_product_name, name);
tokudb_update_product_name_strings();
}
return 0;
}
...@@ -215,4 +215,5 @@ struct toku_product_name_strings_struct { ...@@ -215,4 +215,5 @@ struct toku_product_name_strings_struct {
}; };
extern struct toku_product_name_strings_struct toku_product_name_strings; extern struct toku_product_name_strings_struct toku_product_name_strings;
extern int tokudb_num_envs;
#endif #endif
...@@ -238,9 +238,6 @@ toku_ydb_init(void) { ...@@ -238,9 +238,6 @@ toku_ydb_init(void) {
int r = 0; int r = 0;
//Lower level must be initialized first. //Lower level must be initialized first.
r = toku_ft_layer_init(); r = toku_ft_layer_init();
if (r!=0) goto exit;
r = db_env_set_toku_product_name("tokudb");
exit:
return r; return r;
} }
...@@ -2230,8 +2227,6 @@ env_get_cursor_for_directory(DB_ENV* env, DB_TXN* txn, DBC** c) { ...@@ -2230,8 +2227,6 @@ env_get_cursor_for_directory(DB_ENV* env, DB_TXN* txn, DBC** c) {
return toku_db_cursor(env->i->directory, txn, c, 0); return toku_db_cursor(env->i->directory, txn, c, 0);
} }
int tokudb_num_envs = 0;
static int static int
toku_env_create(DB_ENV ** envp, uint32_t flags) { toku_env_create(DB_ENV ** envp, uint32_t flags) {
int r = ENOSYS; int r = ENOSYS;
......
...@@ -226,21 +226,3 @@ db_env_set_num_bucket_mutexes(uint32_t num_mutexes) { ...@@ -226,21 +226,3 @@ db_env_set_num_bucket_mutexes(uint32_t num_mutexes) {
toku_pair_list_set_lock_size(num_mutexes); toku_pair_list_set_lock_size(num_mutexes);
} }
int
db_env_set_toku_product_name(const char *name) {
if (tokudb_num_envs > 0) {
return EINVAL;
}
if (!name || strlen(name) < 1) {
return EINVAL;
}
if (strlen(name) >= sizeof(toku_product_name)) {
return ENAMETOOLONG;
}
if (strncmp(toku_product_name, name, sizeof(toku_product_name))) {
strcpy(toku_product_name, name);
tokudb_update_product_name_strings();
}
return 0;
}
...@@ -105,6 +105,4 @@ void setup_dlmalloc(void) __attribute__((__visibility__("default"))); ...@@ -105,6 +105,4 @@ void setup_dlmalloc(void) __attribute__((__visibility__("default")));
// Test-only function // Test-only function
void toku_env_increase_last_xid(DB_ENV *env, uint64_t increment); void toku_env_increase_last_xid(DB_ENV *env, uint64_t increment);
extern int tokudb_num_envs;
#endif #endif
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