Commit 90607a26 authored by Rich Prohaska's avatar Rich Prohaska Committed by Yoni Fogel

refs #6040 turn on compiler warnings

git-svn-id: file:///svn/toku/tokudb@54565 c7de825b-a66e-492c-adef-691d508d4ae1
parent 8c389148
SRCS = $(wildcard *.c) SRCS = $(wildcard *.c)
TARGETS = $(patsubst %.c,%,$(SRCS)) $(patsubst %.c,%-bdb,$(SRCS)) TARGETS = $(patsubst %.c,%,$(SRCS)) $(patsubst %.c,%-bdb,$(SRCS))
CPPFLAGS = -I../include -D_GNU_SOURCE CPPFLAGS = -I../include -D_GNU_SOURCE
CFLAGS = -g -std=c99 -Wall CFLAGS = -g -std=c99 -Wall -Wextra -Werror -Wno-missing-field-initializers
ifeq ($(USE_STATIC_LIBS),1) ifeq ($(USE_STATIC_LIBS),1)
LIBTOKUDB = tokudb_static LIBTOKUDB = tokudb_static
LIBTOKUPORTABILITY = tokuportability_static LIBTOKUPORTABILITY = tokuportability_static
......
...@@ -69,6 +69,9 @@ static void table_init(struct table *t, int ndbs, DB **dbs, size_t key_length, s ...@@ -69,6 +69,9 @@ static void table_init(struct table *t, int ndbs, DB **dbs, size_t key_length, s
t->mult_flags = calloc(ndbs, sizeof (uint32_t)); t->mult_flags = calloc(ndbs, sizeof (uint32_t));
for (i = 0; i < ndbs; i++) for (i = 0; i < ndbs; i++)
t->mult_flags[i] = 0; t->mult_flags[i] = 0;
#else
key_length = key_length;
val_length = val_length;
#endif #endif
} }
...@@ -82,6 +85,8 @@ static void table_destroy(struct table *t) { ...@@ -82,6 +85,8 @@ static void table_destroy(struct table *t) {
table_destroy_dbt(&t->mult_vals[i]); table_destroy_dbt(&t->mult_vals[i]);
free(t->mult_vals); free(t->mult_vals);
free(t->mult_flags); free(t->mult_flags);
#else
assert(t);
#endif #endif
} }
...@@ -101,6 +106,7 @@ static long htonl64(long x) { ...@@ -101,6 +106,7 @@ static long htonl64(long x) {
#if defined(TOKUDB) #if defined(TOKUDB)
static int my_generate_row_for_put(DB *dest_db, DB *src_db, DBT *dest_key, DBT *dest_val, const DBT *src_key, const DBT *src_val) { static int my_generate_row_for_put(DB *dest_db, DB *src_db, DBT *dest_key, DBT *dest_val, const DBT *src_key, const DBT *src_val) {
assert(src_db);
assert(dest_key->flags == DB_DBT_USERMEM && dest_key->ulen >= 4 * 8); assert(dest_key->flags == DB_DBT_USERMEM && dest_key->ulen >= 4 * 8);
assert(dest_val->flags == DB_DBT_USERMEM && dest_val->ulen >= 4 * 8); assert(dest_val->flags == DB_DBT_USERMEM && dest_val->ulen >= 4 * 8);
int index_num; int index_num;
...@@ -214,6 +220,7 @@ static void insert_row(DB_ENV *db_env, struct table *t, DB_TXN *txn, long a, lon ...@@ -214,6 +220,7 @@ static void insert_row(DB_ENV *db_env, struct table *t, DB_TXN *txn, long a, lon
r = db_env->put_multiple(db_env, t->dbs[0], txn, &key, &value, t->ndbs, &t->dbs[0], t->mult_keys, t->mult_vals, t->mult_flags); assert(r == 0); r = db_env->put_multiple(db_env, t->dbs[0], txn, &key, &value, t->ndbs, &t->dbs[0], t->mult_keys, t->mult_vals, t->mult_flags); assert(r == 0);
} }
#else #else
assert(db_env);
r = t->dbs[0]->put(t->dbs[0], txn, &key, &value, 0); assert(r == 0); r = t->dbs[0]->put(t->dbs[0], txn, &key, &value, 0); assert(r == 0);
#endif #endif
} }
...@@ -283,7 +290,9 @@ int main(int argc, char *argv[]) { ...@@ -283,7 +290,9 @@ int main(int argc, char *argv[]) {
u_int32_t pagesize = 0; u_int32_t pagesize = 0;
u_int64_t cachesize = 1000000000; u_int64_t cachesize = 1000000000;
int ndbs = 4; int ndbs = 4;
#if defined(TOKUDB)
u_int32_t checkpoint_period = 60; u_int32_t checkpoint_period = 60;
#endif
int i; int i;
for (i = 1; i < argc; i++) { for (i = 1; i < argc; i++) {
...@@ -328,10 +337,12 @@ int main(int argc, char *argv[]) { ...@@ -328,10 +337,12 @@ int main(int argc, char *argv[]) {
force_multiple = atoi(argv[++i]); force_multiple = atoi(argv[++i]);
continue; continue;
} }
#if defined(TOKUDB)
if (strcmp(arg, "--checkpoint_period") == 0 && i+1 < argc) { if (strcmp(arg, "--checkpoint_period") == 0 && i+1 < argc) {
checkpoint_period = atoi(argv[++i]); checkpoint_period = atoi(argv[++i]);
continue; continue;
} }
#endif
assert(0); assert(0);
} }
......
...@@ -25,7 +25,7 @@ static size_t val_size = 8; ...@@ -25,7 +25,7 @@ static size_t val_size = 8;
static int verbose = 0; static int verbose = 0;
static void db_error(const DB_ENV *env, const char *prefix, const char *msg) { static void db_error(const DB_ENV *env, const char *prefix, const char *msg) {
printf("%s: %s\n", __FUNCTION__, msg); printf("%s: %p %s %s\n", __FUNCTION__, env, prefix, msg);
} }
static int get_int(void *p) { static int get_int(void *p) {
...@@ -36,6 +36,8 @@ static int get_int(void *p) { ...@@ -36,6 +36,8 @@ static int get_int(void *p) {
#if defined(TOKUDB) #if defined(TOKUDB)
static int my_update_callback(DB *db, const DBT *key, const DBT *old_val, const DBT *extra, void (*set_val)(const DBT *new_val, void *set_extra), void *set_extra) { static int my_update_callback(DB *db, const DBT *key, const DBT *old_val, const DBT *extra, void (*set_val)(const DBT *new_val, void *set_extra), void *set_extra) {
assert(db);
assert(key);
if (old_val == NULL) { if (old_val == NULL) {
// insert new_val = extra // insert new_val = extra
set_val(extra, set_extra); set_val(extra, set_extra);
...@@ -54,7 +56,10 @@ static int my_update_callback(DB *db, const DBT *key, const DBT *old_val, const ...@@ -54,7 +56,10 @@ static int my_update_callback(DB *db, const DBT *key, const DBT *old_val, const
} }
#endif #endif
static void insert_and_update(DB_ENV *db_env, DB *db, DB_TXN *txn, int a, int b, int c, int d, bool do_update_callback) { static void insert_and_update(DB *db, DB_TXN *txn, int a, int b, int c, int d, bool do_update_callback) {
#if !defined(TOKUDB)
assert(!do_update_callback);
#endif
int r; int r;
// generate the key // generate the key
...@@ -122,7 +127,7 @@ static void insert_and_update_all(DB_ENV *db_env, DB *db, long nrows, long max_r ...@@ -122,7 +127,7 @@ static void insert_and_update_all(DB_ENV *db_env, DB *db, long nrows, long max_r
int b = random() % key_range; int b = random() % key_range;
int c = 1; int c = 1;
int d = 0; // timestamp int d = 0; // timestamp
insert_and_update(db_env, db, txn, a, b, c, d, do_update_callback); insert_and_update(db, txn, a, b, c, d, do_update_callback);
n_rows_per_txn++; n_rows_per_txn++;
// maybe commit // maybe commit
...@@ -163,11 +168,17 @@ int main(int argc, char *argv[]) { ...@@ -163,11 +168,17 @@ int main(int argc, char *argv[]) {
long rows_per_txn = 100; long rows_per_txn = 100;
long rows_per_report = 100000; long rows_per_report = 100000;
int key_range = 1000000; int key_range = 1000000;
#if defined(TOKUDB)
bool do_update_callback = true; bool do_update_callback = true;
#else
bool do_update_callback = false;
#endif
bool do_txn = false; bool do_txn = false;
u_int64_t cachesize = 1000000000; u_int64_t cachesize = 1000000000;
u_int32_t pagesize = 0; u_int32_t pagesize = 0;
#if defined(TOKUDB)
u_int32_t checkpoint_period = 60; u_int32_t checkpoint_period = 60;
#endif
int i; int i;
for (i = 1; i < argc; i++) { for (i = 1; i < argc; i++) {
...@@ -216,10 +227,12 @@ int main(int argc, char *argv[]) { ...@@ -216,10 +227,12 @@ int main(int argc, char *argv[]) {
val_size = atoi(argv[++i]); val_size = atoi(argv[++i]);
continue; continue;
} }
#if defined(TOKUDB)
if (strcmp(arg, "--checkpoint_period") == 0 && i+1 < argc) { if (strcmp(arg, "--checkpoint_period") == 0 && i+1 < argc) {
checkpoint_period = atoi(argv[++i]); checkpoint_period = atoi(argv[++i]);
continue; continue;
} }
#endif
assert(0); assert(0);
} }
......
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