First just recheck version without actually re-reading block in vitastor-kv
Test / buildenv (push) Successful in 8s Details
Test / make_test (push) Has been cancelled Details
Test / test_add_osd (push) Has been cancelled Details
Test / test_cas (push) Has been cancelled Details
Test / test_change_pg_count (push) Has been cancelled Details
Test / test_change_pg_count_ec (push) Has been cancelled Details
Test / test_change_pg_size (push) Has been cancelled Details
Test / test_create_nomaxid (push) Has been cancelled Details
Test / test_etcd_fail (push) Has been cancelled Details
Test / test_interrupted_rebalance (push) Has been cancelled Details
Test / test_interrupted_rebalance_imm (push) Has been cancelled Details
Test / test_interrupted_rebalance_ec (push) Has been cancelled Details
Test / test_interrupted_rebalance_ec_imm (push) Has been cancelled Details
Test / test_failure_domain (push) Has been cancelled Details
Test / test_snapshot (push) Has been cancelled Details
Test / test_snapshot_ec (push) Has been cancelled Details
Test / test_minsize_1 (push) Has been cancelled Details
Test / test_move_reappear (push) Has been cancelled Details
Test / test_rm (push) Has been cancelled Details
Test / test_snapshot_chain (push) Has been cancelled Details
Test / test_snapshot_chain_ec (push) Has been cancelled Details
Test / test_snapshot_down (push) Has been cancelled Details
Test / test_snapshot_down_ec (push) Has been cancelled Details
Test / test_splitbrain (push) Has been cancelled Details
Test / test_rebalance_verify (push) Has been cancelled Details
Test / test_rebalance_verify_imm (push) Has been cancelled Details
Test / test_rebalance_verify_ec (push) Has been cancelled Details
Test / test_rebalance_verify_ec_imm (push) Has been cancelled Details
Test / test_switch_primary (push) Has been cancelled Details
Test / test_write (push) Has been cancelled Details
Test / test_write_xor (push) Has been cancelled Details
Test / test_write_no_same (push) Has been cancelled Details
Test / test_heal_pg_size_2 (push) Has been cancelled Details
Test / test_heal_ec (push) Has been cancelled Details
Test / test_heal_csum_32k_dmj (push) Has been cancelled Details
Test / test_heal_csum_32k_dj (push) Has been cancelled Details
Test / test_heal_csum_32k (push) Has been cancelled Details
Test / test_heal_csum_4k_dmj (push) Has been cancelled Details
Test / test_heal_csum_4k_dj (push) Has been cancelled Details
Test / build (push) Has been cancelled Details
Test / test_heal_csum_4k (push) Has been cancelled Details
Test / test_scrub (push) Has been cancelled Details
Test / test_scrub_zero_osd_2 (push) Has been cancelled Details
Test / test_scrub_xor (push) Has been cancelled Details
Test / test_scrub_pg_size_3 (push) Has been cancelled Details
Test / test_scrub_pg_size_6_pg_minsize_4_osd_count_6_ec (push) Has been cancelled Details
Test / test_scrub_ec (push) Has been cancelled Details

Vitaliy Filippov 2024-03-05 00:08:20 +03:00
parent 7a55d59266
commit 2defd7d8ed
2 changed files with 24 additions and 6 deletions

View File

@ -673,7 +673,7 @@ bool cluster_client_t::check_rw(cluster_op_t *op)
return false;
}
// 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->retval = -EINVAL;

View File

@ -887,14 +887,23 @@ static void get_block(kv_db_t *db, uint64_t offset, int cur_level, int recheck_p
op->opcode = OSD_OP_READ;
op->inode = db->inode_id;
op->offset = offset;
op->len = db->kv_block_size;
op->iov.push_back(malloc_or_die(op->len), op->len);
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->iov.push_back(malloc_or_die(op->len), op->len);
}
op->callback = [=](cluster_op_t *op)
{
if (op->retval != op->len)
{
// error
free(op->iov.buf[0].iov_base);
if (op->len)
free(op->iov.buf[0].iov_base);
cb(op->retval >= 0 ? -EIO : op->retval, BLK_NOCHANGE);
delete op;
return;
@ -909,7 +918,8 @@ 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)
{
// Wait until block update stops
free(op->iov.buf[0].iov_base);
if (op->len)
free(op->iov.buf[0].iov_base);
delete op;
db->continue_update.emplace(blk->offset, [=, blk_offset = blk->offset]()
{
@ -923,6 +933,13 @@ static void get_block(kv_db_t *db, uint64_t offset, int cur_level, int recheck_p
}
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];
if (blk_it != db->block_cache.end())
{
@ -944,7 +961,8 @@ static void get_block(kv_db_t *db, uint64_t offset, int cur_level, int recheck_p
}
try_evict(db);
}
free(op->iov.buf[0].iov_base);
if (op->len)
free(op->iov.buf[0].iov_base);
delete op;
};
db->cli->execute(op);