Commit 4d77e57f authored by Yoni Fogel's avatar Yoni Fogel

Refs Tokutek/ft-engine#40 Rename c_restrict_to_range to c_set_bounds, delete...

Refs Tokutek/ft-engine#40 Rename c_restrict_to_range to c_set_bounds, delete c_pre_acquire_range_lock
parent 389c07f3
......@@ -592,8 +592,7 @@ static void print_dbc_struct (void) {
"int (*c_getf_set)(DBC *, uint32_t, DBT *, YDB_CALLBACK_FUNCTION, void *)",
"int (*c_getf_set_range)(DBC *, uint32_t, DBT *, YDB_CALLBACK_FUNCTION, void *)",
"int (*c_getf_set_range_reverse)(DBC *, uint32_t, DBT *, YDB_CALLBACK_FUNCTION, void *)",
"int (*c_pre_acquire_range_lock)(DBC*, const DBT*, const DBT*)",
"int (*c_restrict_to_range)(DBC*, const DBT*, const DBT*, bool pre_acquire, int out_of_range_error)",
"int (*c_set_bounds)(DBC*, const DBT*, const DBT*, bool pre_acquire, int out_of_range_error)",
"void (*c_remove_restriction)(DBC*)",
NULL};
sort_and_dump_fields("dbc", false, extra);
......
......@@ -104,7 +104,7 @@ static void blocking_range_lock(DB_ENV *db_env, DB *db, uint64_t nrows, long sle
uint64_t k = 0;
DBT key = { .data = &k, .size = sizeof k};
r = cursor->c_pre_acquire_range_lock(cursor, &key, &key); assert(r == 0);
r = cursor->c_set_bounds(cursor, &key, &key, true, 0); assert(r == 0);
usleep(sleeptime);
......
......@@ -119,7 +119,7 @@ static void test_del_rmw(DB_ENV *env, DB *db, uint32_t t1_flags, uint32_t t2_fla
DBC *c2 = NULL;
r = db->cursor(db, txn2, &c2, c2_flags); assert_zero(r);
r = c1->c_pre_acquire_range_lock(c1, db->dbt_neg_infty(), db->dbt_pos_infty()); assert_zero(r);
r = c1->c_set_bounds(c1, db->dbt_neg_infty(), db->dbt_pos_infty(), true, 0); assert_zero(r);
int k = htonl(2);
DBT key; dbt_init(&key, &k, sizeof k);
......
......@@ -376,7 +376,7 @@ static void iibench_rangequery_db(DB *db, DB_TXN *txn, ARG arg, uint64_t max_pk)
dbt_init(&end_key, &end_k, 8);
r = db->cursor(db, txn, &cursor, 0); CKERR(r);
r = cursor->c_pre_acquire_range_lock(cursor, &start_key, &end_key); CKERR(r);
r = cursor->c_set_bounds(cursor, &start_key, &end_key, true, 0); CKERR(r);
struct rangequery_cb_extra extra = {
.rows_read = 0,
.limit = limit,
......
......@@ -94,7 +94,7 @@ PATENT RIGHTS GRANT:
static int prelock_range(DBC *cursor, int left, int right) {
DBT key_left; dbt_init(&key_left, &left, sizeof left);
DBT key_right; dbt_init(&key_right, &right, sizeof right);
int r = cursor->c_pre_acquire_range_lock(cursor, &key_left, &key_right);
int r = cursor->c_set_bounds(cursor, &key_left, &key_right, true, 0);
return r;
}
......
......@@ -94,7 +94,7 @@ PATENT RIGHTS GRANT:
static int prelock_range(DBC *cursor, int left, int right) {
DBT key_left; dbt_init(&key_left, &left, sizeof left);
DBT key_right; dbt_init(&key_right, &right, sizeof right);
int r = cursor->c_pre_acquire_range_lock(cursor, &key_left, &key_right);
int r = cursor->c_set_bounds(cursor, &key_left, &key_right, true, 0);
return r;
}
......
......@@ -94,7 +94,7 @@ PATENT RIGHTS GRANT:
static int prelock_range(DBC *cursor, int left, int right) {
DBT key_left; dbt_init(&key_left, &left, sizeof left);
DBT key_right; dbt_init(&key_right, &right, sizeof right);
int r = cursor->c_pre_acquire_range_lock(cursor, &key_left, &key_right);
int r = cursor->c_set_bounds(cursor, &key_left, &key_right, true, 0);
return r;
}
......
......@@ -94,7 +94,7 @@ PATENT RIGHTS GRANT:
static int prelock_range(DBC *cursor, int left, int right) {
DBT key_left; dbt_init(&key_left, &left, sizeof left);
DBT key_right; dbt_init(&key_right, &right, sizeof right);
int r = cursor->c_pre_acquire_range_lock(cursor, &key_left, &key_right);
int r = cursor->c_set_bounds(cursor, &key_left, &key_right, true, 0);
return r;
}
......
......@@ -230,10 +230,12 @@ test_bulk_fetch (uint64_t n, bool prelock, bool disable_prefetching) {
r = db->cursor(db, NULL, &cursor, flags);
CKERR(r);
if (prelock) {
r = cursor->c_pre_acquire_range_lock(
r = cursor->c_set_bounds(
cursor,
db->dbt_neg_infty(),
db->dbt_pos_infty()
db->dbt_pos_infty(),
true,
0
);
CKERR(r);
}
......@@ -257,10 +259,12 @@ test_bulk_fetch (uint64_t n, bool prelock, bool disable_prefetching) {
r = db->cursor(db, NULL, &cursor, flags);
CKERR(r);
if (prelock) {
r = cursor->c_pre_acquire_range_lock(
r = cursor->c_set_bounds(
cursor,
db->dbt_neg_infty(),
db->dbt_pos_infty()
db->dbt_pos_infty(),
true,
0
);
CKERR(r);
}
......@@ -284,10 +288,12 @@ test_bulk_fetch (uint64_t n, bool prelock, bool disable_prefetching) {
r = db->cursor(db, NULL, &cursor, flags);
CKERR(r);
if (prelock) {
r = cursor->c_pre_acquire_range_lock(
r = cursor->c_set_bounds(
cursor,
db->dbt_neg_infty(),
db->dbt_pos_infty()
db->dbt_pos_infty(),
true,
0
);
CKERR(r);
}
......@@ -311,10 +317,12 @@ test_bulk_fetch (uint64_t n, bool prelock, bool disable_prefetching) {
r = db->cursor(db, NULL, &cursor, flags);
CKERR(r);
if (prelock) {
r = cursor->c_pre_acquire_range_lock(
r = cursor->c_set_bounds(
cursor,
db->dbt_neg_infty(),
db->dbt_pos_infty()
db->dbt_pos_infty(),
true,
0
);
CKERR(r);
}
......
......@@ -196,10 +196,12 @@ static void do_inserts_and_queries(DB* db) {
r = db->cursor(db, read_txn, &cursor, 0);
CKERR(r);
if (i == 0) {
r = cursor->c_pre_acquire_range_lock(
r = cursor->c_set_bounds(
cursor,
db->dbt_neg_infty(),
db->dbt_pos_infty()
db->dbt_pos_infty(),
true,
0
);
CKERR(r);
}
......
......@@ -122,10 +122,12 @@ test_cursor (void) {
DB_TXN* txn = NULL;
r = env->txn_begin(env, NULL, &txn, DB_SERIALIZABLE); CKERR(r);
r = db->cursor(db, txn, &cursor, 0); CKERR(r);
r = cursor->c_pre_acquire_range_lock(
r = cursor->c_set_bounds(
cursor,
db->dbt_neg_infty(),
db->dbt_pos_infty()
db->dbt_pos_infty(),
true,
0
);
r = cursor->c_close(cursor); CKERR(r);
r = db->close(db, 0); CKERR(r);
......
......@@ -145,7 +145,7 @@ test_restrict (int64_t n, int error_to_expect) {
dbt_init(&dbt_left, &keys[int_left], sizeof keys[int_left]);
dbt_init(&dbt_right, &keys[int_right], sizeof keys[int_right]);
r = cursor->c_restrict_to_range(
r = cursor->c_set_bounds(
cursor,
&dbt_left,
&dbt_right,
......
......@@ -666,7 +666,7 @@ static int scan_op_and_maybe_check_sum(
{ int chk_r = db->cursor(db, txn, &cursor, 0); CKERR(chk_r); }
if (sce->prefetch) {
r = cursor->c_pre_acquire_range_lock(cursor, db->dbt_neg_infty(), db->dbt_pos_infty());
r = cursor->c_set_bounds(cursor, db->dbt_neg_infty(), db->dbt_pos_infty(), true, 0);
assert(r == 0);
}
while (r != DB_NOTFOUND) {
......@@ -1153,7 +1153,7 @@ static void rangequery_db(DB *db, DB_TXN *txn, ARG arg, rangequery_row_cb cb, vo
fill_key_buf(start_k + limit, end_keybuf, arg->cli);
r = db->cursor(db, txn, &cursor, 0); CKERR(r);
r = cursor->c_pre_acquire_range_lock(cursor, &start_key, &end_key); CKERR(r);
r = cursor->c_set_bounds(cursor, &start_key, &end_key, true, 0); CKERR(r);
struct rangequery_cb_extra extra = {
.rows_read = 0,
......@@ -1322,7 +1322,7 @@ static int pre_acquire_write_lock(DB *db, DB_TXN *txn,
r = db->cursor(db, txn, &cursor, DB_RMW);
CKERR(r);
int cursor_r = cursor->c_pre_acquire_range_lock(cursor, left_key, right_key);
int cursor_r = cursor->c_set_bounds(cursor, left_key, right_key, true, 0);
r = cursor->c_close(cursor);
CKERR(r);
......
......@@ -700,15 +700,16 @@ toku_c_close(DBC * c) {
}
static int
c_restrict_to_range(DBC *dbc, const DBT *left_key, const DBT *right_key, bool pre_acquire, int out_of_range_error) {
c_set_bounds(DBC *dbc, const DBT *left_key, const DBT *right_key, bool pre_acquire, int out_of_range_error) {
if (out_of_range_error != DB_NOTFOUND &&
out_of_range_error != TOKUDB_OUT_OF_RANGE &&
out_of_range_error != 0) {
return toku_ydb_do_error(
dbc->dbp->dbenv,
EINVAL,
"Invalid out_of_range_error [%d] for c_restrict_to_range\n",
out_of_range_error
"Invalid out_of_range_error [%d] for %s\n",
out_of_range_error,
__FUNCTION__
);
}
if (left_key == toku_dbt_negative_infinity() && right_key == toku_dbt_positive_infinity()) {
......@@ -733,11 +734,6 @@ c_restrict_to_range(DBC *dbc, const DBT *left_key, const DBT *right_key, bool pr
return r;
}
static int
c_pre_acquire_range_lock(DBC *dbc, const DBT *left_key, const DBT *right_key) {
return c_restrict_to_range(dbc, left_key, right_key, true, 0);
}
static void
c_remove_restriction(DBC *dbc) {
toku_ft_cursor_remove_restriction(dbc_struct_i(dbc)->c);
......@@ -834,8 +830,7 @@ toku_db_cursor_internal(DB * db, DB_TXN * txn, DBC ** c, uint32_t flags, int is_
SCRS(c_getf_current);
SCRS(c_getf_set_range);
SCRS(c_getf_set_range_reverse);
SCRS(c_pre_acquire_range_lock);
SCRS(c_restrict_to_range);
SCRS(c_set_bounds);
SCRS(c_remove_restriction);
#undef SCRS
......
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