Upgraded Qdrant Edge to v0.9.0

This commit is contained in:
Thorsten Sommer committed 2026-11-24 19:31:36 +01:00
1 parent 9b4d07552d
commit 6ebcc28755
6 files changed
+220 -414

No files matched your search

+66 -256
View File
@@ -245,15 +245,6 @@ dependencies = [
"syn 2.0.119",
]
[[package]]
name = "arrayvec"
version = "0.4.12"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cd9fd44efafa8690358b7408d253adf110036b88f55672a933f01d616ad9b1b9"
dependencies = [
"nodrop",
]
[[package]]
name = "arrayvec"
version = "0.7.8"
@@ -583,7 +574,7 @@ dependencies = [
"aligned",
"anyhow",
"arg_enum_proc_macro",
"arrayvec 0.7.8",
"arrayvec",
"log",
"num-rational",
"num-traits",
@@ -601,7 +592,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8cfddb07216410377231960af4fcab838eaa12e013417781b78bd95ee22077f8"
dependencies = [
"anyhow",
"arrayvec 0.7.8",
"arrayvec",
"log",
"nom 8.0.0",
"num-rational",
@@ -614,7 +605,7 @@ version = "0.8.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e7178fe5f7d460b13895ebb9dcb28a3a6216d2df2574a0806cb51b555d297f38"
dependencies = [
"arrayvec 0.7.8",
"arrayvec",
]
[[package]]
@@ -806,12 +797,6 @@ dependencies = [
"bit-vec 0.10.2",
]
[[package]]
name = "bit-vec"
version = "0.6.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "349f9b6a179ed607305526ca489b34ad0a41aed5f7980fa90eb03160b69598fb"
[[package]]
name = "bit-vec"
version = "0.8.0"
@@ -893,16 +878,6 @@ dependencies = [
"wyz",
]
[[package]]
name = "blake2-rfc"
version = "0.2.18"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5d6d530bdd2d52966a6d03b7a964add7ae1a288d25214066fd4b600f0f796400"
dependencies = [
"arrayvec 0.4.12",
"constant_time_eq 0.1.5",
]
[[package]]
name = "blink-alloc"
version = "0.4.0"
@@ -1012,6 +987,12 @@ version = "3.20.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "87a0cf66fd1eb2fb7b822cb78370d82303750809bc6ba855f3f58e517d3238db"
[[package]]
name = "bytecount"
version = "0.6.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "175812e0be2bccb6abe50bb8d566126198344f707e304f45c648fd8f2cc0365e"
[[package]]
name = "bytemuck"
version = "1.25.2"
@@ -1179,9 +1160,9 @@ dependencies = [
[[package]]
name = "cedarwood"
version = "0.4.6"
version = "0.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6d910bedd62c24733263d0bed247460853c9d22e8956bd4cd964302095e04e90"
checksum = "c0524a528a6a0288df1863c3c20fe92c301875b4941e7b6c4b394ab08c5a4c55"
dependencies = [
"smallvec",
]
@@ -1225,20 +1206,6 @@ version = "0.2.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f079e83a288787bcd14a6aea84cee5c87a67c5a3e660c30f557a3d24761b3527"
[[package]]
name = "cgroups-rs"
version = "0.5.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "25ae79ba89081d30804e3312bb1163ab82cc8dca0a1b16275e55fb19fce4e89b"
dependencies = [
"bit-vec 0.6.3",
"libc",
"log",
"nix 0.25.1",
"thiserror 1.0.69",
"zbus",
]
[[package]]
name = "chacha20"
version = "0.10.2"
@@ -1252,9 +1219,9 @@ dependencies = [
[[package]]
name = "charabia"
version = "0.9.9"
version = "0.10.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "51689ee7cc84c8de789fc2874711d816055b93406cfd4135c40d1c82dd24b928"
checksum = "27d98f4c66de52108210ee491c9c991513021dfd259bf65e4bbd889687b488d7"
dependencies = [
"aho-corasick",
"csv",
@@ -1430,12 +1397,6 @@ version = "0.10.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "be95d4a884358a21a199689323c29e9256b4a1b315e22f183d155422041d3a9a"
[[package]]
name = "constant_time_eq"
version = "0.1.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "245097e9a4535ee1e3e3931fcfcd55a796a44c643e8596ff6566d68f09b87bbc"
[[package]]
name = "constant_time_eq"
version = "0.6.1"
@@ -2145,11 +2106,6 @@ name = "duplicate"
version = "2.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8e92f10a49176cbffacaedabfaa11d51db1ea0f80a83c26e1873b43cd1742c24"
dependencies = [
"heck 0.5.0",
"proc-macro2",
"proc-macro2-diagnostics",
]
[[package]]
name = "dyn-clone"
@@ -2163,15 +2119,6 @@ version = "0.4.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4a742b95783b1f45b900129082cbc47717b6a77ee8d17eea70a8ea62462f5de3"
[[package]]
name = "earcut"
version = "0.4.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "88459a2a8e3a514b6e6de38cf3aaa9250a894cb098f74a932db77fcc8341b6d0"
dependencies = [
"num-traits",
]
[[package]]
name = "ebml-iterable"
version = "0.6.3"
@@ -2830,7 +2777,6 @@ version = "0.33.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "30eb1fdc57c1e5cfd11826fe0caec4b9dc7901f3758263bb506228d88c8d9e9a"
dependencies = [
"earcut",
"float_next_after",
"geo-types",
"geographiclib-rs",
@@ -2842,7 +2788,6 @@ dependencies = [
"robust",
"rstar",
"sif-itree",
"spade",
]
[[package]]
@@ -2853,10 +2798,8 @@ checksum = "777d18aa0f12f8b285331cd867133ee14422b3f023f6d388034c47d43e28786a"
dependencies = [
"approx",
"num-traits",
"rayon",
"rstar",
"serde",
"spade",
"thiserror 2.0.21",
]
@@ -3162,16 +3105,6 @@ version = "0.12.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888"
[[package]]
name = "hashbrown"
version = "0.14.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e5274423e17b7c9fc20b6e7e208532f9b19825d82dfd615708b70edd83df41f1"
dependencies = [
"ahash",
"allocator-api2 0.2.21",
]
[[package]]
name = "hashbrown"
version = "0.15.5"
@@ -3382,19 +3315,6 @@ dependencies = [
"tower-service",
]
[[package]]
name = "hyper-timeout"
version = "0.5.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2b90d566bffbce6a75bd8b09a05aa8c2cb1fabb6cb348f8840c9e4c90a0d83b0"
dependencies = [
"hyper",
"hyper-util",
"pin-project-lite",
"tokio",
"tower-service",
]
[[package]]
name = "hyper-util"
version = "0.1.21"
@@ -3435,9 +3355,6 @@ name = "i_key_sort"
version = "0.10.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d73d122b937fca067feb0ad74f62388920272b27c356d4df2d0cfdd59e044cf0"
dependencies = [
"rayon",
]
[[package]]
name = "i_overlay"
@@ -3449,7 +3366,6 @@ dependencies = [
"i_key_sort",
"i_shape",
"i_tree",
"rayon",
]
[[package]]
@@ -3868,24 +3784,24 @@ dependencies = [
[[package]]
name = "jieba-macros"
version = "0.8.1"
version = "0.10.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "348294e44ee7e3c42685da656490f8febc7359632544019621588902216da95c"
checksum = "455f837e9d0255b68a712200db247c68fdad4941b72471b76bfa61c3b0c1f79f"
dependencies = [
"phf_codegen 0.13.1",
]
[[package]]
name = "jieba-rs"
version = "0.8.1"
version = "0.10.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "766bd7012aa5ba49411ebdf4e93bddd59b182d2918e085d58dec5bb9b54b7105"
checksum = "b6a8bbb0f77ee810f0689a30b7cec56b875751ef4ec2e74fd995613dc52b3ae1"
dependencies = [
"bytecount",
"cedarwood",
"include-flate",
"jieba-macros",
"phf 0.13.1",
"regex",
"rustc-hash",
]
@@ -4661,18 +4577,6 @@ version = "1.0.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "650eef8c711430f1a879fdd01d4745a7deea475becfb90269c06775983bbf086"
[[package]]
name = "nix"
version = "0.25.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f346ff70e7dbfd675fe90590b92d59ef2de15a8779ae305ebcbfd3f0caf59be4"
dependencies = [
"autocfg",
"bitflags 1.3.2",
"cfg-if",
"libc",
]
[[package]]
name = "nix"
version = "0.31.4"
@@ -4706,12 +4610,6 @@ dependencies = [
"memchr",
]
[[package]]
name = "nodrop"
version = "0.1.14"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "72ef4a56884ca558e5ddb05a1d1e7e1bfd9a68d9ed024c21704cc98872dae1bb"
[[package]]
name = "nom"
version = "7.1.3"
@@ -4811,6 +4709,17 @@ dependencies = [
"syn 2.0.119",
]
[[package]]
name = "num-derive"
version = "0.5.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e4e98dc3b890f6c23a0f9d3d491a2823d0dea0fa656302a13dd225fa924112a8"
dependencies = [
"proc-macro2",
"quote",
"syn 3.0.10",
]
[[package]]
name = "num-integer"
version = "0.1.47"
@@ -5433,15 +5342,6 @@ version = "2.3.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9b4f627cb1b25917193a259e49bdad08f671f8d9708acfd5fe0a8c1455d87220"
[[package]]
name = "permutation_iterator"
version = "0.1.2"
source = "git+https://github.com/SommerEngineering/permutation-iterator-rs.git?rev=76836ed316d18dfef530ba908f58481c343e80d7#76836ed316d18dfef530ba908f58481c343e80d7"
dependencies = [
"blake2-rfc",
"rand 0.8.8",
]
[[package]]
name = "petgraph"
version = "0.6.5"
@@ -5583,26 +5483,6 @@ dependencies = [
"siphasher",
]
[[package]]
name = "pin-project"
version = "1.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a6c2123f4708bbd422630a6dae7c03f678b1ce1f1c99e4c4b3beac69c8174cc9"
dependencies = [
"pin-project-internal",
]
[[package]]
name = "pin-project-internal"
version = "1.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "358938fd6df944c1e44bb328b60fb275f13c804aac47ba26a1165d45a3f87756"
dependencies = [
"proc-macro2",
"quote",
"syn 3.0.10",
]
[[package]]
name = "pin-project-lite"
version = "0.2.18"
@@ -5824,18 +5704,6 @@ dependencies = [
"unicode-ident",
]
[[package]]
name = "proc-macro2-diagnostics"
version = "0.10.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "af066a9c399a26e020ada66a034357a868728e72cd426f3adcd35f80d88d88c8"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.119",
"version_check",
]
[[package]]
name = "procfs"
version = "0.18.0"
@@ -5884,13 +5752,14 @@ checksum = "d55d956fa96f5ec02be2e13af0e20391a5aa83d6a074e3ad368959d0fab299ea"
[[package]]
name = "qdrant-edge"
version = "0.8.0"
version = "0.9.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0b8072302c87506a34bffec9bc16dbdcd36df8ab1321406b6e141530348c7e54"
checksum = "0bf059f7c7f5145aea9b8ccfea3e6f9bcf7d0fd2440132a1489c02124473468c"
dependencies = [
"ahash",
"aligned-vec",
"arrayvec 0.7.8",
"arc-swap",
"arrayvec",
"atomic_refcell",
"atomicwrites",
"bincode 1.3.3",
@@ -5900,7 +5769,6 @@ dependencies = [
"bytemuck",
"byteorder",
"cc",
"cgroups-rs",
"charabia",
"chrono",
"core_affinity",
@@ -5914,6 +5782,7 @@ dependencies = [
"fs-err",
"fs4",
"fs_extra",
"futures",
"geo",
"geohash",
"half 2.7.1",
@@ -5925,26 +5794,26 @@ dependencies = [
"log",
"lz4_flex",
"macro_rules_attribute",
"memchr",
"memmap2",
"murmur3_32",
"nix 0.31.4",
"nom 8.0.0",
"num-cmp",
"num-derive",
"num-derive 0.5.1",
"num-traits",
"num_cpus",
"once_cell",
"ordered-float 5.5.1",
"parking_lot",
"permutation_iterator",
"ph",
"pin-project-lite",
"procfs",
"qdrant-rust-stemmers",
"quick_cache",
"rand 0.10.4",
"rand_distr",
"rayon",
"rmp-serde",
"roaring",
"rustix 1.1.6",
"schemars 0.8.22",
@@ -5961,6 +5830,7 @@ dependencies = [
"slab",
"smallvec",
"strum",
"stumpalo",
"sysinfo",
"tap",
"tar",
@@ -5969,12 +5839,12 @@ dependencies = [
"thread-priority",
"tinyvec",
"tokio",
"tonic",
"uuid",
"validator",
"vaporetto",
"walkdir",
"zerocopy",
"zstd",
]
[[package]]
@@ -6066,8 +5936,6 @@ version = "0.8.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e058c7de0b26af77780c769414d6257830bb240f3c38477dbc2c16e5f54d6d4c"
dependencies = [
"libc",
"rand_chacha 0.3.1",
"rand_core 0.6.4",
"serde",
]
@@ -6093,16 +5961,6 @@ dependencies = [
"rand_core 0.10.1",
]
[[package]]
name = "rand_chacha"
version = "0.3.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88"
dependencies = [
"ppv-lite86",
"rand_core 0.6.4",
]
[[package]]
name = "rand_chacha"
version = "0.9.0"
@@ -6129,7 +5987,6 @@ version = "0.6.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c"
dependencies = [
"getrandom 0.2.17",
"serde",
]
@@ -6176,7 +6033,7 @@ dependencies = [
"aligned-vec",
"arbitrary",
"arg_enum_proc_macro",
"arrayvec 0.7.8",
"arrayvec",
"av-scenechange",
"av1-grain",
"bitstream-io",
@@ -6190,7 +6047,7 @@ dependencies = [
"maybe-rayon",
"new_debug_unreachable",
"noop_proc_macro",
"num-derive",
"num-derive 0.4.2",
"num-traits",
"paste",
"profiling",
@@ -6268,6 +6125,12 @@ dependencies = [
"yasna",
]
[[package]]
name = "readme-rustdocifier"
version = "0.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "08ad765b21a08b1a8e5cdce052719188a23772bcbefb3c439f0baaf62c56ceac"
[[package]]
name = "realfft"
version = "3.5.1"
@@ -6442,25 +6305,6 @@ version = "1.0.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3582f63211428f83597b51b2ddb88e2a91a9d52d12831f9d08f5e624e8977422"
[[package]]
name = "rmp"
version = "0.8.15"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4ba8be72d372b2c9b35542551678538b562e7cf86c3315773cae48dfbfe7790c"
dependencies = [
"num-traits",
]
[[package]]
name = "rmp-serde"
version = "1.3.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "72f81bee8c8ef9b577d1681a70ebbc962c232461e397b22c208c43c04b67a155"
dependencies = [
"rmp",
"serde",
]
[[package]]
name = "roaring"
version = "0.11.5"
@@ -6591,7 +6435,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "48e13bd8c0e9365c43cfa5c9e8f9ad49d3c8444926c9aac819e0e4dc503c8fdf"
dependencies = [
"aws-lc-rs",
"log",
"once_cell",
"ring",
"rustls-pki-types",
@@ -7242,18 +7085,6 @@ dependencies = [
"system-deps",
]
[[package]]
name = "spade"
version = "2.15.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9699399fd9349b00b184f5635b074f9ec93afffef30c853f8c875b32c0f8c7fa"
dependencies = [
"hashbrown 0.16.1",
"num-traits",
"robust",
"smallvec",
]
[[package]]
name = "spm_precompiled"
version = "0.1.4"
@@ -7371,6 +7202,16 @@ dependencies = [
"syn 2.0.119",
]
[[package]]
name = "stumpalo"
version = "1.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a7087fbef8befbb581d82b2040acf5aae5c851f60427adfcc30fefd54124fb62"
dependencies = [
"readme-rustdocifier",
"rustc_version",
]
[[package]]
name = "subtle"
version = "2.6.1"
@@ -8504,38 +8345,6 @@ version = "1.2.0+spec-1.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "009dbb7700f11c55ef83aebbe4c0e9cf1f1ac0844bd8d6f00dc38f302026e13a"
[[package]]
name = "tonic"
version = "0.14.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e2cdfc673aabd30fe8fee92e65837b644c37c5d47f0f97ae6d5e0f1237d15e1b"
dependencies = [
"async-trait",
"axum",
"base64 0.22.1",
"bytes",
"flate2",
"h2",
"http",
"http-body",
"http-body-util",
"hyper",
"hyper-timeout",
"hyper-util",
"percent-encoding",
"pin-project",
"socket2",
"sync_wrapper",
"tokio",
"tokio-rustls",
"tokio-stream",
"tokio-util",
"tower",
"tower-layer",
"tower-service",
"tracing",
]
[[package]]
name = "tower"
version = "0.5.3"
@@ -8544,12 +8353,9 @@ checksum = "ebe5ef63511595f1344e2d5cfa636d973292adc0eec1f0ad45fae9f0851ab1d4"
dependencies = [
"futures-core",
"futures-util",
"indexmap 2.14.2",
"pin-project-lite",
"slab",
"sync_wrapper",
"tokio",
"tokio-util",
"tower-layer",
"tower-service",
"tracing",
@@ -9275,12 +9081,11 @@ checksum = "a28ac98ddc8b9274cb41bb4d9d4d5c425b6020c50c46f25559911905610b4a88"
[[package]]
name = "whatlang"
version = "0.16.4"
version = "0.18.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "471d1c1645d361eb782a1650b1786a8fb58dd625e681a04c09f5ff7c8764a7b0"
checksum = "f5e8f38b596e2a359b755342473520a99421e43658548c79489ee221b728c107"
dependencies = [
"hashbrown 0.14.5",
"once_cell",
"hashbrown 0.15.5",
]
[[package]]
@@ -10149,7 +9954,7 @@ version = "9.8.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a9534624d547e3f516ecde0ed9a70d37788f01d340efcfdd03bf3ea8e163c1d0"
dependencies = [
"constant_time_eq 0.6.1",
"constant_time_eq",
"crc32fast",
"flate2",
"getrandom 0.4.3",
@@ -10279,3 +10084,8 @@ dependencies = [
"syn 3.0.10",
"winnow 1.0.5",
]
[[patch.unused]]
name = "permutation_iterator"
version = "0.1.2"
source = "git+https://github.com/SommerEngineering/permutation-iterator-rs.git?rev=76836ed316d18dfef530ba908f58481c343e80d7#76836ed316d18dfef530ba908f58481c343e80d7"
+1 -1
View File
@@ -90,7 +90,7 @@ tempfile = "3.27.0"
strum_macros = "0.28.0"
sysinfo = "0.39.6"
bytes = "1.12.2"
qdrant-edge = "0.8.0"
qdrant-edge = "0.9.0"
# Prompt-injection detection. `regex` gives us linear-time matching without backtracking, so
# a hostile document cannot make a scan blow up, and `aho-corasick` matches the ~1600 fixed
+123 -155
View File
@@ -32,7 +32,10 @@ const STORE_INITIALIZATION_MARKER_TEMP: &str = "store_name.tmp";
const STORE_DISPLAY_NAME_MARKER: &str = "data_source_name.txt";
const STORE_DISPLAY_NAME_MARKER_TEMP: &str = "data_source_name.tmp";
const WAL_DIRECTORY: &str = "wal";
const CLOSED_WAL_SEGMENT_PREFIX: &str = "closed-";
/// The file in which Qdrant Edge notes how far its WAL is acknowledged, see `acknowledge_legacy_wal`.
const WAL_FIRST_INDEX_FILE: &str = "first-index";
const WAL_FIRST_INDEX_FILE_TEMP: &str = "first-index.tmp";
/// The directory below the data directory in which a backup collects its copies, one directory per
/// backup. The app removes a backup's directory once the backup is written.
@@ -338,7 +341,7 @@ impl QdrantEdgeDatabase {
}
let shard = if is_initialized {
compact_wal(&path, store_name);
acknowledge_legacy_wal(&path, store_name);
match EdgeShard::load(&path, None) {
Ok(shard) => shard,
Err(error) => return Err(StoreUnreadableError::new(store_name, &path, error).into()),
@@ -380,7 +383,7 @@ impl QdrantEdgeDatabase {
return Ok(None);
}
compact_wal(&path, store_name);
acknowledge_legacy_wal(&path, store_name);
let shard = match EdgeShard::load(&path, None) {
Ok(shard) => shard,
Err(error) => return Err(StoreUnreadableError::new(store_name, &path, error).into()),
@@ -618,16 +621,6 @@ impl QdrantEdgeDatabase {
info!(Source = "Qdrant Edge"; "Optimized vector store '{}'.", store_name);
}
shard.flush()?;
// Temporary compatibility shim, see compact_wal: without this, the WAL of a long session
// keeps growing until the next start. The store has to be unloaded first, because Windows
// cannot delete memory-mapped files. The next request loads it again.
let path = self.store_path(store_name)?;
if has_obsolete_wal_segments(&path) {
drop(self.shards.remove(store_name));
compact_wal(&path, store_name);
}
Ok(())
}
@@ -1140,15 +1133,25 @@ fn remove_obsolete_qdrant_path(path: &Path) {
}
}
// `on_disk` and `on_disk_payload` are deprecated in favor of `memory` and `payload_memory`. We keep
// them on purpose, so that a new store looks exactly like the existing ones. Older versions of AI
// Studio use qdrant-edge 0.8, which knows no `memory` for vectors: it would take such a store for
// one kept in RAM, find that its segments disagree, and refuse to open it. Leaving the flags unset is
// not an option either: the effective placement would fall back to cached instead of on-disk, which
// is a real change and would have the optimizers rebuild the HNSW graph.
#[allow(deprecated)]
fn edge_config(vector_size: usize) -> EdgeConfig {
EdgeConfig {
on_disk_payload: Some(true),
payload_memory: None,
id_tracker_memory: None,
vectors: HashMap::from([(
VECTOR_NAME.to_string(),
EdgeVectorParams {
size: vector_size,
distance: Distance::Cosine,
on_disk: Some(true),
memory: None,
quantization_config: None,
multivector_config: None,
datatype: None,
@@ -1160,15 +1163,15 @@ fn edge_config(vector_size: usize) -> EdgeConfig {
quantization_config: None,
optimizers: Some(edge_optimizers_config()),
wal_options: None,
// Keeps the WAL, like every existing store. Qdrant Edge fixes this choice when it creates a store.
wal_enabled: None,
max_search_threads: None,
search_pool_core: None,
}
}
// `on_disk` is deprecated in favor of `memory`, but Qdrant Edge does not re-export the `Memory`
// type, so the new field cannot be named from here. Leaving both unset is not an option either:
// the effective placement would fall back to cached instead of on-disk, which is a real change
// and would have the optimizers rebuild the HNSW graph.
// See edge_config for why this sets the deprecated `on_disk`.
#[allow(deprecated)]
fn hnsw_config() -> HnswIndexConfig {
HnswIndexConfig {
@@ -1240,77 +1243,27 @@ fn remove_partial_store(path: &Path) -> String {
}
}
// Temporary compatibility shim until a qdrant-edge release acknowledges its WAL by itself:
// documentation/compatibility-shims/2026-10-qdrant-edge-wal-compaction.md
// Temporary compatibility shim until a qdrant-edge release skips already persisted operations when
// it loads a store: documentation/compatibility-shims/2026-11-qdrant-edge-legacy-wal.md
//
// Qdrant Edge writes every update to its WAL, but never acknowledges the WAL and never replays it,
// so the WAL grows with every update. We flush after every update, which means the segments already
// hold everything the WAL contains. The store must not be loaded while this runs.
fn compact_wal(store_path: &Path, store_name: &str) {
match remove_obsolete_wal_segments(&store_path.join(WAL_DIRECTORY)) {
Ok((0, _)) => {},
Ok((removed_segments, removed_bytes)) => info!(Source = "Qdrant Edge"; "Removed {removed_segments} obsolete WAL segment(s) with {:.1} MiB from vector store '{store_name}'.", removed_bytes as f64 / (1024.0 * 1024.0)),
Err(error) => warn!(Source = "Qdrant Edge"; "Could not remove the obsolete WAL segments of vector store '{store_name}': {error}"),
}
}
/// Whether the store's WAL holds segments which `compact_wal` would remove.
fn has_obsolete_wal_segments(store_path: &Path) -> bool {
wal_file_names(&store_path.join(WAL_DIRECTORY))
.is_ok_and(|file_names| !obsolete_wal_segments(&file_names).is_empty())
}
/// Removes the obsolete closed segments, oldest first, and returns their number and size. When a
/// removal fails, the segments left over are still contiguous, so Qdrant Edge can open the WAL.
fn remove_obsolete_wal_segments(wal_path: &Path) -> std::io::Result<(usize, u64)> {
let mut removed_segments = 0;
let mut removed_bytes = 0;
for file_name in obsolete_wal_segments(&wal_file_names(wal_path)?) {
let segment_path = wal_path.join(file_name);
let segment_size = fs::metadata(&segment_path)?.len();
fs::remove_file(&segment_path)?;
removed_segments += 1;
removed_bytes += segment_size;
// Up to qdrant-edge 0.8, Qdrant Edge never acknowledged its WAL. Since 0.9, loading a store applies
// every operation of the WAL again which is not marked as acknowledged, so the first load of a store
// from an older version would apply its whole WAL once more. Each deletion of a document in there
// reads every payload of the store, which takes minutes to hours for a large one, and all requests
// to the vector database wait meanwhile. We flush after every update, so the segments already hold
// everything the WAL contains, and marking all of it as acknowledged loses nothing. Qdrant Edge
// lowers the mark to the last entry of the WAL. The store must not be loaded while this runs.
fn acknowledge_legacy_wal(store_path: &Path, store_name: &str) {
let wal_path = store_path.join(WAL_DIRECTORY);
if !wal_path.is_dir() || wal_path.join(WAL_FIRST_INDEX_FILE).exists() {
return;
}
Ok((removed_segments, removed_bytes))
}
fn wal_file_names(wal_path: &Path) -> std::io::Result<Vec<String>> {
if !wal_path.is_dir() {
return Ok(Vec::new());
let acknowledged_everything = json!({ "ack_index": u64::MAX }).to_string();
match write_store_marker(&wal_path, WAL_FIRST_INDEX_FILE, WAL_FIRST_INDEX_FILE_TEMP, &acknowledged_everything) {
Ok(()) => info!(Source = "Qdrant Edge"; "Marked the WAL of vector store '{store_name}' as acknowledged, since an older version of AI Studio wrote it."),
Err(error) => warn!(Source = "Qdrant Edge"; "Could not mark the WAL of vector store '{store_name}' as acknowledged, so loading the store applies the whole WAL once more: {error}"),
}
// Every file counts: a closed segment missing from this list would leave a gap behind.
let mut file_names = Vec::new();
for entry in fs::read_dir(wal_path)? {
let entry = entry?;
if entry.file_type()?.is_file() && let Ok(file_name) = entry.file_name().into_string() {
file_names.push(file_name);
}
}
Ok(file_names)
}
/// The closed WAL segments which may go, oldest first. That is all of them except the newest:
/// Qdrant Edge numbers its operations from the first closed segment and would start again at zero
/// without one. The segments then ignore every later update of a point they already know.
fn obsolete_wal_segments(file_names: &[String]) -> Vec<String> {
let mut closed_segments = file_names
.iter()
.filter_map(|file_name| {
let start_index = file_name.strip_prefix(CLOSED_WAL_SEGMENT_PREFIX)?.parse::<u64>().ok()?;
Some((start_index, file_name.clone()))
})
.collect::<Vec<_>>();
closed_segments.sort_unstable_by_key(|(start_index, _)| *start_index);
closed_segments.pop();
closed_segments
.into_iter()
.map(|(_, file_name)| file_name)
.collect()
}
fn validate_vector_size(vector_size: usize) -> QdrantEdgeResult<()> {
@@ -1845,85 +1798,79 @@ mod tests {
}
#[test]
fn obsolete_wal_segments_keeps_the_newest_closed_segment() {
let file_names = ["closed-120", "open-7", "closed-0", "tmp-open-8", "closed-40", ".wal", "first-index", "closed-abc"].map(String::from);
fn the_wal_keeps_only_the_newest_closed_segment() {
let test_directory = test_directory("wal-acknowledged");
let (database, _, most_closed_segments_at_once) = store_with_a_rolled_over_wal(&test_directory);
// Sorted by number, not by name: as text, "closed-40" would come after "closed-120".
assert_eq!(obsolete_wal_segments(&file_names), vec!["closed-0", "closed-40"]);
// Qdrant Edge acknowledges its WAL when it flushes, and keeps the newest closed segment to
// number its operations on. Should this fail, the WAL grows with every update again, as it
// did up to qdrant-edge 0.8.
assert_eq!(most_closed_segments_at_once, 1);
assert!(obsolete_wal_segments(&["closed-0", "open-1"].map(String::from)).is_empty());
assert!(obsolete_wal_segments(&["open-1"].map(String::from)).is_empty());
drop(database);
fs::remove_dir_all(test_directory).unwrap();
}
#[test]
fn a_reloaded_store_drops_obsolete_wal_segments_and_keeps_its_points() {
fn an_update_after_a_reload_replaces_the_existing_point() {
let test_directory = test_directory("wal-reload");
let (database, point_ids) = store_with_several_closed_wal_segments(&test_directory);
let store_path = database.store_path(SEARCH_STORE).unwrap();
drop(database);
let mut database = QdrantEdgeDatabase::new(test_directory.clone());
let found = database.search_embedding(SEARCH_STORE, search_vector(), point_ids.len(), None, &[]).unwrap();
assert_eq!(closed_wal_segments(&store_path).len(), 1);
assert_eq!(
found_point_ids(&found).into_iter().collect::<HashSet<_>>(),
point_ids.iter().map(String::as_str).collect::<HashSet<_>>(),
"the points live in the segments, so removing WAL segments must not lose any of them"
);
drop(database);
fs::remove_dir_all(test_directory).unwrap();
}
#[test]
fn an_update_after_wal_compaction_replaces_the_existing_point() {
let test_directory = test_directory("wal-update");
let (database, point_ids) = store_with_several_closed_wal_segments(&test_directory);
drop(database);
// The newest point carries the highest operation number so far. Should the numbering start
// again after the compaction, the segment would ignore this update as outdated.
let newest_point_id = point_ids.last().unwrap();
let mut updated_point = test_point(newest_point_id, vec![0.0, 0.0, 1.0]);
updated_point.text = "Updated text.".to_string();
let mut database = QdrantEdgeDatabase::new(test_directory.clone());
database.insert_embedding(SEARCH_STORE, vec![updated_point]).unwrap();
let found = database
.search_embedding(SEARCH_STORE, search_vector(), 1, Some(vec![newest_point_id.clone()]), &[])
.unwrap();
assert_eq!(found.len(), 1);
assert_eq!(found[0].text, "Updated text.");
drop(database);
fs::remove_dir_all(test_directory).unwrap();
}
#[test]
fn optimize_removes_obsolete_wal_segments_of_a_loaded_store() {
let test_directory = test_directory("wal-optimize");
let (mut database, point_ids) = store_with_several_closed_wal_segments(&test_directory);
let store_path = database.store_path(SEARCH_STORE).unwrap();
let (mut database, point_ids, _) = store_with_a_rolled_over_wal(&test_directory);
database.optimize_store(SEARCH_STORE).unwrap();
assert_eq!(closed_wal_segments(&store_path).len(), 1);
// The next request loads the store again, with all its points and still taking updates.
let newest_point_id = point_ids.last().unwrap();
let mut updated_point = test_point(newest_point_id, vec![0.0, 0.0, 1.0]);
updated_point.text = "Updated text.".to_string();
database.insert_embedding(SEARCH_STORE, vec![updated_point]).unwrap();
drop(database);
let mut database = QdrantEdgeDatabase::new(test_directory.clone());
let found = database.search_embedding(SEARCH_STORE, search_vector(), point_ids.len(), None, &[]).unwrap();
assert_eq!(
found_point_ids(&found).into_iter().collect::<HashSet<_>>(),
point_ids.iter().map(String::as_str).collect::<HashSet<_>>()
);
let updated = found.iter().find(|result| &result.point_id == newest_point_id).unwrap();
assert_eq!(updated.text, "Updated text.");
// The newest point carries the highest operation number so far. Should the numbering start
// again after the reload, the segment would ignore this update as outdated.
assert_update_of_the_newest_point_takes_effect(&mut database, &point_ids);
drop(database);
fs::remove_dir_all(test_directory).unwrap();
}
#[test]
fn a_store_of_an_older_version_gets_its_wal_acknowledged_and_keeps_its_points() {
let test_directory = test_directory("wal-legacy");
let (database, point_ids, _) = store_with_a_rolled_over_wal(&test_directory);
let first_index_path = database.store_path(SEARCH_STORE).unwrap().join(WAL_DIRECTORY).join(WAL_FIRST_INDEX_FILE);
drop(database);
// Up to qdrant-edge 0.8, a WAL had no such file.
fs::remove_file(&first_index_path).unwrap();
let mut database = QdrantEdgeDatabase::new(test_directory.clone());
let found = database.search_embedding(SEARCH_STORE, search_vector(), point_ids.len(), None, &[]).unwrap();
let first_index: Value = fs::read_to_string(&first_index_path).unwrap().parse().unwrap();
assert_eq!(first_index["ack_index"].as_u64(), Some(u64::MAX));
assert_eq!(
found_point_ids(&found).into_iter().collect::<HashSet<_>>(),
point_ids.iter().map(String::as_str).collect::<HashSet<_>>(),
"the points live in the segments, so marking the WAL as acknowledged must not lose any of them"
);
// Marking the WAL must not start the numbering of operations again.
assert_update_of_the_newest_point_takes_effect(&mut database, &point_ids);
drop(database);
fs::remove_dir_all(test_directory).unwrap();
}
#[test]
fn an_acknowledged_wal_stays_as_it_is() {
let test_directory = test_directory("wal-first-index");
let database = store_with_one_point_per_axis(&test_directory);
let first_index_path = database.store_path(SEARCH_STORE).unwrap().join(WAL_DIRECTORY).join(WAL_FIRST_INDEX_FILE);
drop(database);
let first_index = fs::read_to_string(&first_index_path).unwrap();
let mut database = QdrantEdgeDatabase::new(test_directory.clone());
database.search_embedding(SEARCH_STORE, search_vector(), 3, None, &[]).unwrap();
assert_eq!(fs::read_to_string(&first_index_path).unwrap(), first_index);
drop(database);
fs::remove_dir_all(test_directory).unwrap();
@@ -2118,9 +2065,10 @@ mod tests {
database
}
/// A store with tiny WAL segments, filled one point at a time until the WAL has closed several
/// of them. Returns the database with the store still loaded, and the IDs in insertion order.
fn store_with_several_closed_wal_segments(test_directory: &Path) -> (QdrantEdgeDatabase, Vec<String>) {
/// A store with tiny WAL segments, filled one point at a time until the WAL has closed three of
/// them. Returns the database with the store still loaded, the IDs in insertion order, and the
/// most closed segments the WAL kept at once.
fn store_with_a_rolled_over_wal(test_directory: &Path) -> (QdrantEdgeDatabase, Vec<String>, usize) {
const SMALL_WAL_SEGMENT_CAPACITY: usize = 8 * 1024;
const MAX_POINTS: usize = 1_000;
@@ -2141,7 +2089,9 @@ mod tests {
write_store_initialization_marker(&store_path, SEARCH_STORE).unwrap();
let mut point_ids = Vec::new();
while closed_wal_segments(&store_path).len() < 3 {
let mut closed_segments_seen = HashSet::new();
let mut most_closed_segments_at_once = 0;
while closed_segments_seen.len() < 3 {
assert!(point_ids.len() < MAX_POINTS, "the WAL never closed enough segments");
let point_id = Uuid::from_u128(point_ids.len() as u128 + 1).to_string();
@@ -2149,19 +2099,37 @@ mod tests {
.insert_embedding(SEARCH_STORE, vec![test_point(&point_id, vec![1.0, point_ids.len() as f32, 1.0])])
.unwrap();
point_ids.push(point_id);
let closed_segments = closed_wal_segments(&store_path);
most_closed_segments_at_once = most_closed_segments_at_once.max(closed_segments.len());
closed_segments_seen.extend(closed_segments);
}
(database, point_ids)
(database, point_ids, most_closed_segments_at_once)
}
fn closed_wal_segments(store_path: &Path) -> Vec<String> {
fs::read_dir(store_path.join(WAL_DIRECTORY))
.unwrap()
.map(|entry| entry.unwrap().file_name().into_string().unwrap())
.filter(|file_name| file_name.starts_with(CLOSED_WAL_SEGMENT_PREFIX))
.filter(|file_name| file_name.starts_with("closed-"))
.collect()
}
/// Updates the newest of the given points and checks that a search finds its new text.
fn assert_update_of_the_newest_point_takes_effect(database: &mut QdrantEdgeDatabase, point_ids: &[String]) {
let newest_point_id = point_ids.last().unwrap();
let mut updated_point = test_point(newest_point_id, vec![0.0, 0.0, 1.0]);
updated_point.text = "Updated text.".to_string();
database.insert_embedding(SEARCH_STORE, vec![updated_point]).unwrap();
let found = database
.search_embedding(SEARCH_STORE, search_vector(), 1, Some(vec![newest_point_id.clone()]), &[])
.unwrap();
assert_eq!(found.len(), 1);
assert_eq!(found[0].text, "Updated text.");
}
/// Closest to the point on the x axis, then the one on the y axis, then the one on the z axis.
fn search_vector() -> Vec<f32> {
vec![1.0, 0.5, 0.0]