Compare commits
7 Commits
Author | SHA1 | Date |
---|---|---|
Vitaliy Filippov | 50e56b3b92 | |
Vitaliy Filippov | a12d328793 | |
Vitaliy Filippov | c79b38bd26 | |
Vitaliy Filippov | 44692d148a | |
Vitaliy Filippov | ba52359611 | |
Vitaliy Filippov | 23a9aa93b5 | |
Vitaliy Filippov | 2412d9e239 |
|
@ -3,16 +3,3 @@
|
||||||
package-lock.json
|
package-lock.json
|
||||||
fio
|
fio
|
||||||
qemu
|
qemu
|
||||||
osd
|
|
||||||
stub_osd
|
|
||||||
stub_uring_osd
|
|
||||||
stub_bench
|
|
||||||
osd_test
|
|
||||||
osd_peering_pg_test
|
|
||||||
dump_journal
|
|
||||||
nbd_proxy
|
|
||||||
rm_inode
|
|
||||||
test_allocator
|
|
||||||
test_blockstore
|
|
||||||
test_shit
|
|
||||||
osd_rmw_test
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
gcc -I. -E -o fio_headers.i src/fio_headers.h
|
gcc -I. -E -o fio_headers.i src/util/fio_headers.h
|
||||||
|
|
||||||
rm -rf fio-copy
|
rm -rf fio-copy
|
||||||
for i in `grep -Po 'fio/[^"]+' fio_headers.i | sort | uniq`; do
|
for i in `grep -Po 'fio/[^"]+' fio_headers.i | sort | uniq`; do
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
#cd b/qemu; make qapi
|
#cd b/qemu; make qapi
|
||||||
|
|
||||||
gcc -I qemu/b/qemu `pkg-config glib-2.0 --cflags` \
|
gcc -I qemu/b/qemu `pkg-config glib-2.0 --cflags` \
|
||||||
-I qemu/include -E -o qemu_driver.i src/qemu_driver.c
|
-I qemu/include -E -o qemu_driver.i src/client/qemu_driver.c
|
||||||
|
|
||||||
rm -rf qemu-copy
|
rm -rf qemu-copy
|
||||||
for i in `grep -Po 'qemu/[^"]+' qemu_driver.i | sort | uniq`; do
|
for i in `grep -Po 'qemu/[^"]+' qemu_driver.i | sort | uniq`; do
|
||||||
|
|
|
@ -27,7 +27,7 @@ RUN apt-get -y build-dep qemu
|
||||||
RUN apt-get --download-only source qemu
|
RUN apt-get --download-only source qemu
|
||||||
|
|
||||||
ADD patches /root/vitastor/patches
|
ADD patches /root/vitastor/patches
|
||||||
ADD src/qemu_driver.c /root/vitastor/src/qemu_driver.c
|
ADD src/client/qemu_driver.c /root/qemu_driver.c
|
||||||
|
|
||||||
#RUN set -e; \
|
#RUN set -e; \
|
||||||
# apt-get install -y wget; \
|
# apt-get install -y wget; \
|
||||||
|
@ -52,7 +52,7 @@ RUN set -e; \
|
||||||
cd /root/packages/qemu-$REL/qemu-*/; \
|
cd /root/packages/qemu-$REL/qemu-*/; \
|
||||||
quilt push -a; \
|
quilt push -a; \
|
||||||
quilt add block/vitastor.c; \
|
quilt add block/vitastor.c; \
|
||||||
cp /root/vitastor/src/qemu_driver.c block/vitastor.c; \
|
cp /root/qemu_driver.c block/vitastor.c; \
|
||||||
quilt refresh; \
|
quilt refresh; \
|
||||||
V=$(head -n1 debian/changelog | perl -pe 's/5\.2\+dfsg-9/5.2+dfsg-11/; s/^.*\((.*?)(~bpo[\d\+]*)?\).*$/$1/')+vitastor4; \
|
V=$(head -n1 debian/changelog | perl -pe 's/5\.2\+dfsg-9/5.2+dfsg-11/; s/^.*\((.*?)(~bpo[\d\+]*)?\).*$/$1/')+vitastor4; \
|
||||||
if [ "$REL" = bullseye ]; then V=${V}bullseye; fi; \
|
if [ "$REL" = bullseye ]; then V=${V}bullseye; fi; \
|
||||||
|
|
|
@ -41,7 +41,7 @@ It's recommended to build the QEMU driver (qemu_driver.c) in-tree, as a part of
|
||||||
QEMU build process. To do that:
|
QEMU build process. To do that:
|
||||||
- Install vitastor client library headers (from source or from vitastor-client-dev package)
|
- Install vitastor client library headers (from source or from vitastor-client-dev package)
|
||||||
- Take a corresponding patch from `patches/qemu-*-vitastor.patch` and apply it to QEMU source
|
- Take a corresponding patch from `patches/qemu-*-vitastor.patch` and apply it to QEMU source
|
||||||
- Copy `src/qemu_driver.c` to QEMU source directory as `block/vitastor.c`
|
- Copy `src/client/qemu_driver.c` to QEMU source directory as `block/vitastor.c`
|
||||||
- Build QEMU as usual
|
- Build QEMU as usual
|
||||||
|
|
||||||
But it is also possible to build it out-of-tree. To do that:
|
But it is also possible to build it out-of-tree. To do that:
|
||||||
|
|
|
@ -41,7 +41,7 @@ cmake .. && make -j8 install
|
||||||
Драйвер QEMU (qemu_driver.c) рекомендуется собирать вместе с самим QEMU. Для этого:
|
Драйвер QEMU (qemu_driver.c) рекомендуется собирать вместе с самим QEMU. Для этого:
|
||||||
- Установите заголовки клиентской библиотеки Vitastor (из исходников или из пакета vitastor-client-dev)
|
- Установите заголовки клиентской библиотеки Vitastor (из исходников или из пакета vitastor-client-dev)
|
||||||
- Возьмите соответствующий патч из `patches/qemu-*-vitastor.patch` и примените его к исходникам QEMU
|
- Возьмите соответствующий патч из `patches/qemu-*-vitastor.patch` и примените его к исходникам QEMU
|
||||||
- Скопируйте [src/qemu_driver.c](../../src/qemu_driver.c) в директорию исходников QEMU как `block/vitastor.c`
|
- Скопируйте [src/client/qemu_driver.c](../../src/client/qemu_driver.c) в директорию исходников QEMU как `block/vitastor.c`
|
||||||
- Соберите QEMU как обычно
|
- Соберите QEMU как обычно
|
||||||
|
|
||||||
Однако в целях отладки драйвер также можно собирать отдельно от QEMU. Для этого:
|
Однако в целях отладки драйвер также можно собирать отдельно от QEMU. Для этого:
|
||||||
|
|
|
@ -37,7 +37,6 @@ const etcd_allow = new RegExp('^'+[
|
||||||
'pg/state/[1-9]\\d*/[1-9]\\d*',
|
'pg/state/[1-9]\\d*/[1-9]\\d*',
|
||||||
'pg/stats/[1-9]\\d*/[1-9]\\d*',
|
'pg/stats/[1-9]\\d*/[1-9]\\d*',
|
||||||
'pg/history/[1-9]\\d*/[1-9]\\d*',
|
'pg/history/[1-9]\\d*/[1-9]\\d*',
|
||||||
'pool/stats/[1-9]\\d*',
|
|
||||||
'history/last_clean_pgs',
|
'history/last_clean_pgs',
|
||||||
'inode/stats/[1-9]\\d*/\\d+',
|
'inode/stats/[1-9]\\d*/\\d+',
|
||||||
'pool/stats/[1-9]\\d*',
|
'pool/stats/[1-9]\\d*',
|
||||||
|
|
|
@ -9,7 +9,7 @@ for i in "$DIR"/qemu-*-vitastor.patch "$DIR"/pve-qemu-*-vitastor.patch; do
|
||||||
echo '===================================================================' >> $i
|
echo '===================================================================' >> $i
|
||||||
echo '--- /dev/null' >> $i
|
echo '--- /dev/null' >> $i
|
||||||
echo '+++ a/block/vitastor.c' >> $i
|
echo '+++ a/block/vitastor.c' >> $i
|
||||||
echo '@@ -0,0 +1,'$(wc -l "$DIR"/../src/qemu_driver.c | cut -d ' ' -f 1)' @@' >> $i
|
echo '@@ -0,0 +1,'$(wc -l "$DIR"/../src/client/qemu_driver.c | cut -d ' ' -f 1)' @@' >> $i
|
||||||
cat "$DIR"/../src/qemu_driver.c | sed 's/^/+/' >> $i
|
cat "$DIR"/../src/client/qemu_driver.c | sed 's/^/+/' >> $i
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
# This is an attempt to automatically build patched RPM specs
|
# This is an attempt to automatically build patched RPM specs
|
||||||
# More or less broken, better use *.spec.patch for now (and copy src/qemu_driver.c to SOURCES/qemu-vitastor.c)
|
# More or less broken, better use *.spec.patch for now (and copy src/client/qemu_driver.c to SOURCES/qemu-vitastor.c)
|
||||||
|
|
||||||
# Build packages for CentOS 8 inside a container
|
# Build packages for CentOS 8 inside a container
|
||||||
# cd ..; podman build -t qemu-el8 -v `pwd`/packages:/root/packages -f rpm/qemu-el8.Dockerfile .
|
# cd ..; podman build -t qemu-el8 -v `pwd`/packages:/root/packages -f rpm/qemu-el8.Dockerfile .
|
||||||
|
|
|
@ -72,300 +72,28 @@ add_dependencies(test build_tests)
|
||||||
|
|
||||||
include_directories(
|
include_directories(
|
||||||
../
|
../
|
||||||
|
${CMAKE_SOURCE_DIR}/src/blockstore
|
||||||
|
${CMAKE_SOURCE_DIR}/src/cmd
|
||||||
|
${CMAKE_SOURCE_DIR}/src/client
|
||||||
|
${CMAKE_SOURCE_DIR}/src/disk_tool
|
||||||
|
${CMAKE_SOURCE_DIR}/src/kv
|
||||||
|
${CMAKE_SOURCE_DIR}/src/nfs
|
||||||
|
${CMAKE_SOURCE_DIR}/src/osd
|
||||||
|
${CMAKE_SOURCE_DIR}/src/test
|
||||||
|
${CMAKE_SOURCE_DIR}/src/util
|
||||||
/usr/include/jerasure
|
/usr/include/jerasure
|
||||||
${LIBURING_INCLUDE_DIRS}
|
${LIBURING_INCLUDE_DIRS}
|
||||||
${IBVERBS_INCLUDE_DIRS}
|
${IBVERBS_INCLUDE_DIRS}
|
||||||
)
|
)
|
||||||
|
|
||||||
# libvitastor_blk.so
|
add_subdirectory(blockstore)
|
||||||
add_library(vitastor_blk SHARED
|
add_subdirectory(cmd)
|
||||||
allocator.cpp blockstore.cpp blockstore_impl.cpp blockstore_disk.cpp blockstore_init.cpp blockstore_open.cpp blockstore_journal.cpp blockstore_read.cpp
|
add_subdirectory(client)
|
||||||
blockstore_write.cpp blockstore_sync.cpp blockstore_stable.cpp blockstore_rollback.cpp blockstore_flush.cpp crc32c.c ringloop.cpp
|
add_subdirectory(disk_tool)
|
||||||
)
|
add_subdirectory(kv)
|
||||||
target_link_libraries(vitastor_blk
|
add_subdirectory(nfs)
|
||||||
${LIBURING_LIBRARIES}
|
add_subdirectory(osd)
|
||||||
tcmalloc_minimal
|
add_subdirectory(test)
|
||||||
# for timerfd_manager
|
|
||||||
vitastor_common
|
|
||||||
)
|
|
||||||
set_target_properties(vitastor_blk PROPERTIES VERSION ${VERSION} SOVERSION 0)
|
|
||||||
|
|
||||||
if (${WITH_FIO})
|
|
||||||
# libfio_vitastor_blk.so
|
|
||||||
add_library(fio_vitastor_blk SHARED
|
|
||||||
fio_engine.cpp
|
|
||||||
../json11/json11.cpp
|
|
||||||
)
|
|
||||||
target_link_libraries(fio_vitastor_blk
|
|
||||||
vitastor_blk
|
|
||||||
)
|
|
||||||
endif (${WITH_FIO})
|
|
||||||
|
|
||||||
# libvitastor_common.a
|
|
||||||
set(MSGR_RDMA "")
|
|
||||||
if (IBVERBS_LIBRARIES)
|
|
||||||
set(MSGR_RDMA "msgr_rdma.cpp")
|
|
||||||
endif (IBVERBS_LIBRARIES)
|
|
||||||
add_library(vitastor_common STATIC
|
|
||||||
epoll_manager.cpp etcd_state_client.cpp messenger.cpp addr_util.cpp
|
|
||||||
msgr_stop.cpp msgr_op.cpp msgr_send.cpp msgr_receive.cpp ringloop.cpp ../json11/json11.cpp
|
|
||||||
http_client.cpp osd_ops.cpp pg_states.cpp timerfd_manager.cpp str_util.cpp ${MSGR_RDMA}
|
|
||||||
)
|
|
||||||
target_compile_options(vitastor_common PUBLIC -fPIC)
|
|
||||||
|
|
||||||
# vitastor-osd
|
|
||||||
add_executable(vitastor-osd
|
|
||||||
osd_main.cpp osd.cpp osd_secondary.cpp osd_peering.cpp osd_flush.cpp osd_peering_pg.cpp
|
|
||||||
osd_primary.cpp osd_primary_chain.cpp osd_primary_sync.cpp osd_primary_write.cpp osd_primary_subops.cpp
|
|
||||||
osd_cluster.cpp osd_rmw.cpp osd_scrub.cpp osd_primary_describe.cpp
|
|
||||||
)
|
|
||||||
target_link_libraries(vitastor-osd
|
|
||||||
vitastor_common
|
|
||||||
vitastor_blk
|
|
||||||
Jerasure
|
|
||||||
${ISAL_LIBRARIES}
|
|
||||||
${IBVERBS_LIBRARIES}
|
|
||||||
)
|
|
||||||
|
|
||||||
if (${WITH_FIO})
|
|
||||||
# libfio_vitastor_sec.so
|
|
||||||
add_library(fio_vitastor_sec SHARED
|
|
||||||
fio_sec_osd.cpp
|
|
||||||
rw_blocking.cpp
|
|
||||||
addr_util.cpp
|
|
||||||
)
|
|
||||||
target_link_libraries(fio_vitastor_sec
|
|
||||||
tcmalloc_minimal
|
|
||||||
)
|
|
||||||
endif (${WITH_FIO})
|
|
||||||
|
|
||||||
# libvitastor_client.so
|
|
||||||
add_library(vitastor_client SHARED
|
|
||||||
cluster_client.cpp
|
|
||||||
cluster_client_list.cpp
|
|
||||||
cluster_client_wb.cpp
|
|
||||||
vitastor_c.cpp
|
|
||||||
cli_common.cpp
|
|
||||||
cli_alloc_osd.cpp
|
|
||||||
cli_status.cpp
|
|
||||||
cli_describe.cpp
|
|
||||||
cli_fix.cpp
|
|
||||||
cli_ls.cpp
|
|
||||||
cli_create.cpp
|
|
||||||
cli_modify.cpp
|
|
||||||
cli_flatten.cpp
|
|
||||||
cli_merge.cpp
|
|
||||||
cli_rm_data.cpp
|
|
||||||
cli_rm.cpp
|
|
||||||
cli_rm_osd.cpp
|
|
||||||
cli_pool_cfg.cpp
|
|
||||||
cli_pool_create.cpp
|
|
||||||
cli_pool_ls.cpp
|
|
||||||
cli_pool_modify.cpp
|
|
||||||
cli_pool_rm.cpp
|
|
||||||
)
|
|
||||||
set_target_properties(vitastor_client PROPERTIES PUBLIC_HEADER "vitastor_c.h")
|
|
||||||
target_link_libraries(vitastor_client
|
|
||||||
vitastor_common
|
|
||||||
${LIBURING_LIBRARIES}
|
|
||||||
${IBVERBS_LIBRARIES}
|
|
||||||
)
|
|
||||||
set_target_properties(vitastor_client PROPERTIES VERSION ${VERSION} SOVERSION 0)
|
|
||||||
|
|
||||||
if (${WITH_FIO})
|
|
||||||
# libfio_vitastor.so
|
|
||||||
add_library(fio_vitastor SHARED
|
|
||||||
fio_cluster.cpp
|
|
||||||
)
|
|
||||||
target_link_libraries(fio_vitastor
|
|
||||||
vitastor_client
|
|
||||||
)
|
|
||||||
endif (${WITH_FIO})
|
|
||||||
|
|
||||||
# vitastor-nbd
|
|
||||||
pkg_check_modules(NL3 libnl-3.0 libnl-genl-3.0)
|
|
||||||
add_executable(vitastor-nbd
|
|
||||||
nbd_proxy.cpp
|
|
||||||
)
|
|
||||||
target_include_directories(vitastor-nbd PUBLIC ${NL3_INCLUDE_DIRS})
|
|
||||||
target_link_libraries(vitastor-nbd vitastor_client ${NL3_LIBRARIES})
|
|
||||||
if (HAVE_NBD_NETLINK_H AND NL3_LIBRARIES)
|
|
||||||
target_compile_definitions(vitastor-nbd PUBLIC HAVE_NBD_NETLINK_H)
|
|
||||||
endif (HAVE_NBD_NETLINK_H AND NL3_LIBRARIES)
|
|
||||||
|
|
||||||
# libvitastor_kv.so
|
|
||||||
add_library(vitastor_kv SHARED
|
|
||||||
kv_db.cpp
|
|
||||||
kv_db.h
|
|
||||||
)
|
|
||||||
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
|
|
||||||
)
|
|
||||||
target_link_libraries(vitastor-kv-stress
|
|
||||||
vitastor_kv
|
|
||||||
)
|
|
||||||
|
|
||||||
# vitastor-nfs
|
|
||||||
add_executable(vitastor-nfs
|
|
||||||
nfs_proxy.cpp
|
|
||||||
nfs_block.cpp
|
|
||||||
nfs_kv.cpp
|
|
||||||
nfs_kv_create.cpp
|
|
||||||
nfs_kv_getattr.cpp
|
|
||||||
nfs_kv_link.cpp
|
|
||||||
nfs_kv_lookup.cpp
|
|
||||||
nfs_kv_read.cpp
|
|
||||||
nfs_kv_readdir.cpp
|
|
||||||
nfs_kv_remove.cpp
|
|
||||||
nfs_kv_rename.cpp
|
|
||||||
nfs_kv_setattr.cpp
|
|
||||||
nfs_kv_write.cpp
|
|
||||||
nfs_fsstat.cpp
|
|
||||||
nfs_mount.cpp
|
|
||||||
nfs_portmap.cpp
|
|
||||||
sha256.c
|
|
||||||
nfs/xdr_impl.cpp
|
|
||||||
nfs/rpc_xdr.cpp
|
|
||||||
nfs/portmap_xdr.cpp
|
|
||||||
nfs/nfs_xdr.cpp
|
|
||||||
)
|
|
||||||
target_link_libraries(vitastor-nfs
|
|
||||||
vitastor_client
|
|
||||||
vitastor_kv
|
|
||||||
)
|
|
||||||
|
|
||||||
# vitastor-cli
|
|
||||||
add_executable(vitastor-cli
|
|
||||||
cli.cpp
|
|
||||||
)
|
|
||||||
target_link_libraries(vitastor-cli
|
|
||||||
vitastor_client
|
|
||||||
)
|
|
||||||
configure_file(vitastor.pc.in vitastor.pc @ONLY)
|
|
||||||
|
|
||||||
# vitastor-disk
|
|
||||||
add_executable(vitastor-disk
|
|
||||||
disk_tool.cpp disk_simple_offsets.cpp
|
|
||||||
disk_tool_journal.cpp disk_tool_meta.cpp disk_tool_prepare.cpp disk_tool_resize.cpp disk_tool_udev.cpp disk_tool_utils.cpp disk_tool_upgrade.cpp
|
|
||||||
crc32c.c str_util.cpp ../json11/json11.cpp rw_blocking.cpp allocator.cpp ringloop.cpp blockstore_disk.cpp
|
|
||||||
)
|
|
||||||
target_link_libraries(vitastor-disk
|
|
||||||
tcmalloc_minimal
|
|
||||||
${LIBURING_LIBRARIES}
|
|
||||||
)
|
|
||||||
|
|
||||||
if (${WITH_QEMU})
|
|
||||||
# qemu_driver.so
|
|
||||||
add_library(qemu_vitastor SHARED
|
|
||||||
qemu_driver.c
|
|
||||||
)
|
|
||||||
target_compile_options(qemu_vitastor PUBLIC -DVITASTOR_SOURCE_TREE)
|
|
||||||
target_include_directories(qemu_vitastor PUBLIC
|
|
||||||
../qemu/b/qemu
|
|
||||||
../qemu/include
|
|
||||||
${GLIB_INCLUDE_DIRS}
|
|
||||||
)
|
|
||||||
target_link_libraries(qemu_vitastor
|
|
||||||
vitastor_client
|
|
||||||
)
|
|
||||||
set_target_properties(qemu_vitastor PROPERTIES
|
|
||||||
PREFIX ""
|
|
||||||
OUTPUT_NAME "block-vitastor"
|
|
||||||
)
|
|
||||||
endif (${WITH_QEMU})
|
|
||||||
|
|
||||||
### Test stubs
|
|
||||||
|
|
||||||
# stub_osd, stub_bench, osd_test
|
|
||||||
add_executable(stub_osd stub_osd.cpp rw_blocking.cpp addr_util.cpp)
|
|
||||||
target_link_libraries(stub_osd tcmalloc_minimal)
|
|
||||||
add_executable(stub_bench stub_bench.cpp rw_blocking.cpp addr_util.cpp)
|
|
||||||
target_link_libraries(stub_bench tcmalloc_minimal)
|
|
||||||
add_executable(osd_test osd_test.cpp rw_blocking.cpp addr_util.cpp)
|
|
||||||
target_link_libraries(osd_test tcmalloc_minimal)
|
|
||||||
|
|
||||||
# osd_rmw_test
|
|
||||||
add_executable(osd_rmw_test EXCLUDE_FROM_ALL osd_rmw_test.cpp allocator.cpp)
|
|
||||||
target_link_libraries(osd_rmw_test Jerasure ${ISAL_LIBRARIES} tcmalloc_minimal)
|
|
||||||
add_dependencies(build_tests osd_rmw_test)
|
|
||||||
add_test(NAME osd_rmw_test COMMAND osd_rmw_test)
|
|
||||||
|
|
||||||
if (ISAL_LIBRARIES)
|
|
||||||
add_executable(osd_rmw_test_je EXCLUDE_FROM_ALL osd_rmw_test.cpp allocator.cpp)
|
|
||||||
target_compile_definitions(osd_rmw_test_je PUBLIC -DNO_ISAL)
|
|
||||||
target_link_libraries(osd_rmw_test_je Jerasure tcmalloc_minimal)
|
|
||||||
add_dependencies(build_tests osd_rmw_test_je)
|
|
||||||
add_test(NAME osd_rmw_test_jerasure COMMAND osd_rmw_test_je)
|
|
||||||
endif (ISAL_LIBRARIES)
|
|
||||||
|
|
||||||
# stub_uring_osd
|
|
||||||
add_executable(stub_uring_osd
|
|
||||||
stub_uring_osd.cpp
|
|
||||||
)
|
|
||||||
target_link_libraries(stub_uring_osd
|
|
||||||
vitastor_common
|
|
||||||
${LIBURING_LIBRARIES}
|
|
||||||
${IBVERBS_LIBRARIES}
|
|
||||||
tcmalloc_minimal
|
|
||||||
)
|
|
||||||
|
|
||||||
# osd_peering_pg_test
|
|
||||||
add_executable(osd_peering_pg_test EXCLUDE_FROM_ALL osd_peering_pg_test.cpp osd_peering_pg.cpp)
|
|
||||||
target_link_libraries(osd_peering_pg_test tcmalloc_minimal)
|
|
||||||
add_dependencies(build_tests osd_peering_pg_test)
|
|
||||||
add_test(NAME osd_peering_pg_test COMMAND osd_peering_pg_test)
|
|
||||||
|
|
||||||
# test_allocator
|
|
||||||
add_executable(test_allocator EXCLUDE_FROM_ALL test_allocator.cpp allocator.cpp)
|
|
||||||
add_dependencies(build_tests test_allocator)
|
|
||||||
add_test(NAME test_allocator COMMAND test_allocator)
|
|
||||||
|
|
||||||
# test_cas
|
|
||||||
add_executable(test_cas
|
|
||||||
test_cas.cpp
|
|
||||||
)
|
|
||||||
target_link_libraries(test_cas
|
|
||||||
vitastor_client
|
|
||||||
)
|
|
||||||
|
|
||||||
# test_crc32
|
|
||||||
add_executable(test_crc32
|
|
||||||
test_crc32.cpp
|
|
||||||
)
|
|
||||||
target_link_libraries(test_crc32
|
|
||||||
vitastor_blk
|
|
||||||
)
|
|
||||||
|
|
||||||
# test_cluster_client
|
|
||||||
add_executable(test_cluster_client
|
|
||||||
EXCLUDE_FROM_ALL
|
|
||||||
test_cluster_client.cpp
|
|
||||||
pg_states.cpp osd_ops.cpp cluster_client.cpp cluster_client_list.cpp cluster_client_wb.cpp msgr_op.cpp mock/messenger.cpp msgr_stop.cpp
|
|
||||||
etcd_state_client.cpp timerfd_manager.cpp str_util.cpp ../json11/json11.cpp
|
|
||||||
)
|
|
||||||
target_compile_definitions(test_cluster_client PUBLIC -D__MOCK__)
|
|
||||||
target_include_directories(test_cluster_client PUBLIC ${CMAKE_SOURCE_DIR}/src/mock)
|
|
||||||
add_dependencies(build_tests test_cluster_client)
|
|
||||||
add_test(NAME test_cluster_client COMMAND test_cluster_client)
|
|
||||||
|
|
||||||
## test_blockstore, test_shit
|
|
||||||
#add_executable(test_blockstore test_blockstore.cpp)
|
|
||||||
#target_link_libraries(test_blockstore blockstore)
|
|
||||||
#add_executable(test_shit test_shit.cpp osd_peering_pg.cpp)
|
|
||||||
#target_link_libraries(test_shit ${LIBURING_LIBRARIES} m)
|
|
||||||
|
|
||||||
### Install
|
### Install
|
||||||
|
|
||||||
|
@ -378,7 +106,7 @@ install(
|
||||||
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
||||||
PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
|
PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
|
||||||
)
|
)
|
||||||
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/vitastor.pc DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig)
|
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/client/vitastor.pc DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig)
|
||||||
if (${WITH_FIO})
|
if (${WITH_FIO})
|
||||||
install(TARGETS fio_vitastor fio_vitastor_blk fio_vitastor_sec LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR})
|
install(TARGETS fio_vitastor fio_vitastor_blk fio_vitastor_sec LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR})
|
||||||
endif (${WITH_FIO})
|
endif (${WITH_FIO})
|
||||||
|
|
|
@ -0,0 +1,27 @@
|
||||||
|
cmake_minimum_required(VERSION 2.8.12)
|
||||||
|
|
||||||
|
project(vitastor)
|
||||||
|
|
||||||
|
# libvitastor_blk.so
|
||||||
|
add_library(vitastor_blk SHARED
|
||||||
|
../util/allocator.cpp blockstore.cpp blockstore_impl.cpp blockstore_disk.cpp blockstore_init.cpp blockstore_open.cpp blockstore_journal.cpp blockstore_read.cpp
|
||||||
|
blockstore_write.cpp blockstore_sync.cpp blockstore_stable.cpp blockstore_rollback.cpp blockstore_flush.cpp ../util/crc32c.c ../util/ringloop.cpp
|
||||||
|
)
|
||||||
|
target_link_libraries(vitastor_blk
|
||||||
|
${LIBURING_LIBRARIES}
|
||||||
|
tcmalloc_minimal
|
||||||
|
# for timerfd_manager
|
||||||
|
vitastor_common
|
||||||
|
)
|
||||||
|
set_target_properties(vitastor_blk PROPERTIES VERSION ${VERSION} SOVERSION 0)
|
||||||
|
|
||||||
|
if (${WITH_FIO})
|
||||||
|
# libfio_vitastor_blk.so
|
||||||
|
add_library(fio_vitastor_blk SHARED
|
||||||
|
fio_engine.cpp
|
||||||
|
../../json11/json11.cpp
|
||||||
|
)
|
||||||
|
target_link_libraries(fio_vitastor_blk
|
||||||
|
vitastor_blk
|
||||||
|
)
|
||||||
|
endif (${WITH_FIO})
|
|
@ -0,0 +1,95 @@
|
||||||
|
cmake_minimum_required(VERSION 2.8.12)
|
||||||
|
|
||||||
|
project(vitastor)
|
||||||
|
|
||||||
|
# libvitastor_common.a
|
||||||
|
set(MSGR_RDMA "")
|
||||||
|
if (IBVERBS_LIBRARIES)
|
||||||
|
set(MSGR_RDMA "msgr_rdma.cpp")
|
||||||
|
endif (IBVERBS_LIBRARIES)
|
||||||
|
add_library(vitastor_common STATIC
|
||||||
|
../util/epoll_manager.cpp etcd_state_client.cpp messenger.cpp ../util/addr_util.cpp
|
||||||
|
msgr_stop.cpp msgr_op.cpp msgr_send.cpp msgr_receive.cpp ../util/ringloop.cpp ../../json11/json11.cpp
|
||||||
|
http_client.cpp osd_ops.cpp pg_states.cpp ../util/timerfd_manager.cpp ../util/str_util.cpp ${MSGR_RDMA}
|
||||||
|
)
|
||||||
|
target_compile_options(vitastor_common PUBLIC -fPIC)
|
||||||
|
|
||||||
|
# libvitastor_client.so
|
||||||
|
add_library(vitastor_client SHARED
|
||||||
|
cluster_client.cpp
|
||||||
|
cluster_client_list.cpp
|
||||||
|
cluster_client_wb.cpp
|
||||||
|
vitastor_c.cpp
|
||||||
|
)
|
||||||
|
set_target_properties(vitastor_client PROPERTIES PUBLIC_HEADER "client/vitastor_c.h")
|
||||||
|
target_link_libraries(vitastor_client
|
||||||
|
vitastor_common
|
||||||
|
vitastor_cli
|
||||||
|
${LIBURING_LIBRARIES}
|
||||||
|
${IBVERBS_LIBRARIES}
|
||||||
|
)
|
||||||
|
set_target_properties(vitastor_client PROPERTIES VERSION ${VERSION} SOVERSION 0)
|
||||||
|
configure_file(vitastor.pc.in vitastor.pc @ONLY)
|
||||||
|
|
||||||
|
if (${WITH_FIO})
|
||||||
|
# libfio_vitastor.so
|
||||||
|
add_library(fio_vitastor SHARED
|
||||||
|
fio_cluster.cpp
|
||||||
|
)
|
||||||
|
target_link_libraries(fio_vitastor
|
||||||
|
vitastor_client
|
||||||
|
)
|
||||||
|
|
||||||
|
# libfio_vitastor_sec.so
|
||||||
|
add_library(fio_vitastor_sec SHARED
|
||||||
|
fio_sec_osd.cpp
|
||||||
|
../util/rw_blocking.cpp
|
||||||
|
../util/addr_util.cpp
|
||||||
|
)
|
||||||
|
target_link_libraries(fio_vitastor_sec
|
||||||
|
tcmalloc_minimal
|
||||||
|
)
|
||||||
|
endif (${WITH_FIO})
|
||||||
|
|
||||||
|
# vitastor-nbd
|
||||||
|
pkg_check_modules(NL3 libnl-3.0 libnl-genl-3.0)
|
||||||
|
add_executable(vitastor-nbd
|
||||||
|
nbd_proxy.cpp
|
||||||
|
)
|
||||||
|
target_include_directories(vitastor-nbd PUBLIC ${NL3_INCLUDE_DIRS})
|
||||||
|
target_link_libraries(vitastor-nbd vitastor_client ${NL3_LIBRARIES})
|
||||||
|
if (HAVE_NBD_NETLINK_H AND NL3_LIBRARIES)
|
||||||
|
target_compile_definitions(vitastor-nbd PUBLIC HAVE_NBD_NETLINK_H)
|
||||||
|
endif (HAVE_NBD_NETLINK_H AND NL3_LIBRARIES)
|
||||||
|
|
||||||
|
if (${WITH_QEMU})
|
||||||
|
# qemu_driver.so
|
||||||
|
add_library(qemu_vitastor SHARED
|
||||||
|
qemu_driver.c
|
||||||
|
)
|
||||||
|
target_compile_options(qemu_vitastor PUBLIC -DVITASTOR_SOURCE_TREE)
|
||||||
|
target_include_directories(qemu_vitastor PUBLIC
|
||||||
|
../../qemu/b/qemu
|
||||||
|
../../qemu/include
|
||||||
|
${GLIB_INCLUDE_DIRS}
|
||||||
|
)
|
||||||
|
target_link_libraries(qemu_vitastor
|
||||||
|
vitastor_client
|
||||||
|
)
|
||||||
|
set_target_properties(qemu_vitastor PROPERTIES
|
||||||
|
PREFIX ""
|
||||||
|
OUTPUT_NAME "block-vitastor"
|
||||||
|
)
|
||||||
|
endif (${WITH_QEMU})
|
||||||
|
|
||||||
|
# test_cluster_client
|
||||||
|
add_executable(test_cluster_client
|
||||||
|
EXCLUDE_FROM_ALL
|
||||||
|
../test/test_cluster_client.cpp
|
||||||
|
pg_states.cpp osd_ops.cpp cluster_client.cpp cluster_client_list.cpp cluster_client_wb.cpp msgr_op.cpp ../test/mock/messenger.cpp msgr_stop.cpp
|
||||||
|
etcd_state_client.cpp ../util/timerfd_manager.cpp ../util/str_util.cpp ../../json11/json11.cpp
|
||||||
|
)
|
||||||
|
target_compile_definitions(test_cluster_client PUBLIC -D__MOCK__)
|
||||||
|
target_include_directories(test_cluster_client BEFORE PUBLIC ${CMAKE_SOURCE_DIR}/src/test/mock)
|
||||||
|
add_dependencies(build_tests test_cluster_client)
|
||||||
|
add_test(NAME test_cluster_client COMMAND test_cluster_client)
|
|
@ -20,9 +20,11 @@
|
||||||
#define MAX_DATA_BLOCK_SIZE 128*1024*1024
|
#define MAX_DATA_BLOCK_SIZE 128*1024*1024
|
||||||
#define DEFAULT_BITMAP_GRANULARITY 4096
|
#define DEFAULT_BITMAP_GRANULARITY 4096
|
||||||
|
|
||||||
|
#ifndef IMMEDIATE_NONE
|
||||||
#define IMMEDIATE_NONE 0
|
#define IMMEDIATE_NONE 0
|
||||||
#define IMMEDIATE_SMALL 1
|
#define IMMEDIATE_SMALL 1
|
||||||
#define IMMEDIATE_ALL 2
|
#define IMMEDIATE_ALL 2
|
||||||
|
#endif
|
||||||
|
|
||||||
struct etcd_kv_t
|
struct etcd_kv_t
|
||||||
{
|
{
|
|
@ -200,6 +200,11 @@ vitastor_c *vitastor_c_create_epoll_json(const char **options, int options_len)
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void* vitastor_c_get_internal_client(vitastor_c *client)
|
||||||
|
{
|
||||||
|
return client->cli;
|
||||||
|
}
|
||||||
|
|
||||||
void vitastor_c_destroy(vitastor_c *client)
|
void vitastor_c_destroy(vitastor_c *client)
|
||||||
{
|
{
|
||||||
delete client->cli;
|
delete client->cli;
|
||||||
|
@ -379,4 +384,12 @@ int vitastor_c_inode_get_readonly(void *handle)
|
||||||
return watch->cfg.readonly;
|
return watch->cfg.readonly;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
uint32_t vitastor_c_inode_get_immediate_commit(vitastor_c *client, uint64_t inode_num)
|
||||||
|
{
|
||||||
|
auto pool_it = client->cli->st_cli.pool_config.find(INODE_POOL(inode_num));
|
||||||
|
if (pool_it == client->cli->st_cli.pool_config.end())
|
||||||
|
return 0;
|
||||||
|
return pool_it->second.immediate_commit;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
|
@ -7,11 +7,18 @@
|
||||||
#define VITASTOR_QEMU_PROXY_H
|
#define VITASTOR_QEMU_PROXY_H
|
||||||
|
|
||||||
// C API wrapper version
|
// C API wrapper version
|
||||||
#define VITASTOR_C_API_VERSION 3
|
#define VITASTOR_C_API_VERSION 4
|
||||||
|
|
||||||
#ifndef POOL_ID_BITS
|
#ifndef POOL_ID_BITS
|
||||||
#define POOL_ID_BITS 16
|
#define POOL_ID_BITS 16
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifndef IMMEDIATE_NONE
|
||||||
|
#define IMMEDIATE_NONE 0
|
||||||
|
#define IMMEDIATE_SMALL 1
|
||||||
|
#define IMMEDIATE_ALL 2
|
||||||
|
#endif
|
||||||
|
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <sys/uio.h>
|
#include <sys/uio.h>
|
||||||
|
|
||||||
|
@ -41,6 +48,7 @@ vitastor_c *vitastor_c_create_uring(const char *config_path, const char *etcd_ho
|
||||||
int use_rdma, const char *rdma_device, int rdma_port_num, int rdma_gid_index, int rdma_mtu, int log_level);
|
int use_rdma, const char *rdma_device, int rdma_port_num, int rdma_gid_index, int rdma_mtu, int log_level);
|
||||||
vitastor_c *vitastor_c_create_uring_json(const char **options, int options_len);
|
vitastor_c *vitastor_c_create_uring_json(const char **options, int options_len);
|
||||||
vitastor_c *vitastor_c_create_epoll_json(const char **options, int options_len);
|
vitastor_c *vitastor_c_create_epoll_json(const char **options, int options_len);
|
||||||
|
void* vitastor_c_get_internal_client(vitastor_c *client);
|
||||||
void vitastor_c_destroy(vitastor_c *client);
|
void vitastor_c_destroy(vitastor_c *client);
|
||||||
int vitastor_c_is_ready(vitastor_c *client);
|
int vitastor_c_is_ready(vitastor_c *client);
|
||||||
int vitastor_c_uring_register_eventfd(vitastor_c *client);
|
int vitastor_c_uring_register_eventfd(vitastor_c *client);
|
||||||
|
@ -64,6 +72,8 @@ uint64_t vitastor_c_inode_get_num(void *handle);
|
||||||
uint32_t vitastor_c_inode_get_block_size(vitastor_c *client, uint64_t inode_num);
|
uint32_t vitastor_c_inode_get_block_size(vitastor_c *client, uint64_t inode_num);
|
||||||
uint32_t vitastor_c_inode_get_bitmap_granularity(vitastor_c *client, uint64_t inode_num);
|
uint32_t vitastor_c_inode_get_bitmap_granularity(vitastor_c *client, uint64_t inode_num);
|
||||||
int vitastor_c_inode_get_readonly(void *handle);
|
int vitastor_c_inode_get_readonly(void *handle);
|
||||||
|
// Returns IMMEDIATE_ALL, IMMEDIATE_SMALL or IMMEDIATE_NONE
|
||||||
|
uint32_t vitastor_c_inode_get_immediate_commit(vitastor_c *client, uint64_t inode_num);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
|
@ -0,0 +1,34 @@
|
||||||
|
cmake_minimum_required(VERSION 2.8.12)
|
||||||
|
|
||||||
|
project(vitastor)
|
||||||
|
|
||||||
|
# libvitastor_cli.a
|
||||||
|
add_library(vitastor_cli STATIC
|
||||||
|
cli_common.cpp
|
||||||
|
cli_alloc_osd.cpp
|
||||||
|
cli_status.cpp
|
||||||
|
cli_describe.cpp
|
||||||
|
cli_fix.cpp
|
||||||
|
cli_ls.cpp
|
||||||
|
cli_create.cpp
|
||||||
|
cli_modify.cpp
|
||||||
|
cli_flatten.cpp
|
||||||
|
cli_merge.cpp
|
||||||
|
cli_rm_data.cpp
|
||||||
|
cli_rm.cpp
|
||||||
|
cli_rm_osd.cpp
|
||||||
|
cli_pool_cfg.cpp
|
||||||
|
cli_pool_create.cpp
|
||||||
|
cli_pool_ls.cpp
|
||||||
|
cli_pool_modify.cpp
|
||||||
|
cli_pool_rm.cpp
|
||||||
|
)
|
||||||
|
target_compile_options(vitastor_cli PUBLIC -fPIC)
|
||||||
|
|
||||||
|
# vitastor-cli
|
||||||
|
add_executable(vitastor-cli
|
||||||
|
cli.cpp
|
||||||
|
)
|
||||||
|
target_link_libraries(vitastor-cli
|
||||||
|
vitastor_client
|
||||||
|
)
|
|
@ -71,7 +71,7 @@ std::string validate_pool_config(json11::Json::object & new_cfg, json11::Json ol
|
||||||
auto & key = kv_it->first;
|
auto & key = kv_it->first;
|
||||||
auto & value = kv_it->second;
|
auto & value = kv_it->second;
|
||||||
if (key == "pg_size" || key == "parity_chunks" || key == "pg_minsize" ||
|
if (key == "pg_size" || key == "parity_chunks" || key == "pg_minsize" ||
|
||||||
key == "pg_count" || key == "max_osd_combinations" || key == "block_size" ||
|
key == "pg_count" || key == "max_osd_combinations" ||
|
||||||
key == "bitmap_granularity" || key == "pg_stripe_size")
|
key == "bitmap_granularity" || key == "pg_stripe_size")
|
||||||
{
|
{
|
||||||
if (value.is_number() && value.uint64_value() != value.number_value() ||
|
if (value.is_number() && value.uint64_value() != value.number_value() ||
|
||||||
|
@ -81,6 +81,14 @@ std::string validate_pool_config(json11::Json::object & new_cfg, json11::Json ol
|
||||||
}
|
}
|
||||||
value = value.uint64_value();
|
value = value.uint64_value();
|
||||||
}
|
}
|
||||||
|
else if (key == "block_size")
|
||||||
|
{
|
||||||
|
uint64_t block_size = value.is_string() ? parse_size(value.string_value()) : value.uint64_value();
|
||||||
|
if (!block_size)
|
||||||
|
{
|
||||||
|
return key+" must be an integer with or without size suffix (K/M/G/T)";
|
||||||
|
}
|
||||||
|
}
|
||||||
else if (key == "name" || key == "scheme" || key == "immediate_commit" ||
|
else if (key == "name" || key == "scheme" || key == "immediate_commit" ||
|
||||||
key == "failure_domain" || key == "root_node" || key == "scrub_interval" || key == "used_for_fs" ||
|
key == "failure_domain" || key == "root_node" || key == "scrub_interval" || key == "used_for_fs" ||
|
||||||
key == "raw_placement")
|
key == "raw_placement")
|
|
@ -0,0 +1,14 @@
|
||||||
|
cmake_minimum_required(VERSION 2.8.12)
|
||||||
|
|
||||||
|
project(vitastor)
|
||||||
|
|
||||||
|
# vitastor-disk
|
||||||
|
add_executable(vitastor-disk
|
||||||
|
disk_tool.cpp disk_simple_offsets.cpp
|
||||||
|
disk_tool_journal.cpp disk_tool_meta.cpp disk_tool_prepare.cpp disk_tool_resize.cpp disk_tool_udev.cpp disk_tool_utils.cpp disk_tool_upgrade.cpp
|
||||||
|
../util/crc32c.c ../util/str_util.cpp ../../json11/json11.cpp ../util/rw_blocking.cpp ../util/allocator.cpp ../util/ringloop.cpp ../blockstore/blockstore_disk.cpp
|
||||||
|
)
|
||||||
|
target_link_libraries(vitastor-disk
|
||||||
|
tcmalloc_minimal
|
||||||
|
${LIBURING_LIBRARIES}
|
||||||
|
)
|
|
@ -0,0 +1,28 @@
|
||||||
|
cmake_minimum_required(VERSION 2.8.12)
|
||||||
|
|
||||||
|
project(vitastor)
|
||||||
|
|
||||||
|
# libvitastor_kv.so
|
||||||
|
add_library(vitastor_kv SHARED
|
||||||
|
kv_db.cpp
|
||||||
|
)
|
||||||
|
set_target_properties(vitastor_kv PROPERTIES PUBLIC_HEADER "kv/vitastor_kv.h")
|
||||||
|
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
|
||||||
|
)
|
||||||
|
target_link_libraries(vitastor-kv-stress
|
||||||
|
vitastor_kv
|
||||||
|
)
|
|
@ -12,16 +12,17 @@
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
//#include <signal.h>
|
//#include <signal.h>
|
||||||
|
|
||||||
|
#include "cluster_client.h"
|
||||||
#include "epoll_manager.h"
|
#include "epoll_manager.h"
|
||||||
#include "str_util.h"
|
#include "str_util.h"
|
||||||
#include "kv_db.h"
|
#include "vitastor_kv.h"
|
||||||
|
|
||||||
const char *exe_name = NULL;
|
const char *exe_name = NULL;
|
||||||
|
|
||||||
class kv_cli_t
|
class kv_cli_t
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
json11::Json::object cfg;
|
std::map<std::string, std::string> cfg;
|
||||||
std::vector<std::string> cli_cmd;
|
std::vector<std::string> cli_cmd;
|
||||||
|
|
||||||
kv_dbw_t *db = NULL;
|
kv_dbw_t *db = NULL;
|
||||||
|
@ -156,7 +157,7 @@ void kv_cli_t::run()
|
||||||
if (cfg.find("db") != cfg.end())
|
if (cfg.find("db") != cfg.end())
|
||||||
{
|
{
|
||||||
bool done = false;
|
bool done = false;
|
||||||
handle_cmd({ "open", cfg.at("db").string_value() }, [&done](int res) { if (res != 0) exit(1); done = true; });
|
handle_cmd({ "open", cfg.at("db") }, [&done](int res) { if (res != 0) exit(1); done = true; });
|
||||||
while (!done)
|
while (!done)
|
||||||
{
|
{
|
||||||
ringloop->loop();
|
ringloop->loop();
|
|
@ -15,7 +15,7 @@
|
||||||
|
|
||||||
#include "cluster_client.h"
|
#include "cluster_client.h"
|
||||||
#include "str_util.h"
|
#include "str_util.h"
|
||||||
#include "kv_db.h"
|
#include "vitastor_kv.h"
|
||||||
|
|
||||||
// 0x VITASTOR OPTBTREE
|
// 0x VITASTOR OPTBTREE
|
||||||
#define KV_BLOCK_MAGIC 0x761A5106097B18EE
|
#define KV_BLOCK_MAGIC 0x761A5106097B18EE
|
||||||
|
@ -1969,12 +1969,12 @@ kv_dbw_t::~kv_dbw_t()
|
||||||
delete db;
|
delete db;
|
||||||
}
|
}
|
||||||
|
|
||||||
void kv_dbw_t::open(inode_t inode_id, json11::Json cfg, std::function<void(int)> cb)
|
void kv_dbw_t::open(uint64_t inode_id, std::map<std::string, std::string> cfg, std::function<void(int)> cb)
|
||||||
{
|
{
|
||||||
db->open(inode_id, cfg, cb);
|
db->open(inode_id, cfg, cb);
|
||||||
}
|
}
|
||||||
|
|
||||||
void kv_dbw_t::set_config(json11::Json cfg)
|
void kv_dbw_t::set_config(std::map<std::string, std::string> cfg)
|
||||||
{
|
{
|
||||||
db->set_config(cfg);
|
db->set_config(cfg);
|
||||||
}
|
}
|
|
@ -12,9 +12,10 @@
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
//#include <signal.h>
|
//#include <signal.h>
|
||||||
|
|
||||||
|
#include "cluster_client.h"
|
||||||
#include "epoll_manager.h"
|
#include "epoll_manager.h"
|
||||||
#include "str_util.h"
|
#include "str_util.h"
|
||||||
#include "kv_db.h"
|
#include "vitastor_kv.h"
|
||||||
|
|
||||||
const char *exe_name = NULL;
|
const char *exe_name = NULL;
|
||||||
|
|
||||||
|
@ -44,7 +45,7 @@ class kv_test_t
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
// Config
|
// Config
|
||||||
json11::Json::object kv_cfg;
|
std::map<std::string, std::string> kv_cfg;
|
||||||
std::string key_prefix, key_suffix;
|
std::string key_prefix, key_suffix;
|
||||||
uint64_t inode_id = 0;
|
uint64_t inode_id = 0;
|
||||||
uint64_t op_count = 1000000;
|
uint64_t op_count = 1000000;
|
||||||
|
@ -238,22 +239,22 @@ void kv_test_t::parse_config(json11::Json cfg)
|
||||||
if (!cfg["stop_on_error"].is_null())
|
if (!cfg["stop_on_error"].is_null())
|
||||||
stop_on_error = cfg["stop_on_error"].bool_value();
|
stop_on_error = cfg["stop_on_error"].bool_value();
|
||||||
if (!cfg["kv_block_size"].is_null())
|
if (!cfg["kv_block_size"].is_null())
|
||||||
kv_cfg["kv_block_size"] = cfg["kv_block_size"];
|
kv_cfg["kv_block_size"] = cfg["kv_block_size"].as_string();
|
||||||
if (!cfg["kv_memory_limit"].is_null())
|
if (!cfg["kv_memory_limit"].is_null())
|
||||||
kv_cfg["kv_memory_limit"] = cfg["kv_memory_limit"];
|
kv_cfg["kv_memory_limit"] = cfg["kv_memory_limit"].as_string();
|
||||||
if (!cfg["kv_allocate_blocks"].is_null())
|
if (!cfg["kv_allocate_blocks"].is_null())
|
||||||
kv_cfg["kv_allocate_blocks"] = cfg["kv_allocate_blocks"];
|
kv_cfg["kv_allocate_blocks"] = cfg["kv_allocate_blocks"].as_string();
|
||||||
if (!cfg["kv_evict_max_misses"].is_null())
|
if (!cfg["kv_evict_max_misses"].is_null())
|
||||||
kv_cfg["kv_evict_max_misses"] = cfg["kv_evict_max_misses"];
|
kv_cfg["kv_evict_max_misses"] = cfg["kv_evict_max_misses"].as_string();
|
||||||
if (!cfg["kv_evict_attempts_per_level"].is_null())
|
if (!cfg["kv_evict_attempts_per_level"].is_null())
|
||||||
kv_cfg["kv_evict_attempts_per_level"] = cfg["kv_evict_attempts_per_level"];
|
kv_cfg["kv_evict_attempts_per_level"] = cfg["kv_evict_attempts_per_level"].as_string();
|
||||||
if (!cfg["kv_evict_unused_age"].is_null())
|
if (!cfg["kv_evict_unused_age"].is_null())
|
||||||
kv_cfg["kv_evict_unused_age"] = cfg["kv_evict_unused_age"];
|
kv_cfg["kv_evict_unused_age"] = cfg["kv_evict_unused_age"].as_string();
|
||||||
if (!cfg["kv_log_level"].is_null())
|
if (!cfg["kv_log_level"].is_null())
|
||||||
{
|
{
|
||||||
log_level = cfg["kv_log_level"].uint64_value();
|
log_level = cfg["kv_log_level"].uint64_value();
|
||||||
trace = log_level >= 10;
|
trace = log_level >= 10;
|
||||||
kv_cfg["kv_log_level"] = cfg["kv_log_level"];
|
kv_cfg["kv_log_level"] = std::to_string(log_level);
|
||||||
}
|
}
|
||||||
total_prob = reopen_prob+get_prob+add_prob+update_prob+del_prob+list_prob;
|
total_prob = reopen_prob+get_prob+add_prob+update_prob+del_prob+list_prob;
|
||||||
stat.get.name = "get";
|
stat.get.name = "get";
|
|
@ -6,17 +6,27 @@
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "cluster_client.h"
|
#include <stdint.h>
|
||||||
|
#include <sys/uio.h>
|
||||||
|
|
||||||
|
#include <string>
|
||||||
|
#include <map>
|
||||||
|
#include <functional>
|
||||||
|
|
||||||
|
#define VITASTOR_KV_API_VERSION 1
|
||||||
|
|
||||||
|
class cluster_client_t;
|
||||||
|
|
||||||
struct kv_db_t;
|
struct kv_db_t;
|
||||||
|
|
||||||
struct kv_dbw_t
|
struct kv_dbw_t
|
||||||
{
|
{
|
||||||
|
// cli = vitastor_c_get_internal_client(client)
|
||||||
kv_dbw_t(cluster_client_t *cli);
|
kv_dbw_t(cluster_client_t *cli);
|
||||||
~kv_dbw_t();
|
~kv_dbw_t();
|
||||||
|
|
||||||
void open(inode_t inode_id, json11::Json cfg, std::function<void(int)> cb);
|
void open(uint64_t inode_id, std::map<std::string, std::string> cfg, std::function<void(int)> cb);
|
||||||
void set_config(json11::Json cfg);
|
void set_config(std::map<std::string, std::string> cfg);
|
||||||
void close(std::function<void()> cb);
|
void close(std::function<void()> cb);
|
||||||
|
|
||||||
uint64_t get_size();
|
uint64_t get_size();
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue