mirror of
https://github.com/MariaDB/server.git
synced 2025-02-01 11:31:51 +01:00
DB-813 add deleted rows count to the cursor interrupt callback. may be useful to count garbage rows.
This commit is contained in:
parent
d7cb68be9c
commit
d0fa28aa87
5 changed files with 9 additions and 7 deletions
|
@ -614,7 +614,7 @@ static void print_dbc_struct (void) {
|
||||||
"int (*c_getf_set_range_reverse)(DBC *, uint32_t, DBT *, YDB_CALLBACK_FUNCTION, void *)",
|
"int (*c_getf_set_range_reverse)(DBC *, uint32_t, DBT *, YDB_CALLBACK_FUNCTION, void *)",
|
||||||
"int (*c_getf_set_range_with_bound)(DBC *, uint32_t, DBT *k, DBT *k_bound, YDB_CALLBACK_FUNCTION, void *)",
|
"int (*c_getf_set_range_with_bound)(DBC *, uint32_t, DBT *k, DBT *k_bound, YDB_CALLBACK_FUNCTION, void *)",
|
||||||
"int (*c_set_bounds)(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_set_check_interrupt_callback)(DBC*, bool (*)(void*), void *)",
|
"void (*c_set_check_interrupt_callback)(DBC*, bool (*)(void*, uint64_t deleted_rows), void *)",
|
||||||
"void (*c_remove_restriction)(DBC*)",
|
"void (*c_remove_restriction)(DBC*)",
|
||||||
"char _internal[512]",
|
"char _internal[512]",
|
||||||
NULL};
|
NULL};
|
||||||
|
|
|
@ -655,7 +655,7 @@ int toku_upgrade_msn_from_root_to_header(int fd, FT ft) __attribute__((nonnull))
|
||||||
// When lock_only is true, the callback only does optional lock tree locking.
|
// When lock_only is true, the callback only does optional lock tree locking.
|
||||||
typedef int (*FT_GET_CALLBACK_FUNCTION)(uint32_t keylen, const void *key, uint32_t vallen, const void *val, void *extra, bool lock_only);
|
typedef int (*FT_GET_CALLBACK_FUNCTION)(uint32_t keylen, const void *key, uint32_t vallen, const void *val, void *extra, bool lock_only);
|
||||||
|
|
||||||
typedef bool (*FT_CHECK_INTERRUPT_CALLBACK)(void *extra);
|
typedef bool (*FT_CHECK_INTERRUPT_CALLBACK)(void *extra, uint64_t deleted_rows);
|
||||||
|
|
||||||
struct ft_cursor;
|
struct ft_cursor;
|
||||||
int toku_ft_search(FT_HANDLE ft_handle, ft_search *search, FT_GET_CALLBACK_FUNCTION getf, void *getf_v, struct ft_cursor *ftcursor, bool can_bulk_fetch);
|
int toku_ft_search(FT_HANDLE ft_handle, ft_search *search, FT_GET_CALLBACK_FUNCTION getf, void *getf_v, struct ft_cursor *ftcursor, bool can_bulk_fetch);
|
||||||
|
|
|
@ -3385,7 +3385,7 @@ ok: ;
|
||||||
idx++;
|
idx++;
|
||||||
if (idx >= bn->data_buffer.num_klpairs() || ((n_deleted % 64) == 0 && !search_continue(search, key, keylen))) {
|
if (idx >= bn->data_buffer.num_klpairs() || ((n_deleted % 64) == 0 && !search_continue(search, key, keylen))) {
|
||||||
STATUS_INC(FT_CURSOR_SKIP_DELETED_LEAF_ENTRY, n_deleted);
|
STATUS_INC(FT_CURSOR_SKIP_DELETED_LEAF_ENTRY, n_deleted);
|
||||||
if (ftcursor->interrupt_cb && ftcursor->interrupt_cb(ftcursor->interrupt_cb_extra)) {
|
if (ftcursor->interrupt_cb && ftcursor->interrupt_cb(ftcursor->interrupt_cb_extra, n_deleted)) {
|
||||||
return TOKUDB_INTERRUPTED;
|
return TOKUDB_INTERRUPTED;
|
||||||
}
|
}
|
||||||
return DB_NOTFOUND;
|
return DB_NOTFOUND;
|
||||||
|
@ -3394,7 +3394,7 @@ ok: ;
|
||||||
case FT_SEARCH_RIGHT:
|
case FT_SEARCH_RIGHT:
|
||||||
if (idx == 0) {
|
if (idx == 0) {
|
||||||
STATUS_INC(FT_CURSOR_SKIP_DELETED_LEAF_ENTRY, n_deleted);
|
STATUS_INC(FT_CURSOR_SKIP_DELETED_LEAF_ENTRY, n_deleted);
|
||||||
if (ftcursor->interrupt_cb && ftcursor->interrupt_cb(ftcursor->interrupt_cb_extra)) {
|
if (ftcursor->interrupt_cb && ftcursor->interrupt_cb(ftcursor->interrupt_cb_extra, n_deleted)) {
|
||||||
return TOKUDB_INTERRUPTED;
|
return TOKUDB_INTERRUPTED;
|
||||||
}
|
}
|
||||||
return DB_NOTFOUND;
|
return DB_NOTFOUND;
|
||||||
|
@ -3408,6 +3408,8 @@ ok: ;
|
||||||
assert_zero(r); // we just validated the index
|
assert_zero(r); // we just validated the index
|
||||||
if (!le_val_is_del(le, ftcursor->is_snapshot_read, ftcursor->ttxn)) {
|
if (!le_val_is_del(le, ftcursor->is_snapshot_read, ftcursor->ttxn)) {
|
||||||
STATUS_INC(FT_CURSOR_SKIP_DELETED_LEAF_ENTRY, n_deleted);
|
STATUS_INC(FT_CURSOR_SKIP_DELETED_LEAF_ENTRY, n_deleted);
|
||||||
|
if (ftcursor->interrupt_cb)
|
||||||
|
ftcursor->interrupt_cb(ftcursor->interrupt_cb_extra, n_deleted);
|
||||||
goto got_a_good_value;
|
goto got_a_good_value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -95,12 +95,12 @@ PATENT RIGHTS GRANT:
|
||||||
|
|
||||||
|
|
||||||
int num_interrupts_called;
|
int num_interrupts_called;
|
||||||
static bool interrupt(void* extra UU()) {
|
static bool interrupt(void* extra UU(), uint64_t rows UU()) {
|
||||||
num_interrupts_called++;
|
num_interrupts_called++;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool interrupt_true(void* extra UU()) {
|
static bool interrupt_true(void* extra UU(), uint64_t rows UU()) {
|
||||||
num_interrupts_called++;
|
num_interrupts_called++;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -767,7 +767,7 @@ c_remove_restriction(DBC *dbc) {
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
c_set_check_interrupt_callback(DBC* dbc, bool (*interrupt_callback)(void*), void *extra) {
|
c_set_check_interrupt_callback(DBC* dbc, bool (*interrupt_callback)(void*, uint64_t), void *extra) {
|
||||||
toku_ft_cursor_set_check_interrupt_cb(dbc_ftcursor(dbc), interrupt_callback, extra);
|
toku_ft_cursor_set_check_interrupt_cb(dbc_ftcursor(dbc), interrupt_callback, extra);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue