Stop K/V listings at the end of their range #111
Closed
koolkhel
wants to merge 2 commits from
koolkhel/vitastor:kv-list-end into master
pull from: koolkhel/vitastor:kv-list-end
merge into: vitalif:master
vitalif:master
vitalif:fatal-error-hook
vitalif:primary-stickiness
vitalif:libvfn
vitalif:canceling
vitalif:immediate-repeering
vitalif:rdma-close-tcp
vitalif:use-degraded-writes
vitalif:fix-write-delete-flow
vitalif:openssl-3.0.12
vitalif:openssl-capture-secrets
vitalif:ignore-small-rdma-end
vitalif:encrypt-batch
vitalif:faster-peering-calc
vitalif:http-hello
vitalif:xxh3-bench
vitalif:create-user-etcd-based
vitalif:aesxts_streaming_nosupport
vitalif:refactor-heap-continue-write
vitalif:ston3lu-patch-0127
vitalif:rdma-credits
vitalif:heap-meta
vitalif:sendmsg-zc-no-more-error
vitalif:fix-clear-refs
vitalif:veeam-trick
vitalif:test-etcd-schizo
vitalif:test
vitalif:test1
vitalif:test2
vitalif:cow-meta
vitalif:kv-readahead
vitalif:qemu-fix-crash-idea
vitalif:eventloop-auto-init-trigger
vitalif:hugo-docs
vitalif:node-mutex-and-postpone
vitalif:check-writeback
vitalif:msgr-iothreads-v2
vitalif:antietcd
vitalif:rel-1.4
vitalif:test-fix-ec-unknown-state-51
vitalif:kv-update
vitalif:kv-debug
vitalif:hotfix-1.2.0
vitalif:rdma-simple-nodp
vitalif:zerocopy-tcp-send
vitalif:csi-staging
vitalif:hotfix-1.1.0
vitalif:hotfix-1.0.0
vitalif:fsync-feedback
vitalif:cached-reads
vitalif:qemu-send-loop
vitalif:test-double-alloc
vitalif:hier-failure-domains
vitalif:mon-self-restart
vitalif:epoch-deletions
vitalif:rdma-flow-control
vitalif:csi-use-vitastor-cli
vitalif:rdma-v2
vitalif:etcd-hide-base64
vitalif:lrc-matrix
vitalif:rm-left-on-dead
vitalif:nfs-proxy-old
vitalif:non-odp-rdma
vitalif:test-zctr
vitalif:separate-data-connections
vitalif:sec_osd_msgr
vitalif:test-assert
vitalif:nbd-vmsplice
vitalif:allow-etcd-address-option
vitalif:rdma-zerocopy
vitalif:rel-0.5
vitalif:openonload
vitalif:sync-io-test
vitalif:trace-sync
vitalif:trace-sqes
vitalif:test-submit-and-wait
vitalif:test-sq-poll
vitalif:blocking-uring-test
Reference in New Issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
No description provided.
Delete Branch "koolkhel/vitastor:kv-list-end"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Description
K/V blocks emptied by deletes are never freed (the "FIXME We may want to merge blocks" in
kv_db.cpp). A listing that runs past the end of its range walks every empty block up to the next existing key, re-checking each block's version on an OSD.The NFS proxy runs into this all the time:
For a new directory, these listings run past the end of the directory entries, through the emptied blocks of every deleted entry and inode, up to the next live key. So RMDIR gets slower with every file ever deleted.
We hit it on a test cluster of 5 VMs and 25 OSDs. After a few metadata-heavy benchmark runs, RMDIR took 190–410 ms instead of 4–5 ms. In the test added here, 50 RMDIRs take 262 ms on a new filesystem and 6954 ms after 10,000 K/V keys were created and deleted.
1. Add an end key to K/V listings
vitastorkv_dbw_t::list_start(start, end)stops at the first key>= end, and does not read any block beyond it.list_start(start)is unchanged, with the same symbol.vitastor-kv list|dump|dumpjson <start> <end>now pass theendargument they already parsed.tests/test_kv_list_bounds.sh, which needs no mount.2. Stop NFS prefix scans at the end of the prefix
tests/test_nfs_list_bounds.sh. It times 50 RMDIRs before and after creating and deleting 10,000 keys right after the newest directories' entries, and fails above twice. It also renames a directory over an empty one.Not included: freeing or merging empty blocks, so the image still grows with churn. A listing inside a range whose keys were mostly deleted still walks its empty blocks.
Testing:
tests/test_kv_list_bounds.sh,test_kv_stress.shandIMMEDIATE_COMMIT=1 test_kv_stress.shpass, on Ubuntu 24.04.test_nfs_list_bounds.sh,test_nfs.sh,test_nfs_long_readdir.shandtest_kv_list_bounds.shpass on a Debian-12-based VM, built innode:16-bookworm. That build had no ASAN: the ASAN build crashed at start under the tests'ASAN_OPTIONSon that VM.test_nfs_list_bounds.shfails on master at the RMDIR check: 262 ms before, 6954 ms after..gitea/workflows/test.ymlis regenerated withtests-to-yaml.pl.b1fd7548. The series rebases onto current master without changes, master has not touched the code since, andvitastor-kvandvitastor-nfsbuild.Contributor Name
Yury Luneff (MIND Software LLC, https://mindsw.io)
CLA
Замержил без этих тестов, но в test_nfs добавил тест на переименование поверх пустой директории
Pull request closed