WIP VitastorFS with metadata storage in VitastorKV
Test / buildenv (push) Successful in 11s Details
Test / build (push) Successful in 3m5s Details
Test / test_cas (push) Successful in 10s Details
Test / make_test (push) Successful in 34s Details
Test / test_change_pg_size (push) Successful in 9s Details
Test / test_create_nomaxid (push) Successful in 8s Details
Test / test_change_pg_count (push) Successful in 49s Details
Test / test_change_pg_count_ec (push) Successful in 57s Details
Test / test_etcd_fail (push) Successful in 1m7s Details
Test / test_add_osd (push) Successful in 2m38s Details
Test / test_interrupted_rebalance_imm (push) Successful in 2m31s Details
Test / test_failure_domain (push) Successful in 11s Details
Test / test_interrupted_rebalance_ec_imm (push) Successful in 1m23s Details
Test / test_snapshot (push) Successful in 23s Details
Test / test_snapshot_ec (push) Successful in 26s Details
Test / test_minsize_1 (push) Successful in 13s Details
Test / test_rm (push) Successful in 14s Details
Test / test_move_reappear (push) Successful in 20s Details
Test / test_interrupted_rebalance_ec (push) Successful in 3m32s Details
Test / test_snapshot_down (push) Successful in 27s Details
Test / test_interrupted_rebalance (push) Successful in 5m19s Details
Test / test_snapshot_down_ec (push) Successful in 26s Details
Test / test_splitbrain (push) Successful in 22s Details
Test / test_snapshot_chain (push) Successful in 2m45s Details
Test / test_snapshot_chain_ec (push) Successful in 3m4s Details
Test / test_rebalance_verify_imm (push) Successful in 3m9s Details
Test / test_rebalance_verify (push) Successful in 3m50s Details
Test / test_write (push) Successful in 41s Details
Test / test_write_no_same (push) Successful in 14s Details
Test / test_rebalance_verify_ec_imm (push) Successful in 3m18s Details
Test / test_rebalance_verify_ec (push) Successful in 5m7s Details
Test / test_heal_csum_32k_dmj (push) Has started running 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 / 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
Test / test_heal_pg_size_2 (push) Has been cancelled Details
Test / test_write_xor (push) Has been cancelled Details
Test / test_heal_ec (push) Has been cancelled Details

Vitaliy Filippov 2024-01-03 16:16:38 +03:00
parent 37915d8315
commit 880974a4e3
4 changed files with 1562 additions and 697 deletions

View File

@ -181,23 +181,29 @@ target_link_libraries(vitastor-nbd
vitastor_client
)
# vitastor-kv
add_executable(vitastor-kv
kv_cli.cpp
# libvitastor_kv.so
add_library(vitastor_kv SHARED
kv_db.cpp
kv_db.h
)
target_link_libraries(vitastor-kv
target_link_libraries(vitastor_kv
vitastor_client
)
set_target_properties(vitastor_kv PROPERTIES VERSION ${VERSION} SOVERSION 0)
# vitastor-kv
add_executable(vitastor-kv
kv_cli.cpp
)
target_link_libraries(vitastor-kv
vitastor_kv
)
add_executable(vitastor-kv-stress
kv_stress.cpp
kv_db.cpp
kv_db.h
)
target_link_libraries(vitastor-kv-stress
vitastor_client
vitastor_kv
)
# vitastor-nfs
@ -213,6 +219,7 @@ add_executable(vitastor-nfs
)
target_link_libraries(vitastor-nfs
vitastor_client
vitastor_kv
)
# vitastor-cli

File diff suppressed because it is too large Load Diff

View File

@ -31,6 +31,8 @@ const char *exe_name = NULL;
nfs_proxy_t::~nfs_proxy_t()
{
if (db)
delete db;
if (cmd)
delete cmd;
if (cli)
@ -202,6 +204,33 @@ void nfs_proxy_t::run(json11::Json cfg)
}
// Check default pool
check_default_pool();
if (fs_kv_inode)
{
// Open DB and wait
int open_res = 0;
bool open_done = false;
db = new kv_dbw_t(cli);
db->open(fs_kv_inode, json11::Json(), [&](int res)
{
open_done = true;
open_res = res;
});
while (!open_done)
{
ringloop->loop();
if (open_done)
break;
ringloop->wait();
}
if (open_res < 0)
{
fprintf(stderr, "Failed to open key/value filesystem metadata index: %s (code %d)\n",
strerror(-open_res), open_res);
exit(1);
}
fs_base_inode = ((uint64_t)default_pool_id << (64-POOL_ID_BITS));
fs_inode_count = ((uint64_t)1 << (64-POOL_ID_BITS)) - 1;
}
// Self-register portmap and NFS
pmap.reg_ports.insert((portmap_id_t){
.prog = PMAP_PROGRAM,

View File

@ -4,6 +4,7 @@
#include "epoll_manager.h"
#include "nfs_portmap.h"
#include "nfs/xdr_impl.h"
#include "kv_db.h"
#define RPC_INIT_BUF_SIZE 32768
@ -16,6 +17,22 @@ struct nfs_dir_t
timespec mtime;
};
struct list_cookie_t
{
uint64_t dir_ino, cookieverf, cookie;
};
inline bool operator < (const list_cookie_t & a, const list_cookie_t & b)
{
return a.dir_ino < b.dir_ino || a.dir_ino == b.dir_ino &&
(a.cookieverf < b.cookieverf || a.cookieverf == b.cookieverf && a.cookie < b.cookie);
};
struct list_cookie_val_t
{
std::string key;
};
class nfs_proxy_t
{
public:
@ -27,6 +44,10 @@ public:
std::string export_root;
bool portmap_enabled;
unsigned nfs_port;
uint64_t fs_kv_inode = 0;
uint64_t fs_base_inode = 0;
uint64_t fs_inode_count = 0;
int readdir_getattr_parallel = 8, id_alloc_batch_size = 200;
pool_id_t default_pool_id;
@ -35,6 +56,11 @@ public:
epoll_manager_t *epmgr = NULL;
cluster_client_t *cli = NULL;
cli_tool_t *cmd = NULL;
kv_dbw_t *db = NULL;
uint64_t root_uid = 0, root_gid = 0;
std::map<list_cookie_t, list_cookie_val_t> list_cookies;
uint64_t fs_next_id = 0, fs_allocated_id = 0;
std::vector<uint64_t> unallocated_ids;
std::vector<XDR*> xdr_pool;
@ -106,6 +132,8 @@ struct extend_write_t
struct extend_inode_t
{
uint64_t cur_extend = 0, next_extend = 0;
std::string old_ientry;
json11::Json::object attrs;
};
class nfs_client_t