Compare commits

...

2 Commits

Author SHA1 Message Date
Vitaliy Filippov 36b341a96f First just recheck version without actually re-reading block in vitastor-kv
Test / test_snapshot_ec (push) Successful in 27s Details
Test / test_rm (push) Successful in 15s Details
Test / test_move_reappear (push) Successful in 19s Details
Test / test_snapshot_down (push) Successful in 30s Details
Test / test_snapshot_down_ec (push) Successful in 30s Details
Test / test_splitbrain (push) Successful in 21s Details
Test / test_snapshot_chain (push) Successful in 2m7s Details
Test / test_snapshot_chain_ec (push) Successful in 2m53s Details
Test / test_rebalance_verify_imm (push) Successful in 5m7s Details
Test / test_rebalance_verify (push) Successful in 5m43s Details
Test / test_switch_primary (push) Successful in 34s Details
Test / test_write (push) Successful in 51s Details
Test / test_rebalance_verify_ec_imm (push) Successful in 4m32s Details
Test / test_write_no_same (push) Successful in 15s Details
Test / test_write_xor (push) Successful in 55s Details
Test / test_rebalance_verify_ec (push) Successful in 7m41s Details
Test / test_heal_pg_size_2 (push) Successful in 4m31s Details
Test / test_heal_csum_32k_dmj (push) Successful in 4m22s Details
Test / test_heal_ec (push) Successful in 4m54s Details
Test / test_heal_csum_32k_dj (push) Successful in 5m56s Details
Test / test_heal_csum_32k (push) Successful in 6m29s Details
Test / test_heal_csum_4k_dmj (push) Successful in 6m28s Details
Test / test_heal_csum_4k_dj (push) Successful in 6m15s Details
Test / test_scrub_zero_osd_2 (push) Successful in 54s Details
Test / test_scrub_xor (push) Successful in 47s Details
Test / test_scrub (push) Successful in 1m3s Details
Test / test_scrub_ec (push) Successful in 1m8s Details
Test / test_scrub_pg_size_6_pg_minsize_4_osd_count_6_ec (push) Successful in 1m10s Details
Test / test_scrub_pg_size_3 (push) Successful in 1m27s Details
Test / test_heal_csum_4k (push) Successful in 5m49s Details
2024-03-07 19:50:51 +03:00
Vitaliy Filippov 56b7b18adf Fix vitastor-kv hang on reopen & unfinished closed listing
Test / test_interrupted_rebalance_ec (push) Successful in 3m9s Details
Test / test_move_reappear (push) Successful in 20s Details
Test / test_rm (push) Successful in 12s Details
Test / test_snapshot_down (push) Successful in 28s Details
Test / test_snapshot_down_ec (push) Successful in 29s Details
Test / test_splitbrain (push) Successful in 21s Details
Test / test_snapshot_chain (push) Successful in 2m27s Details
Test / test_snapshot_chain_ec (push) Successful in 2m53s Details
Test / test_rebalance_verify_imm (push) Successful in 4m16s Details
Test / test_rebalance_verify (push) Successful in 4m50s Details
Test / test_switch_primary (push) Successful in 36s Details
Test / test_write (push) Successful in 46s Details
Test / test_rebalance_verify_ec_imm (push) Successful in 3m30s Details
Test / test_write_no_same (push) Successful in 16s Details
Test / test_write_xor (push) Successful in 1m27s Details
Test / test_rebalance_verify_ec (push) Successful in 7m18s Details
Test / test_heal_pg_size_2 (push) Successful in 4m0s Details
Test / test_heal_ec (push) Successful in 4m3s Details
Test / test_heal_csum_32k_dmj (push) Successful in 4m55s Details
Test / test_heal_csum_32k_dj (push) Successful in 6m17s Details
Test / test_heal_csum_32k (push) Successful in 6m18s Details
Test / test_heal_csum_4k_dmj (push) Successful in 6m37s Details
Test / test_scrub (push) Successful in 1m37s Details
Test / test_scrub_zero_osd_2 (push) Successful in 1m19s Details
Test / test_heal_csum_4k_dj (push) Successful in 6m55s Details
Test / test_scrub_xor (push) Successful in 50s Details
Test / test_scrub_ec (push) Successful in 45s Details
Test / test_scrub_pg_size_6_pg_minsize_4_osd_count_6_ec (push) Successful in 1m8s Details
Test / test_scrub_pg_size_3 (push) Successful in 1m56s Details
Test / test_heal_csum_4k (push) Successful in 5m39s Details
2024-03-07 18:09:05 +03:00
3 changed files with 39 additions and 10 deletions

View File

