Commit d10c9482 authored by Zardosht Kasheff's avatar Zardosht Kasheff Committed by Yoni Fogel

[t:4927], remove tabs from files in src

git-svn-id: file:///svn/toku/tokudb@43841 c7de825b-a66e-492c-adef-691d508d4ae1
parent 51dacb89
......@@ -35,9 +35,9 @@
static INDEXER_STATUS_S indexer_status;
#define STATUS_INIT(k,t,l) { \
indexer_status.status[k].keyname = #k; \
indexer_status.status[k].type = t; \
indexer_status.status[k].legend = "indexer: " l; \
indexer_status.status[k].keyname = #k; \
indexer_status.status[k].type = t; \
indexer_status.status[k].legend = "indexer: " l; \
}
static void
......@@ -60,7 +60,7 @@ status_init(void) {
void
toku_indexer_get_status(INDEXER_STATUS statp) {
if (!indexer_status.initialized)
status_init();
status_init();
*statp = indexer_status;
}
......@@ -84,14 +84,14 @@ static int
associate_indexer_with_hot_dbs(DB_INDEXER *indexer, DB *dest_dbs[], int N) {
int result =0;
for (int i = 0; i < N; i++) {
result = toku_db_set_indexer(dest_dbs[i], indexer);
if (result != 0) {
for (int j = 0; j < i; j++) {
int result2 = toku_db_set_indexer(dest_dbs[j], NULL);
lazy_assert(result2 == 0);
}
result = toku_db_set_indexer(dest_dbs[i], indexer);
if (result != 0) {
for (int j = 0; j < i; j++) {
int result2 = toku_db_set_indexer(dest_dbs[j], NULL);
lazy_assert(result2 == 0);
}
break;
}
}
}
return result;
}
......@@ -99,8 +99,8 @@ associate_indexer_with_hot_dbs(DB_INDEXER *indexer, DB *dest_dbs[], int N) {
static void
disassociate_indexer_from_hot_dbs(DB_INDEXER *indexer) {
for (int i = 0; i < indexer->i->N; i++) {
int result = toku_db_set_indexer(indexer->i->dest_dbs[i], NULL);
lazy_assert(result == 0);
int result = toku_db_set_indexer(indexer->i->dest_dbs[i], NULL);
lazy_assert(result == 0);
}
}
......@@ -215,13 +215,13 @@ create_exit:
*indexerp = indexer;
(void) __sync_fetch_and_add(&STATUS_VALUE(INDEXER_CREATE), 1);
(void) __sync_fetch_and_add(&STATUS_VALUE(INDEXER_CURRENT), 1);
(void) __sync_fetch_and_add(&STATUS_VALUE(INDEXER_CREATE), 1);
(void) __sync_fetch_and_add(&STATUS_VALUE(INDEXER_CURRENT), 1);
if ( STATUS_VALUE(INDEXER_CURRENT) > STATUS_VALUE(INDEXER_MAX) )
STATUS_VALUE(INDEXER_MAX) = STATUS_VALUE(INDEXER_CURRENT); // NOT WORTH A LOCK TO MAKE THREADSAFE), may be inaccurate
STATUS_VALUE(INDEXER_MAX) = STATUS_VALUE(INDEXER_CURRENT); // NOT WORTH A LOCK TO MAKE THREADSAFE), may be inaccurate
} else {
(void) __sync_fetch_and_add(&STATUS_VALUE(INDEXER_CREATE_FAIL), 1);
(void) __sync_fetch_and_add(&STATUS_VALUE(INDEXER_CREATE_FAIL), 1);
free_indexer(indexer);
}
......@@ -271,11 +271,11 @@ build_index(DB_INDEXER *indexer) {
toku_ydb_lock();
result = le_cursor_next(indexer->i->lec, &le);
if (result != 0) {
done = TRUE;
if (result == DB_NOTFOUND)
result = 0; // all done, normal way to exit loop successfully
}
if (result != 0) {
done = TRUE;
if (result == DB_NOTFOUND)
result = 0; // all done, normal way to exit loop successfully
}
else {
// this code may be faster ule malloc/free is not done every time
ULEHANDLE ule = toku_ule_create(le.data);
......@@ -297,8 +297,8 @@ build_index(DB_INDEXER *indexer) {
if (result == 0)
result = maybe_call_poll_func(indexer, loop_count);
if (result != 0)
done = TRUE;
if (result != 0)
done = TRUE;
}
toku_destroy_dbt(&key);
......@@ -312,7 +312,7 @@ build_index(DB_INDEXER *indexer) {
if ( result == 0 ) {
(void) __sync_fetch_and_add(&STATUS_VALUE(INDEXER_BUILD), 1);
} else {
(void) __sync_fetch_and_add(&STATUS_VALUE(INDEXER_BUILD_FAIL), 1);
(void) __sync_fetch_and_add(&STATUS_VALUE(INDEXER_BUILD_FAIL), 1);
}
......@@ -349,7 +349,7 @@ close_indexer(DB_INDEXER *indexer) {
if ( r == 0 ) {
(void) __sync_fetch_and_add(&STATUS_VALUE(INDEXER_CLOSE), 1);
} else {
(void) __sync_fetch_and_add(&STATUS_VALUE(INDEXER_CLOSE_FAIL), 1);
(void) __sync_fetch_and_add(&STATUS_VALUE(INDEXER_CLOSE_FAIL), 1);
}
return r;
}
......
......@@ -43,9 +43,9 @@ enum {MAX_FILE_SIZE=256};
static LOADER_STATUS_S loader_status;
#define STATUS_INIT(k,t,l) { \
loader_status.status[k].keyname = #k; \
loader_status.status[k].type = t; \
loader_status.status[k].legend = "loader: " l; \
loader_status.status[k].keyname = #k; \
loader_status.status[k].type = t; \
loader_status.status[k].legend = "loader: " l; \
}
static void
......@@ -68,7 +68,7 @@ status_init(void) {
void
toku_loader_get_status(LOADER_STATUS statp) {
if (!loader_status.initialized)
status_init();
status_init();
*statp = loader_status;
}
......@@ -338,7 +338,7 @@ int toku_loader_create_loader(DB_ENV *env,
int toku_loader_set_poll_function(DB_LOADER *loader,
int (*poll_func)(void *extra, float progress),
void *poll_extra)
void *poll_extra)
{
invariant(loader != NULL);
loader->i->poll_func = poll_func;
......@@ -348,7 +348,7 @@ int toku_loader_set_poll_function(DB_LOADER *loader,
int toku_loader_set_error_callback(DB_LOADER *loader,
void (*error_cb)(DB *db, int i, int err, DBT *key, DBT *val, void *extra),
void *error_extra)
void *error_extra)
{
invariant(loader != NULL);
loader->i->error_callback = error_cb;
......@@ -367,7 +367,7 @@ int toku_loader_put(DB_LOADER *loader, DBT *key, DBT *val)
// skip put if error already found
if ( loader->i->err_errno != 0 ) {
r = -1;
goto cleanup;
goto cleanup;
}
if (loader->i->loader_flags & LOADER_USE_PUTS) {
......@@ -407,9 +407,9 @@ int toku_loader_put(DB_LOADER *loader, DBT *key, DBT *val)
}
cleanup:
if (r==0)
STATUS_VALUE(LOADER_PUT)++; // executed too often to be worth making threadsafe
STATUS_VALUE(LOADER_PUT)++; // executed too often to be worth making threadsafe
else
STATUS_VALUE(LOADER_PUT_FAIL)++;
STATUS_VALUE(LOADER_PUT_FAIL)++;
return r;
}
......@@ -437,9 +437,9 @@ int toku_loader_close(DB_LOADER *loader)
free_loader(loader);
toku_ydb_unlock();
if (r==0)
(void) __sync_fetch_and_add(&STATUS_VALUE(LOADER_CLOSE), 1);
(void) __sync_fetch_and_add(&STATUS_VALUE(LOADER_CLOSE), 1);
else
(void) __sync_fetch_and_add(&STATUS_VALUE(LOADER_CLOSE_FAIL), 1);
(void) __sync_fetch_and_add(&STATUS_VALUE(LOADER_CLOSE_FAIL), 1);
return r;
}
......
This diff is collapsed.
......@@ -87,17 +87,17 @@ static char *
create_iname(DB_ENV *env, u_int64_t id, char *hint, char *mark, int n) {
int bytes;
char inamebase[strlen(hint) +
8 + // hex file format version
16 + // hex id (normally the txnid)
8 + // hex value of n if non-neg
sizeof("_B___.tokudb")]; // extra pieces
8 + // hex file format version
16 + // hex id (normally the txnid)
8 + // hex value of n if non-neg
sizeof("_B___.tokudb")]; // extra pieces
if (n < 0)
bytes = snprintf(inamebase, sizeof(inamebase),
bytes = snprintf(inamebase, sizeof(inamebase),
"%s_%"PRIx64"_%"PRIx32 ".tokudb",
hint, id, FT_LAYOUT_VERSION);
else {
invariant(strlen(mark) == 1);
bytes = snprintf(inamebase, sizeof(inamebase),
invariant(strlen(mark) == 1);
bytes = snprintf(inamebase, sizeof(inamebase),
"%s_%"PRIx64"_%"PRIx32"_%s_%"PRIx32".tokudb",
hint, id, FT_LAYOUT_VERSION, mark, n);
}
......@@ -413,9 +413,9 @@ db_open_iname(DB * db, DB_TXN * txn, const char *iname_in_env, u_int32_t flags,
FT_HANDLE brt = db->i->ft_handle;
r = toku_ft_handle_open(brt, iname_in_env,
is_db_create, is_db_excl,
db->dbenv->i->cachetable,
txn ? db_txn_struct_i(txn)->tokutxn : NULL_TXN);
is_db_create, is_db_excl,
db->dbenv->i->cachetable,
txn ? db_txn_struct_i(txn)->tokutxn : NULL_TXN);
if (r != 0)
goto error_cleanup;
......@@ -429,7 +429,7 @@ db_open_iname(DB * db, DB_TXN * txn, const char *iname_in_env, u_int32_t flags,
db->cmp_descriptor = &brt->ft->cmp_descriptor;
if (need_locktree) {
db->i->dict_id = toku_ft_get_dictionary_id(db->i->ft_handle);
db->i->dict_id = toku_ft_get_dictionary_id(db->i->ft_handle);
r = toku_ltm_get_lt(db->dbenv->i->ltm, &db->i->lt, db->i->dict_id, db->cmp_descriptor, toku_ft_get_bt_compare(db->i->ft_handle));
if (r!=0) { goto error_cleanup; }
}
......@@ -471,9 +471,9 @@ int toku_db_pre_acquire_fileops_lock(DB *db, DB_TXN *txn) {
//Left end of range == right end of range (point lock)
int r = get_range_lock(db->dbenv->i->directory, txn, &key_in_directory, &key_in_directory, LOCK_REQUEST_WRITE);
if (r == 0)
STATUS_VALUE(YDB_LAYER_DIRECTORY_WRITE_LOCKS)++; // accountability
STATUS_VALUE(YDB_LAYER_DIRECTORY_WRITE_LOCKS)++; // accountability
else
STATUS_VALUE(YDB_LAYER_DIRECTORY_WRITE_LOCKS_FAIL)++; // accountability
STATUS_VALUE(YDB_LAYER_DIRECTORY_WRITE_LOCKS_FAIL)++; // accountability
return r;
}
......@@ -934,31 +934,31 @@ ydb_load_inames(DB_ENV * env, DB_TXN * txn, int N, DB * dbs[N], char * new_iname
char * mark;
if (mark_as_loader)
mark = "B";
mark = "B";
else
mark = "P";
mark = "P";
for (i=0; i<N; i++) {
new_inames_in_env[i] = NULL;
new_inames_in_env[i] = NULL;
}
// begin child (unless transactionless)
if (using_txns) {
rval = toku_txn_begin(env, txn, &child, DB_TXN_NOSYNC, 1, true);
assert(rval == 0);
xid = toku_txn_get_txnid(db_txn_struct_i(child)->tokutxn);
rval = toku_txn_begin(env, txn, &child, DB_TXN_NOSYNC, 1, true);
assert(rval == 0);
xid = toku_txn_get_txnid(db_txn_struct_i(child)->tokutxn);
}
for (i = 0; i < N; i++) {
char * dname = dbs[i]->i->dname;
toku_fill_dbt(&dname_dbt, dname, strlen(dname)+1);
// now create new iname
char hint[strlen(dname) + 1];
create_iname_hint(dname, hint);
char * new_iname = create_iname(env, xid, hint, mark, i); // allocates memory for iname_in_env
new_inames_in_env[i] = new_iname;
char * dname = dbs[i]->i->dname;
toku_fill_dbt(&dname_dbt, dname, strlen(dname)+1);
// now create new iname
char hint[strlen(dname) + 1];
create_iname_hint(dname, hint);
char * new_iname = create_iname(env, xid, hint, mark, i); // allocates memory for iname_in_env
new_inames_in_env[i] = new_iname;
toku_fill_dbt(&iname_dbt, new_iname, strlen(new_iname) + 1); // iname_in_env goes in directory
rval = toku_db_put(env->i->directory, child, &dname_dbt, &iname_dbt, 0, TRUE);
if (rval) break;
if (rval) break;
}
// Generate load log entries.
......@@ -977,23 +977,23 @@ ydb_load_inames(DB_ENV * env, DB_TXN * txn, int N, DB * dbs[N], char * new_iname
if (rval) break;
}
}
if (using_txns) {
// close txn
if (rval == 0) { // all well so far, commit child
rval = toku_txn_commit(child, DB_TXN_NOSYNC, NULL, NULL, false);
assert(rval==0);
}
else { // abort child
int r2 = toku_txn_abort(child, NULL, NULL, false);
assert(r2==0);
for (i=0; i<N; i++) {
if (new_inames_in_env[i]) {
toku_free(new_inames_in_env[i]);
new_inames_in_env[i] = NULL;
}
}
}
// close txn
if (rval == 0) { // all well so far, commit child
rval = toku_txn_commit(child, DB_TXN_NOSYNC, NULL, NULL, false);
assert(rval==0);
}
else { // abort child
int r2 = toku_txn_abort(child, NULL, NULL, false);
assert(r2==0);
for (i=0; i<N; i++) {
if (new_inames_in_env[i]) {
toku_free(new_inames_in_env[i]);
new_inames_in_env[i] = NULL;
}
}
}
}
return rval;
......
......@@ -200,10 +200,10 @@ toku_db_put(DB *db, DB_TXN *txn, DBT *key, DBT *val, u_int32_t flags, BOOL holds
if (r == 0) {
// helgrind flags a race on this status update. we increment it atomically to satisfy helgrind.
// STATUS_VALUE(YDB_LAYER_NUM_INSERTS)++; // accountability
// STATUS_VALUE(YDB_LAYER_NUM_INSERTS)++; // accountability
(void) __sync_fetch_and_add(&STATUS_VALUE(YDB_LAYER_NUM_INSERTS), 1);
} else {
// STATUS_VALUE(YDB_LAYER_NUM_INSERTS_FAIL)++; // accountability
// STATUS_VALUE(YDB_LAYER_NUM_INSERTS_FAIL)++; // accountability
(void) __sync_fetch_and_add(&STATUS_VALUE(YDB_LAYER_NUM_INSERTS_FAIL), 1);
}
......@@ -239,9 +239,9 @@ toku_db_update(DB *db, DB_TXN *txn,
cleanup:
if (r == 0)
STATUS_VALUE(YDB_LAYER_NUM_UPDATES)++; // accountability
STATUS_VALUE(YDB_LAYER_NUM_UPDATES)++; // accountability
else
STATUS_VALUE(YDB_LAYER_NUM_UPDATES_FAIL)++; // accountability
STATUS_VALUE(YDB_LAYER_NUM_UPDATES_FAIL)++; // accountability
return r;
}
......@@ -294,9 +294,9 @@ toku_db_update_broadcast(DB *db, DB_TXN *txn,
cleanup:
if (r == 0)
STATUS_VALUE(YDB_LAYER_NUM_UPDATES_BROADCAST)++; // accountability
STATUS_VALUE(YDB_LAYER_NUM_UPDATES_BROADCAST)++; // accountability
else
STATUS_VALUE(YDB_LAYER_NUM_UPDATES_BROADCAST_FAIL)++; // accountability
STATUS_VALUE(YDB_LAYER_NUM_UPDATES_BROADCAST_FAIL)++; // accountability
return r;
}
......@@ -351,9 +351,9 @@ do_del_multiple(DB_TXN *txn, uint32_t num_dbs, DB *db_array[], DBT keys[], DB *s
// if db is being indexed by an indexer, then insert a delete message into the db if the src key is to the left or equal to the
// indexers cursor. we have to get the src_db from the indexer and find it in the db_array.
int do_delete = TRUE;
DB_INDEXER *indexer = toku_db_get_indexer(db);
if (indexer) { // if this db is the index under construction
int do_delete = TRUE;
DB_INDEXER *indexer = toku_db_get_indexer(db);
if (indexer) { // if this db is the index under construction
DB *indexer_src_db = toku_indexer_get_src_db(indexer);
invariant(indexer_src_db != NULL);
const DBT *indexer_src_key;
......@@ -366,7 +366,7 @@ do_del_multiple(DB_TXN *txn, uint32_t num_dbs, DB *db_array[], DBT keys[], DB *s
}
do_delete = !toku_indexer_is_key_right_of_le_cursor(indexer, indexer_src_db, indexer_src_key);
}
if (r == 0 && do_delete) {
if (r == 0 && do_delete) {
r = toku_ft_maybe_delete(db->i->ft_handle, &keys[which_db], ttxn, FALSE, ZERO_LSN, FALSE);
}
}
......@@ -455,9 +455,9 @@ env_del_multiple(
cleanup:
if (r == 0)
STATUS_VALUE(YDB_LAYER_NUM_MULTI_DELETES) += num_dbs; // accountability
STATUS_VALUE(YDB_LAYER_NUM_MULTI_DELETES) += num_dbs; // accountability
else
STATUS_VALUE(YDB_LAYER_NUM_MULTI_DELETES_FAIL) += num_dbs; // accountability
STATUS_VALUE(YDB_LAYER_NUM_MULTI_DELETES_FAIL) += num_dbs; // accountability
return r;
}
......@@ -488,9 +488,9 @@ do_put_multiple(DB_TXN *txn, uint32_t num_dbs, DB *db_array[], DBT keys[], DBT v
// if db is being indexed by an indexer, then put into that db if the src key is to the left or equal to the
// indexers cursor. we have to get the src_db from the indexer and find it in the db_array.
int do_put = TRUE;
DB_INDEXER *indexer = toku_db_get_indexer(db);
if (indexer) { // if this db is the index under construction
int do_put = TRUE;
DB_INDEXER *indexer = toku_db_get_indexer(db);
if (indexer) { // if this db is the index under construction
DB *indexer_src_db = toku_indexer_get_src_db(indexer);
invariant(indexer_src_db != NULL);
const DBT *indexer_src_key;
......@@ -600,9 +600,9 @@ env_put_multiple_internal(
cleanup:
if (r == 0)
STATUS_VALUE(YDB_LAYER_NUM_MULTI_INSERTS) += num_dbs; // accountability
STATUS_VALUE(YDB_LAYER_NUM_MULTI_INSERTS) += num_dbs; // accountability
else
STATUS_VALUE(YDB_LAYER_NUM_MULTI_INSERTS_FAIL) += num_dbs; // accountability
STATUS_VALUE(YDB_LAYER_NUM_MULTI_INSERTS_FAIL) += num_dbs; // accountability
return r;
}
......@@ -755,9 +755,9 @@ env_update_multiple(DB_ENV *env, DB *src_db, DB_TXN *txn,
cleanup:
if (r == 0)
STATUS_VALUE(YDB_LAYER_NUM_MULTI_UPDATES) += num_dbs; // accountability
STATUS_VALUE(YDB_LAYER_NUM_MULTI_UPDATES) += num_dbs; // accountability
else
STATUS_VALUE(YDB_LAYER_NUM_MULTI_UPDATES_FAIL) += num_dbs; // accountability
STATUS_VALUE(YDB_LAYER_NUM_MULTI_UPDATES_FAIL) += num_dbs; // accountability
return r;
}
......
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