@ -673,7 +673,7 @@ bool cluster_client_t::check_rw(cluster_op_t *op)
return false; return false;
} }
// Check alignment // Check alignment
if (!op->len && (op->opcode == OSD_OP_READ || op->opcode == OSD_OP_READ_BITMAP || op->opcode == OSD_OP_READ_CHAIN_BITMAP || op->opcode == OSD_OP_WRITE) || if (!op->len && (op->opcode == OSD_OP_READ_BITMAP || op->opcode == OSD_OP_READ_CHAIN_BITMAP || op->opcode == OSD_OP_WRITE) ||
op->offset % pool_it->second.bitmap_granularity || op->len % pool_it->second.bitmap_granularity) op->offset % pool_it->second.bitmap_granularity || op->len % pool_it->second.bitmap_granularity)
{ {
op->retval = -EINVAL; op->retval = -EINVAL;

View File

@ -197,6 +197,7 @@ struct kv_op_t
void exec(); void exec();
void next(); // for list void next(); // for list
~kv_op_t();
protected: protected:
int recheck_policy = KV_RECHECK_LEAF; int recheck_policy = KV_RECHECK_LEAF;
bool started = false; bool started = false;
@ -887,13 +888,22 @@ static void get_block(kv_db_t *db, uint64_t offset, int cur_level, int recheck_p
op->opcode = OSD_OP_READ; op->opcode = OSD_OP_READ;
op->inode = db->inode_id; op->inode = db->inode_id;
op->offset = offset; op->offset = offset;
if (b_it != db->block_cache.end() && !b_it->second.invalidated && !b_it->second.updating)
{
// just recheck version - it's cheaper than re-reading the block
op->len = 0;
}
else
{
op->len = db->kv_block_size; op->len = db->kv_block_size;
op->iov.push_back(malloc_or_die(op->len), op->len); op->iov.push_back(malloc_or_die(op->len), op->len);
}
op->callback = [=](cluster_op_t *op) op->callback = [=](cluster_op_t *op)
{ {
if (op->retval != op->len) if (op->retval != op->len)
{ {
// error // error
if (op->len)
free(op->iov.buf[0].iov_base); free(op->iov.buf[0].iov_base);
cb(op->retval >= 0 ? -EIO : op->retval, BLK_NOCHANGE); cb(op->retval >= 0 ? -EIO : op->retval, BLK_NOCHANGE);
delete op; delete op;
@ -909,6 +919,7 @@ static void get_block(kv_db_t *db, uint64_t offset, int cur_level, int recheck_p
if (blk->updating > 0 && recheck_policy == KV_RECHECK_WAIT) if (blk->updating > 0 && recheck_policy == KV_RECHECK_WAIT)
{ {
// Wait until block update stops // Wait until block update stops
if (op->len)
free(op->iov.buf[0].iov_base); free(op->iov.buf[0].iov_base);
delete op; delete op;
db->continue_update.emplace(blk->offset, [=, blk_offset = blk->offset]() db->continue_update.emplace(blk->offset, [=, blk_offset = blk->offset]()
@ -923,6 +934,13 @@ static void get_block(kv_db_t *db, uint64_t offset, int cur_level, int recheck_p
} }
else else
{ {
if (!op->len)
{
// Version check failed, re-read block
delete op;
get_block(db, offset, cur_level, recheck_policy, cb);
return;
}
auto blk = &db->block_cache[op->offset]; auto blk = &db->block_cache[op->offset];
if (blk_it != db->block_cache.end()) if (blk_it != db->block_cache.end())
{ {
@ -944,6 +962,7 @@ static void get_block(kv_db_t *db, uint64_t offset, int cur_level, int recheck_p
} }
try_evict(db); try_evict(db);
} }
if (op->len)
free(op->iov.buf[0].iov_base); free(op->iov.buf[0].iov_base);
delete op; delete op;
}; };
@ -985,14 +1004,24 @@ void kv_op_t::exec()
finish(-ENOSYS); finish(-ENOSYS);
} }
kv_op_t::~kv_op_t()
{
if (started && !done)
{
done = true;
db->active_ops--;
}
}
void kv_op_t::finish(int res) void kv_op_t::finish(int res)
{ {
auto db = this->db;
this->res = res; this->res = res;
this->done = true; this->done = true;
db->active_ops--; db->active_ops--;
(std::function<void(kv_op_t *)>(callback))(this);
if (!db->active_ops && db->closing) if (!db->active_ops && db->closing)
db->close(db->on_close); db->close(db->on_close);
(std::function<void(kv_op_t *)>(callback))(this);
} }
void kv_op_t::get() void kv_op_t::get()

View File

@ -147,6 +147,8 @@ json11::Json::object kv_test_t::parse_args(int narg, const char *args[])
" Fraction of key delete operations\n" " Fraction of key delete operations\n"
" --list_prob 300\n" " --list_prob 300\n"
" Fraction of listing operations\n" " Fraction of listing operations\n"
" --reopen_prob 1\n"
" Fraction of database reopens\n"
" --min_key_len 10\n" " --min_key_len 10\n"
" Minimum key size in bytes\n" " Minimum key size in bytes\n"
" --max_key_len 70\n" " --max_key_len 70\n"
@ -607,11 +609,9 @@ void kv_test_t::add_stat(kv_test_lat_t & stat, timespec tv_begin)
int64_t usec = (tv_end.tv_sec - tv_begin.tv_sec)*1000000 + int64_t usec = (tv_end.tv_sec - tv_begin.tv_sec)*1000000 +
(tv_end.tv_nsec - tv_begin.tv_nsec)/1000; (tv_end.tv_nsec - tv_begin.tv_nsec)/1000;
if (usec > 0) if (usec > 0)
{
stat.usec += usec; stat.usec += usec;
stat.count++; stat.count++;
} }
}
void kv_test_t::print_stats(kv_test_stat_t & prev_stat, timespec & prev_stat_time) void kv_test_t::print_stats(kv_test_stat_t & prev_stat, timespec & prev_stat_time)
{ {