pigeonhole-db 1.1.0 → 1.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 6112428e9e5815a4ceab94e2ee520ef63d1ab237f87ffba0d1935183866b0daa
4
- data.tar.gz: 6acd6dfa278a29c0df775973b451686c1afbd3730832a6a493e87da7b4354d17
3
+ metadata.gz: 5843373eee407c373d91151d9c94ade8987afc3a74fd8f2c9247b53baeeb37a7
4
+ data.tar.gz: f0732e251608ae585181cdfc560a6c7ab30f503618e75123f0ff1385e32e4765
5
5
  SHA512:
6
- metadata.gz: 7381a5b7b08d209cfb4cd76b3fc0b9d3aba3b175811791b1abe1851bac9c47054196404c1d691b383272f2979a96984a9eda368b1c6846985517ac7d6eb459fa
7
- data.tar.gz: 6f7ca4131bae8d28edc5f858d8a2ef6d3a6eaf24f1f7113b80f51f19ab5d844e68a5d264b8bc15c37cfed3bdabc3c0219cd5e8700061cbfd7dbbb462ef56293b
6
+ metadata.gz: 9d27327297933b70cb6cb6db9b1345605d98aaefdbac6f04aab5feddd80ab313e9a4b0a37f84b93cc805c6a7f54a73a41a1aab95df113ab4ea0082129ec4561e
7
+ data.tar.gz: 361b6be94b648bc1b96c52915cd4833ef50a77ee52cfdfccfa44e8fb93e270b2919c21d28677d3c659b9db053bf4525257e27eebb527a1fffeb01e5538b4cbf4
data/Cargo.lock CHANGED
@@ -367,7 +367,7 @@ checksum = "9f7c3e4beb33f85d45ae3e3a1792185706c8e16d043238c593331cc7cd313b50"
367
367
 
368
368
  [[package]]
369
369
  name = "pigeonhole"
370
- version = "1.1.0"
370
+ version = "1.1.2"
371
371
  dependencies = [
372
372
  "arc-swap",
373
373
  "futures-core",
@@ -380,14 +380,14 @@ dependencies = [
380
380
 
381
381
  [[package]]
382
382
  name = "pigeonhole-cache"
383
- version = "2.0.0"
383
+ version = "2.0.2"
384
384
  dependencies = [
385
385
  "pigeonhole-io",
386
386
  ]
387
387
 
388
388
  [[package]]
389
389
  name = "pigeonhole-compaction"
390
- version = "2.0.0"
390
+ version = "2.0.2"
391
391
  dependencies = [
392
392
  "pigeonhole-cache",
393
393
  "pigeonhole-format",
@@ -398,7 +398,7 @@ dependencies = [
398
398
 
399
399
  [[package]]
400
400
  name = "pigeonhole-engine"
401
- version = "2.0.0"
401
+ version = "2.0.2"
402
402
  dependencies = [
403
403
  "arc-swap",
404
404
  "loom",
@@ -417,7 +417,7 @@ dependencies = [
417
417
 
418
418
  [[package]]
419
419
  name = "pigeonhole-format"
420
- version = "2.0.0"
420
+ version = "2.0.2"
421
421
  dependencies = [
422
422
  "crc-fast",
423
423
  "foldhash",
@@ -429,7 +429,7 @@ dependencies = [
429
429
 
430
430
  [[package]]
431
431
  name = "pigeonhole-io"
432
- version = "2.0.0"
432
+ version = "2.0.2"
433
433
  dependencies = [
434
434
  "io-uring",
435
435
  "libc",
@@ -440,7 +440,7 @@ dependencies = [
440
440
 
441
441
  [[package]]
442
442
  name = "pigeonhole-memory"
443
- version = "1.1.0"
443
+ version = "1.1.2"
444
444
  dependencies = [
445
445
  "getrandom 0.3.4",
446
446
  "pigeonhole",
@@ -451,7 +451,7 @@ dependencies = [
451
451
 
452
452
  [[package]]
453
453
  name = "pigeonhole-memtable"
454
- version = "2.0.0"
454
+ version = "2.0.2"
455
455
  dependencies = [
456
456
  "pigeonhole-format",
457
457
  "pigeonhole-io",
@@ -459,7 +459,7 @@ dependencies = [
459
459
 
460
460
  [[package]]
461
461
  name = "pigeonhole-pager"
462
- version = "2.0.0"
462
+ version = "2.0.2"
463
463
  dependencies = [
464
464
  "pigeonhole-format",
465
465
  "pigeonhole-io",
@@ -467,7 +467,7 @@ dependencies = [
467
467
 
468
468
  [[package]]
469
469
  name = "pigeonhole-ruby"
470
- version = "1.1.0"
470
+ version = "1.1.2"
471
471
  dependencies = [
472
472
  "magnus",
473
473
  "pigeonhole",
@@ -479,14 +479,14 @@ dependencies = [
479
479
 
480
480
  [[package]]
481
481
  name = "pigeonhole-runtime"
482
- version = "2.0.0"
482
+ version = "2.0.2"
483
483
  dependencies = [
484
484
  "pigeonhole-io",
485
485
  ]
486
486
 
487
487
  [[package]]
488
488
  name = "pigeonhole-shm"
489
- version = "2.0.0"
489
+ version = "2.0.2"
490
490
  dependencies = [
491
491
  "pigeonhole-format",
492
492
  "pigeonhole-io",
@@ -494,7 +494,7 @@ dependencies = [
494
494
 
495
495
  [[package]]
496
496
  name = "pigeonhole-sst"
497
- version = "2.0.0"
497
+ version = "2.0.2"
498
498
  dependencies = [
499
499
  "pigeonhole-cache",
500
500
  "pigeonhole-format",
@@ -503,7 +503,7 @@ dependencies = [
503
503
 
504
504
  [[package]]
505
505
  name = "pigeonhole-text"
506
- version = "1.1.0"
506
+ version = "1.1.2"
507
507
  dependencies = [
508
508
  "levenshtein_automata",
509
509
  "pigeonhole",
@@ -513,7 +513,7 @@ dependencies = [
513
513
 
514
514
  [[package]]
515
515
  name = "pigeonhole-vector"
516
- version = "1.1.0"
516
+ version = "1.1.2"
517
517
  dependencies = [
518
518
  "futures-core",
519
519
  "pigeonhole",
@@ -521,7 +521,7 @@ dependencies = [
521
521
 
522
522
  [[package]]
523
523
  name = "pigeonhole-wal"
524
- version = "2.0.0"
524
+ version = "2.0.2"
525
525
  dependencies = [
526
526
  "pigeonhole-format",
527
527
  "pigeonhole-io",
data/Cargo.toml CHANGED
@@ -5,16 +5,16 @@ features = ["bytes"]
5
5
  version = "0.9"
6
6
  [dependencies.pigeonhole]
7
7
  path = "vendor/pigeonhole"
8
- version = "1.1.0"
8
+ version = "1.1.2"
9
9
  [dependencies.pigeonhole-memory]
10
10
  path = "vendor/memory"
11
- version = "1.1.0"
11
+ version = "1.1.2"
12
12
  [dependencies.pigeonhole-text]
13
13
  path = "vendor/text"
14
- version = "1.1.0"
14
+ version = "1.1.2"
15
15
  [dependencies.pigeonhole-vector]
16
16
  path = "vendor/vector"
17
- version = "1.1.0"
17
+ version = "1.1.2"
18
18
  [dependencies.rb-sys]
19
19
  version = "0.9"
20
20
  [lib]
@@ -37,7 +37,7 @@ name = "pigeonhole-ruby"
37
37
  publish = false
38
38
  repository = "https://github.com/CodingAnarchy/pigeonhole"
39
39
  rust-version = "1.96"
40
- version = "1.1.0"
40
+ version = "1.1.2"
41
41
  [profile.release]
42
42
  codegen-units = 1
43
43
  lto = "thin"
@@ -2,5 +2,5 @@
2
2
 
3
3
  module Pigeonhole
4
4
  # The gem's version: the `pigeonhole` crate's.
5
- VERSION = "1.1.0"
5
+ VERSION = "1.1.2"
6
6
  end
@@ -6,10 +6,10 @@ checking for whether -fvisibility=hidden is accepted as CFLAGS... yes
6
6
  creating Makefile
7
7
 
8
8
  current directory: /home/runner/work/pigeonhole/pigeonhole/crates/ruby/vendor/bundle/ruby/3.4.0/gems/prism-1.9.0/ext/prism
9
- make DESTDIR\= sitearchdir\=./.gem.20261104-2345-sni2nw sitelibdir\=./.gem.20261104-2345-sni2nw clean
9
+ make DESTDIR\= sitearchdir\=./.gem.20261110-2363-t29z2g sitelibdir\=./.gem.20261110-2363-t29z2g clean
10
10
 
11
11
  current directory: /home/runner/work/pigeonhole/pigeonhole/crates/ruby/vendor/bundle/ruby/3.4.0/gems/prism-1.9.0/ext/prism
12
- make DESTDIR\= sitearchdir\=./.gem.20261104-2345-sni2nw sitelibdir\=./.gem.20261104-2345-sni2nw
12
+ make DESTDIR\= sitearchdir\=./.gem.20261110-2363-t29z2g sitelibdir\=./.gem.20261110-2363-t29z2g
13
13
  compiling api_pack.c
14
14
  compiling api_node.c
15
15
  compiling extension.c
@@ -37,8 +37,8 @@ compiling ./../../src/util/pm_strpbrk.c
37
37
  linking shared-object prism/prism.so
38
38
 
39
39
  current directory: /home/runner/work/pigeonhole/pigeonhole/crates/ruby/vendor/bundle/ruby/3.4.0/gems/prism-1.9.0/ext/prism
40
- make DESTDIR\= sitearchdir\=./.gem.20261104-2345-sni2nw sitelibdir\=./.gem.20261104-2345-sni2nw install
41
- /usr/bin/install -c -m 0755 prism.so ./.gem.20261104-2345-sni2nw/prism
40
+ make DESTDIR\= sitearchdir\=./.gem.20261110-2363-t29z2g sitelibdir\=./.gem.20261110-2363-t29z2g install
41
+ /usr/bin/install -c -m 0755 prism.so ./.gem.20261110-2363-t29z2g/prism
42
42
 
43
43
  current directory: /home/runner/work/pigeonhole/pigeonhole/crates/ruby/vendor/bundle/ruby/3.4.0/gems/prism-1.9.0/ext/prism
44
- make DESTDIR\= sitearchdir\=./.gem.20261104-2345-sni2nw sitelibdir\=./.gem.20261104-2345-sni2nw clean
44
+ make DESTDIR\= sitearchdir\=./.gem.20261110-2363-t29z2g sitelibdir\=./.gem.20261110-2363-t29z2g clean
@@ -9,10 +9,10 @@ checking for whether -DNDEBUG is accepted as CFLAGS... yes
9
9
  creating Makefile
10
10
 
11
11
  current directory: /home/runner/work/pigeonhole/pigeonhole/crates/ruby/vendor/bundle/ruby/3.4.0/gems/rbs-4.2.0/ext/rbs_extension
12
- make DESTDIR\= sitearchdir\=./.gem.20261104-2345-3suy1i sitelibdir\=./.gem.20261104-2345-3suy1i clean
12
+ make DESTDIR\= sitearchdir\=./.gem.20261110-2363-c32oyu sitelibdir\=./.gem.20261110-2363-c32oyu clean
13
13
 
14
14
  current directory: /home/runner/work/pigeonhole/pigeonhole/crates/ruby/vendor/bundle/ruby/3.4.0/gems/rbs-4.2.0/ext/rbs_extension
15
- make DESTDIR\= sitearchdir\=./.gem.20261104-2345-3suy1i sitelibdir\=./.gem.20261104-2345-3suy1i
15
+ make DESTDIR\= sitearchdir\=./.gem.20261110-2363-c32oyu sitelibdir\=./.gem.20261110-2363-c32oyu
16
16
  compiling ./../../src/ast.c
17
17
  compiling ./../../src/lexer.c
18
18
  compiling ./../../src/lexstate.c
@@ -34,8 +34,8 @@ compiling rbs_string_bridging.c
34
34
  linking shared-object rbs_extension.so
35
35
 
36
36
  current directory: /home/runner/work/pigeonhole/pigeonhole/crates/ruby/vendor/bundle/ruby/3.4.0/gems/rbs-4.2.0/ext/rbs_extension
37
- make DESTDIR\= sitearchdir\=./.gem.20261104-2345-3suy1i sitelibdir\=./.gem.20261104-2345-3suy1i install
38
- /usr/bin/install -c -m 0755 rbs_extension.so ./.gem.20261104-2345-3suy1i
37
+ make DESTDIR\= sitearchdir\=./.gem.20261110-2363-c32oyu sitelibdir\=./.gem.20261110-2363-c32oyu install
38
+ /usr/bin/install -c -m 0755 rbs_extension.so ./.gem.20261110-2363-c32oyu
39
39
 
40
40
  current directory: /home/runner/work/pigeonhole/pigeonhole/crates/ruby/vendor/bundle/ruby/3.4.0/gems/rbs-4.2.0/ext/rbs_extension
41
- make DESTDIR\= sitearchdir\=./.gem.20261104-2345-3suy1i sitelibdir\=./.gem.20261104-2345-3suy1i clean
41
+ make DESTDIR\= sitearchdir\=./.gem.20261110-2363-c32oyu sitelibdir\=./.gem.20261110-2363-c32oyu clean
@@ -2,7 +2,7 @@
2
2
 
3
3
  [dependencies.pigeonhole-io]
4
4
  path = "../io"
5
- version = "=2.0.0"
5
+ version = "=2.0.2"
6
6
  [lints.rust.unexpected_cfgs]
7
7
  check-cfg = ["cfg(loom)", "cfg(engine_loom)", "cfg(io_loom)", "cfg(pigeonhole_sim)"]
8
8
  level = "warn"
@@ -17,5 +17,5 @@ name = "pigeonhole-cache"
17
17
  readme = "README.md"
18
18
  repository = "https://github.com/CodingAnarchy/pigeonhole"
19
19
  rust-version = "1.96"
20
- version = "2.0.0"
20
+ version = "2.0.2"
21
21
  [target."cfg(loom)"]
@@ -2,19 +2,19 @@
2
2
 
3
3
  [dependencies.pigeonhole-cache]
4
4
  path = "../cache"
5
- version = "=2.0.0"
5
+ version = "=2.0.2"
6
6
  [dependencies.pigeonhole-format]
7
7
  path = "../format"
8
- version = "=2.0.0"
8
+ version = "=2.0.2"
9
9
  [dependencies.pigeonhole-io]
10
10
  path = "../io"
11
- version = "=2.0.0"
11
+ version = "=2.0.2"
12
12
  [dependencies.pigeonhole-pager]
13
13
  path = "../pager"
14
- version = "=2.0.0"
14
+ version = "=2.0.2"
15
15
  [dependencies.pigeonhole-sst]
16
16
  path = "../sst"
17
- version = "=2.0.0"
17
+ version = "=2.0.2"
18
18
  [lints.rust.unexpected_cfgs]
19
19
  check-cfg = ["cfg(loom)", "cfg(engine_loom)", "cfg(io_loom)", "cfg(pigeonhole_sim)"]
20
20
  level = "warn"
@@ -29,4 +29,4 @@ name = "pigeonhole-compaction"
29
29
  readme = "README.md"
30
30
  repository = "https://github.com/CodingAnarchy/pigeonhole"
31
31
  rust-version = "1.96"
32
- version = "2.0.0"
32
+ version = "2.0.2"
@@ -4,34 +4,34 @@
4
4
  version = "1"
5
5
  [dependencies.pigeonhole-cache]
6
6
  path = "../cache"
7
- version = "=2.0.0"
7
+ version = "=2.0.2"
8
8
  [dependencies.pigeonhole-compaction]
9
9
  path = "../compaction"
10
- version = "=2.0.0"
10
+ version = "=2.0.2"
11
11
  [dependencies.pigeonhole-format]
12
12
  path = "../format"
13
- version = "=2.0.0"
13
+ version = "=2.0.2"
14
14
  [dependencies.pigeonhole-io]
15
15
  path = "../io"
16
- version = "=2.0.0"
16
+ version = "=2.0.2"
17
17
  [dependencies.pigeonhole-memtable]
18
18
  path = "../memtable"
19
- version = "=2.0.0"
19
+ version = "=2.0.2"
20
20
  [dependencies.pigeonhole-pager]
21
21
  path = "../pager"
22
- version = "=2.0.0"
22
+ version = "=2.0.2"
23
23
  [dependencies.pigeonhole-runtime]
24
24
  path = "../runtime"
25
- version = "=2.0.0"
25
+ version = "=2.0.2"
26
26
  [dependencies.pigeonhole-shm]
27
27
  path = "../shm"
28
- version = "=2.0.0"
28
+ version = "=2.0.2"
29
29
  [dependencies.pigeonhole-sst]
30
30
  path = "../sst"
31
- version = "=2.0.0"
31
+ version = "=2.0.2"
32
32
  [dependencies.pigeonhole-wal]
33
33
  path = "../wal"
34
- version = "=2.0.0"
34
+ version = "=2.0.2"
35
35
  [dependencies.smallvec]
36
36
  version = "1"
37
37
  [features]
@@ -50,7 +50,7 @@ name = "pigeonhole-engine"
50
50
  readme = "README.md"
51
51
  repository = "https://github.com/CodingAnarchy/pigeonhole"
52
52
  rust-version = "1.96"
53
- version = "2.0.0"
53
+ version = "2.0.2"
54
54
  [target."cfg(engine_loom)".dependencies.loom]
55
55
  version = "0.7"
56
56
  [target."cfg(unix)"]
@@ -2693,6 +2693,15 @@ impl Engine {
2693
2693
  .value
2694
2694
  .take()
2695
2695
  .map(|p| (p, Arc::clone(&snapshot.view.ssts)));
2696
+ // The read's column limit counts only the columns that pass the predicate (the
2697
+ // resolver counts a column when its newest version passes), so it leaves the read
2698
+ // with the predicate, and the search counts the passing columns itself (simp724's A1
2699
+ // on #1286).
2700
+ let column_limit = if filter.is_some() {
2701
+ std::mem::take(&mut read.columns_per_row)
2702
+ } else {
2703
+ 0
2704
+ };
2696
2705
  Ok(match &spec.input {
2697
2706
  crate::ReadInput::Ranges(ranges) => {
2698
2707
  let [(lo, hi)] = ranges.as_slice() else {
@@ -2703,7 +2712,7 @@ impl Engine {
2703
2712
  let mut scan = ScanSpec::new(lo.clone(), hi.clone());
2704
2713
  scan.read = read;
2705
2714
  let cursor = self.scan_async(snapshot, table, scan)?;
2706
- read::knn::PendingNearest::scan(cursor, query, k, filter)
2715
+ read::knn::PendingNearest::scan(cursor, query, k, filter, column_limit)
2707
2716
  }
2708
2717
  crate::ReadInput::Keys(keys) => {
2709
2718
  let cursor = crate::KeyCursor::over(
@@ -2715,7 +2724,14 @@ impl Engine {
2715
2724
  Arc::clone(keys),
2716
2725
  Arc::clone(&self.inner.shared),
2717
2726
  )?;
2718
- read::knn::PendingNearest::keys(cursor, Arc::clone(keys), query, k, filter)
2727
+ read::knn::PendingNearest::keys(
2728
+ cursor,
2729
+ Arc::clone(keys),
2730
+ query,
2731
+ k,
2732
+ filter,
2733
+ column_limit,
2734
+ )
2719
2735
  }
2720
2736
  })
2721
2737
  }
@@ -189,7 +189,12 @@ fn copy_into(
189
189
  let mut sources = Vec::new();
190
190
  mem_sources(set, &all, &mut sources);
191
191
  let options = writer_options(&meta.options, t.table, f, t.id, created);
192
- let mut sink = copy_at(shared, pager, &sst_ids, options, sources, seqno, closing)?;
192
+ // Sized from the memtables' bytes, as a flush is (#1595: the target SST size
193
+ // here reserved a 64 MiB-aligned extent per family, so a copy of a few hundred
194
+ // KiB of memtables was hundreds of MiB, nearly all free).
195
+ let bytes: u64 = set.readers.iter().map(|r| r.bytes()).sum();
196
+ let extent = bytes.min(shared.picker.target_sst_bytes);
197
+ let mut sink = copy_at(pager, &sst_ids, options, sources, extent, seqno, closing)?;
193
198
  mem_edits.extend(sink.take_edits(t.id, f, 0));
194
199
  }
195
200
  }
@@ -249,7 +254,14 @@ fn copy_into(
249
254
  reader.iter(all.clone(), ReadOptions::default()).into(),
250
255
  )];
251
256
  let options = writer_options(&info.options, table, family, tablet, created);
252
- let mut sink = copy_at(shared, pager, &sst_ids, options, sources, seqno, closing)?;
257
+ // About the source's length: it loses commits, never gains any, but the family's
258
+ // options (compression, block size, filter) may have changed since the source was
259
+ // written, hence the slack. An underestimate only cuts one more SST.
260
+ let extent = meta
261
+ .len
262
+ .saturating_mul(2)
263
+ .min(shared.picker.target_sst_bytes);
264
+ let mut sink = copy_at(pager, &sst_ids, options, sources, extent, seqno, closing)?;
253
265
  for (out, refs) in sink.outputs.drain(..).zip(sink.refs.drain(..)) {
254
266
  for &(tablet, family, level) in &slots {
255
267
  rewritten.push(Edit::AddSst {
@@ -444,20 +456,17 @@ fn writer_options(
444
456
  /// are written as they are: a blob pointer keeps naming its blob file, which the copy holds
445
457
  /// under the same id.
446
458
  fn copy_at(
447
- shared: &Shared,
448
459
  pager: &Arc<Pager>,
449
460
  sst_ids: &Arc<AtomicU64>,
450
461
  options: SstWriterOptions,
451
462
  sources: Vec<Source>,
463
+ extent: u64,
452
464
  seqno: pigeonhole_format::Seqno,
453
465
  closing: &dyn Fn() -> Result<()>,
454
466
  ) -> Result<SstSink> {
455
- let mut sink = SstSink::new(
456
- Arc::clone(pager),
457
- Arc::clone(sst_ids),
458
- options,
459
- shared.picker.target_sst_bytes,
460
- );
467
+ // `extent` is what each new SST's extent is asked for at: about what `sources` hold, at
468
+ // most the target SST size (as a flush), so a small copy takes a small extent (#1595).
469
+ let mut sink = SstSink::new(Arc::clone(pager), Arc::clone(sst_ids), options, extent);
461
470
  if sources.is_empty() {
462
471
  return Ok(sink);
463
472
  }
@@ -240,6 +240,11 @@ pub struct PendingNearest {
240
240
  /// so the cells it drops count toward a poll's budget (#1237's rule), with the SSTs to
241
241
  /// read a separated value from.
242
242
  filter: Option<Filter>,
243
+ /// The read's column limit when `filter` left the read (0: none), and the columns that
244
+ /// passed it in the current row: the resolver counts only passing columns, so the search
245
+ /// does too (simp724's A1 on #1286).
246
+ column_limit: u32,
247
+ columns: u32,
243
248
  /// The row being read (its key in a buffer reused from row to row), if one is.
244
249
  row: Vec<u8>,
245
250
  in_row: bool,
@@ -263,8 +268,9 @@ impl PendingNearest {
263
268
  query: Prepared,
264
269
  k: usize,
265
270
  filter: Option<Filter>,
271
+ column_limit: u32,
266
272
  ) -> Self {
267
- Self::with(Source::Scan(cursor), query, k, filter)
273
+ Self::with(Source::Scan(cursor), query, k, filter, column_limit)
268
274
  }
269
275
 
270
276
  pub(crate) fn keys(
@@ -273,16 +279,31 @@ impl PendingNearest {
273
279
  query: Prepared,
274
280
  k: usize,
275
281
  filter: Option<Filter>,
282
+ column_limit: u32,
276
283
  ) -> Self {
277
- Self::with(Source::Keys { cursor, keys }, query, k, filter)
284
+ Self::with(
285
+ Source::Keys { cursor, keys },
286
+ query,
287
+ k,
288
+ filter,
289
+ column_limit,
290
+ )
278
291
  }
279
292
 
280
- fn with(source: Source, query: Prepared, k: usize, filter: Option<Filter>) -> Self {
293
+ fn with(
294
+ source: Source,
295
+ query: Prepared,
296
+ k: usize,
297
+ filter: Option<Filter>,
298
+ column_limit: u32,
299
+ ) -> Self {
281
300
  Self {
282
301
  source,
283
302
  visitor: KnnVisitor::typed(query, Arc::new(KnnSkips::default())),
284
303
  top: TopK::new(k),
285
304
  filter,
305
+ column_limit,
306
+ columns: 0,
286
307
  row: Vec::new(),
287
308
  in_row: false,
288
309
  done: false,
@@ -315,18 +336,29 @@ impl PendingNearest {
315
336
  return Poll::Ready(Ok(()));
316
337
  }
317
338
  self.in_row = true;
339
+ self.columns = 0;
318
340
  }
319
341
  let row = self.row.as_slice();
320
- let (visitor, top, filter) = (&mut self.visitor, &mut self.top, self.filter.as_ref());
321
- let ended = match &mut self.source {
322
- Source::Scan(c) => {
323
- c.counted(|c| read_row(c, row, &mut budget, visitor, top, filter))
324
- }
325
- Source::Keys { cursor, .. } => {
326
- cursor.counted(|c| read_row(c, row, &mut budget, visitor, top, filter))
327
- }
342
+ let mut r = RowRead {
343
+ row,
344
+ budget: &mut budget,
345
+ visitor: &mut self.visitor,
346
+ top: &mut self.top,
347
+ filter: self.filter.as_ref(),
348
+ column_limit: self.column_limit,
349
+ columns: &mut self.columns,
350
+ };
351
+ let end = match &mut self.source {
352
+ Source::Scan(c) => c.counted(|c| r.read(c)),
353
+ Source::Keys { cursor, .. } => cursor.counted(|c| r.read(c)),
328
354
  }?;
329
- if ended {
355
+ if end == RowEnd::Limit
356
+ && let Source::Keys { cursor, .. } = &mut self.source
357
+ {
358
+ // The rest of the key goes unread; a scan's next row drops it itself.
359
+ cursor.skip_rest_of_key();
360
+ }
361
+ if end != RowEnd::Budget {
330
362
  self.in_row = false;
331
363
  } else {
332
364
  // The budget ran out mid-row: yield, keeping the row's place.
@@ -354,43 +386,71 @@ impl RowCells for super::keys::KeyCursor {
354
386
  }
355
387
  }
356
388
 
357
- /// Scores the current row's cells into `top` within `budget` cells: whether the row ended.
358
- /// Cells `filter` drops count toward the budget too, and never reach the visitor.
359
- fn read_row(
360
- cells: &mut impl RowCells,
361
- row: &[u8],
362
- budget: &mut u32,
363
- visitor: &mut KnnVisitor,
364
- top: &mut TopK<Score>,
365
- filter: Option<&Filter>,
366
- ) -> crate::Result<bool> {
367
- use super::reduce::{CellRef, Reducer};
368
- loop {
369
- if *budget == 0 {
370
- return Ok(false);
371
- }
372
- let Some(c) = cells.next_cell()? else {
373
- return Ok(true);
374
- };
375
- *budget -= 1;
376
- if let Some((p, ssts)) = filter {
377
- let kept = match pigeonhole_compaction::blob_pointer(c.stored) {
378
- Some(ptr) => p.matches(&ssts.read_pointer(&ptr)?),
379
- None => p.matches(c.stored),
380
- };
381
- if !kept {
382
- continue;
389
+ /// Where a row's read stopped.
390
+ #[derive(Debug, Clone, Copy, PartialEq, Eq)]
391
+ enum RowEnd {
392
+ /// The poll's cell budget ran out: the row goes on next poll.
393
+ Budget,
394
+ /// The row's cells ran out.
395
+ Ended,
396
+ /// The column limit is reached: the rest of the row is skipped.
397
+ Limit,
398
+ }
399
+
400
+ /// One row's read into `top`, within the poll's `budget` cells.
401
+ struct RowRead<'a> {
402
+ row: &'a [u8],
403
+ budget: &'a mut u32,
404
+ visitor: &'a mut KnnVisitor,
405
+ top: &'a mut TopK<Score>,
406
+ filter: Option<&'a Filter>,
407
+ column_limit: u32,
408
+ columns: &'a mut u32,
409
+ }
410
+
411
+ impl RowRead<'_> {
412
+ /// Scores the current row's cells. Cells `filter` drops count toward the budget too,
413
+ /// and never reach the visitor; with a column limit, only the cells it keeps count
414
+ /// toward the limit (one version per column).
415
+ fn read(&mut self, cells: &mut impl RowCells) -> crate::Result<RowEnd> {
416
+ use super::reduce::{CellRef, Reducer};
417
+ let row = self.row;
418
+ loop {
419
+ if *self.budget == 0 {
420
+ return Ok(RowEnd::Budget);
383
421
  }
384
- }
385
- if let Visit::Emit(score) = visitor.visit(row, c.family, c.qualifier, c.ts, c.stored) {
386
- let cell = CellRef {
387
- row,
388
- family_rank: 0,
389
- family: c.family,
390
- qualifier: c.qualifier,
391
- ts: c.ts,
422
+ let Some(c) = cells.next_cell()? else {
423
+ return Ok(RowEnd::Ended);
392
424
  };
393
- let _ = top.push(cell, score);
425
+ *self.budget -= 1;
426
+ if let Some((p, ssts)) = self.filter {
427
+ let kept = match pigeonhole_compaction::blob_pointer(c.stored) {
428
+ Some(ptr) => p.matches(&ssts.read_pointer(&ptr)?),
429
+ None => p.matches(c.stored),
430
+ };
431
+ if !kept {
432
+ continue;
433
+ }
434
+ if self.column_limit != 0 {
435
+ if *self.columns == self.column_limit {
436
+ return Ok(RowEnd::Limit);
437
+ }
438
+ *self.columns += 1;
439
+ }
440
+ }
441
+ let visited = self
442
+ .visitor
443
+ .visit(row, c.family, c.qualifier, c.ts, c.stored);
444
+ if let Visit::Emit(score) = visited {
445
+ let cell = CellRef {
446
+ row,
447
+ family_rank: 0,
448
+ family: c.family,
449
+ qualifier: c.qualifier,
450
+ ts: c.ts,
451
+ };
452
+ let _ = self.top.push(cell, score);
453
+ }
394
454
  }
395
455
  }
396
456
  }
@@ -1121,11 +1121,12 @@ impl ScanCursor {
1121
1121
  self.recycle_lanes();
1122
1122
  return Ok(Some(false));
1123
1123
  }
1124
- // Drop whatever is left of the current row.
1124
+ // Drop whatever is left of the current row. A lane whose cell was handed out last
1125
+ // still holds it (pending, in this row) with the rest of the row behind it unread:
1126
+ // it is skipped with the others, never left to hand that rest out as a next row
1127
+ // (a reader that stops a row early: an async search at its column limit, #1286).
1125
1128
  if self.in_row {
1126
- if let Some(i) = self.last_lane.take() {
1127
- self.lanes[i].pending = false;
1128
- }
1129
+ self.last_lane = None;
1129
1130
  self.skip_current_row()?;
1130
1131
  self.in_row = false;
1131
1132
  }
@@ -37,4 +37,4 @@ name = "pigeonhole-format"
37
37
  readme = "README.md"
38
38
  repository = "https://github.com/CodingAnarchy/pigeonhole"
39
39
  rust-version = "1.96"
40
- version = "2.0.0"
40
+ version = "2.0.2"
data/vendor/io/Cargo.toml CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  [dependencies.pigeonhole-format]
4
4
  path = "../format"
5
- version = "=2.0.0"
5
+ version = "=2.0.2"
6
6
  [lints.rust.unexpected_cfgs]
7
7
  check-cfg = ["cfg(loom)", "cfg(engine_loom)", "cfg(io_loom)", "cfg(pigeonhole_sim)"]
8
8
  level = "warn"
@@ -17,7 +17,7 @@ name = "pigeonhole-io"
17
17
  readme = "README.md"
18
18
  repository = "https://github.com/CodingAnarchy/pigeonhole"
19
19
  rust-version = "1.96"
20
- version = "2.0.0"
20
+ version = "2.0.2"
21
21
  [target."cfg(io_loom)".dependencies.loom]
22
22
  version = "0.7"
23
23
  [target."cfg(target_os = \"linux\")".dependencies.io-uring]
@@ -4,13 +4,13 @@
4
4
  version = "0.3"
5
5
  [dependencies.pigeonhole]
6
6
  path = "../pigeonhole"
7
- version = "1.1.0"
7
+ version = "1.1.2"
8
8
  [dependencies.pigeonhole-text]
9
9
  path = "../text"
10
- version = "1.1.0"
10
+ version = "1.1.2"
11
11
  [dependencies.pigeonhole-vector]
12
12
  path = "../vector"
13
- version = "1.1.0"
13
+ version = "1.1.2"
14
14
  [dependencies.twox-hash]
15
15
  default-features = false
16
16
  features = ["std", "xxhash3_64", "xxhash3_128"]
@@ -31,4 +31,4 @@ name = "pigeonhole-memory"
31
31
  readme = "README.md"
32
32
  repository = "https://github.com/CodingAnarchy/pigeonhole"
33
33
  rust-version = "1.96"
34
- version = "1.1.0"
34
+ version = "1.1.2"
@@ -2,10 +2,10 @@
2
2
 
3
3
  [dependencies.pigeonhole-format]
4
4
  path = "../format"
5
- version = "=2.0.0"
5
+ version = "=2.0.2"
6
6
  [dependencies.pigeonhole-io]
7
7
  path = "../io"
8
- version = "=2.0.0"
8
+ version = "=2.0.2"
9
9
  [lints.rust.unexpected_cfgs]
10
10
  check-cfg = ["cfg(loom)", "cfg(engine_loom)", "cfg(io_loom)", "cfg(pigeonhole_sim)"]
11
11
  level = "warn"
@@ -20,5 +20,5 @@ name = "pigeonhole-memtable"
20
20
  readme = "README.md"
21
21
  repository = "https://github.com/CodingAnarchy/pigeonhole"
22
22
  rust-version = "1.96"
23
- version = "2.0.0"
23
+ version = "2.0.2"
24
24
  [target."cfg(loom)"]
@@ -1155,6 +1155,17 @@ impl MemtableReader {
1155
1155
  self.len() == 0
1156
1156
  }
1157
1157
 
1158
+ /// The bytes written into the arena for its entries (the header's byte field, which the
1159
+ /// writer raises as it inserts; at most the writer's [`Memtable::allocated_bytes`]):
1160
+ /// about an upper bound on the SST written from them. A size estimate only (a backup
1161
+ /// sizes its SSTs' extents by it, #1595): read Relaxed, as the writer stores it, so on a
1162
+ /// memtable still taking inserts it can trail [`len`](Self::len)'s entries.
1163
+ pub fn bytes(&self) -> u64 {
1164
+ self.region
1165
+ .mem
1166
+ .load_u64(self.root as usize + layout::H_BYTES, Ordering::Relaxed)
1167
+ }
1168
+
1158
1169
  /// A cursor, initially unpositioned. Holds its own clone of the reader, so it can be
1159
1170
  /// stored beside the view that keeps the arena memory alive.
1160
1171
  pub fn iter(&self) -> MemIter {
@@ -145,7 +145,6 @@ mod imp {
145
145
  self.atomic_u32(off).store(v, ord);
146
146
  }
147
147
 
148
- #[cfg(test)]
149
148
  pub(crate) fn load_u64(&self, off: usize, ord: Ordering) -> u64 {
150
149
  self.atomic_u64(off).load(ord)
151
150
  }
@@ -269,6 +268,12 @@ mod imp {
269
268
  self.word(off + 4).store((v >> 32) as u32, ord);
270
269
  }
271
270
 
271
+ /// As `store_u64`, two words: not one atomic load, which the header's byte count
272
+ /// (its only u64 read) doesn't need.
273
+ pub(crate) fn load_u64(&self, off: usize, ord: Ordering) -> u64 {
274
+ u64::from(self.word(off).load(ord)) | (u64::from(self.word(off + 4).load(ord)) << 32)
275
+ }
276
+
272
277
  pub(crate) fn load_u8(&self, off: usize, ord: Ordering) -> u8 {
273
278
  let w = self.word(off & !3).load(ord);
274
279
  (w >> (8 * (off % 4))) as u8
@@ -2,10 +2,10 @@
2
2
 
3
3
  [dependencies.pigeonhole-format]
4
4
  path = "../format"
5
- version = "=2.0.0"
5
+ version = "=2.0.2"
6
6
  [dependencies.pigeonhole-io]
7
7
  path = "../io"
8
- version = "=2.0.0"
8
+ version = "=2.0.2"
9
9
  [lints.rust.unexpected_cfgs]
10
10
  check-cfg = ["cfg(loom)", "cfg(engine_loom)", "cfg(io_loom)", "cfg(pigeonhole_sim)"]
11
11
  level = "warn"
@@ -20,4 +20,4 @@ name = "pigeonhole-pager"
20
20
  readme = "README.md"
21
21
  repository = "https://github.com/CodingAnarchy/pigeonhole"
22
22
  rust-version = "1.96"
23
- version = "2.0.0"
23
+ version = "2.0.2"
@@ -8,16 +8,16 @@ optional = true
8
8
  version = "0.3"
9
9
  [dependencies.pigeonhole-engine]
10
10
  path = "../engine"
11
- version = "=2.0.0"
11
+ version = "=2.0.2"
12
12
  [dependencies.pigeonhole-format]
13
13
  path = "../format"
14
- version = "=2.0.0"
14
+ version = "=2.0.2"
15
15
  [dependencies.pigeonhole-io]
16
16
  path = "../io"
17
- version = "=2.0.0"
17
+ version = "=2.0.2"
18
18
  [dependencies.pigeonhole-shm]
19
19
  path = "../shm"
20
- version = "=2.0.0"
20
+ version = "=2.0.2"
21
21
  [dependencies.smallvec]
22
22
  version = "1"
23
23
  [features]
@@ -39,4 +39,4 @@ name = "pigeonhole"
39
39
  readme = "README.md"
40
40
  repository = "https://github.com/CodingAnarchy/pigeonhole"
41
41
  rust-version = "1.96"
42
- version = "1.1.0"
42
+ version = "1.1.2"
@@ -39,7 +39,7 @@ cargo add pigeonhole
39
39
  or `pigeonhole = "1"` in `Cargo.toml`. Requires Rust 1.96 (2024 edition). API docs are on
40
40
  [docs.rs](https://docs.rs/pigeonhole). See the
41
41
  [changelog](https://github.com/CodingAnarchy/pigeonhole/blob/main/CHANGELOG.md) and the
42
- [1.1.0 release](https://github.com/CodingAnarchy/pigeonhole/releases/tag/v1.1.0).
42
+ [1.1.2 release](https://github.com/CodingAnarchy/pigeonhole/releases/tag/v1.1.2).
43
43
 
44
44
  ## Quickstart
45
45
 
@@ -2,7 +2,7 @@
2
2
 
3
3
  [dependencies.pigeonhole-io]
4
4
  path = "../io"
5
- version = "=2.0.0"
5
+ version = "=2.0.2"
6
6
  [lints.rust.unexpected_cfgs]
7
7
  check-cfg = ["cfg(loom)", "cfg(engine_loom)", "cfg(io_loom)", "cfg(pigeonhole_sim)"]
8
8
  level = "warn"
@@ -17,5 +17,5 @@ name = "pigeonhole-runtime"
17
17
  readme = "README.md"
18
18
  repository = "https://github.com/CodingAnarchy/pigeonhole"
19
19
  rust-version = "1.96"
20
- version = "2.0.0"
20
+ version = "2.0.2"
21
21
  [target."cfg(loom)"]
@@ -2,10 +2,10 @@
2
2
 
3
3
  [dependencies.pigeonhole-format]
4
4
  path = "../format"
5
- version = "=2.0.0"
5
+ version = "=2.0.2"
6
6
  [dependencies.pigeonhole-io]
7
7
  path = "../io"
8
- version = "=2.0.0"
8
+ version = "=2.0.2"
9
9
  [lints.rust.unexpected_cfgs]
10
10
  check-cfg = ["cfg(loom)", "cfg(engine_loom)", "cfg(io_loom)", "cfg(pigeonhole_sim)"]
11
11
  level = "warn"
@@ -20,5 +20,5 @@ name = "pigeonhole-shm"
20
20
  readme = "README.md"
21
21
  repository = "https://github.com/CodingAnarchy/pigeonhole"
22
22
  rust-version = "1.96"
23
- version = "2.0.0"
23
+ version = "2.0.2"
24
24
  [target."cfg(unix)"]
@@ -2,13 +2,13 @@
2
2
 
3
3
  [dependencies.pigeonhole-cache]
4
4
  path = "../cache"
5
- version = "=2.0.0"
5
+ version = "=2.0.2"
6
6
  [dependencies.pigeonhole-format]
7
7
  path = "../format"
8
- version = "=2.0.0"
8
+ version = "=2.0.2"
9
9
  [dependencies.pigeonhole-io]
10
10
  path = "../io"
11
- version = "=2.0.0"
11
+ version = "=2.0.2"
12
12
  [lints.rust.unexpected_cfgs]
13
13
  check-cfg = ["cfg(loom)", "cfg(engine_loom)", "cfg(io_loom)", "cfg(pigeonhole_sim)"]
14
14
  level = "warn"
@@ -23,4 +23,4 @@ name = "pigeonhole-sst"
23
23
  readme = "README.md"
24
24
  repository = "https://github.com/CodingAnarchy/pigeonhole"
25
25
  rust-version = "1.96"
26
- version = "2.0.0"
26
+ version = "2.0.2"
@@ -4,7 +4,7 @@
4
4
  version = "0.2.1"
5
5
  [dependencies.pigeonhole]
6
6
  path = "../pigeonhole"
7
- version = "1.1.0"
7
+ version = "1.1.2"
8
8
  [dependencies.unicode-normalization]
9
9
  version = "0.1"
10
10
  [dependencies.unicode-segmentation]
@@ -23,4 +23,4 @@ name = "pigeonhole-text"
23
23
  readme = "README.md"
24
24
  repository = "https://github.com/CodingAnarchy/pigeonhole"
25
25
  rust-version = "1.96"
26
- version = "1.1.0"
26
+ version = "1.1.2"
@@ -6,7 +6,7 @@ optional = true
6
6
  version = "0.3"
7
7
  [dependencies.pigeonhole]
8
8
  path = "../pigeonhole"
9
- version = "1.1.0"
9
+ version = "1.1.2"
10
10
  [features]
11
11
  __unstable-hooks = []
12
12
  async = ["pigeonhole/async", "dep:futures-core"]
@@ -25,4 +25,4 @@ name = "pigeonhole-vector"
25
25
  readme = "README.md"
26
26
  repository = "https://github.com/CodingAnarchy/pigeonhole"
27
27
  rust-version = "1.96"
28
- version = "1.1.0"
28
+ version = "1.1.2"
@@ -2,10 +2,10 @@
2
2
 
3
3
  [dependencies.pigeonhole-format]
4
4
  path = "../format"
5
- version = "=2.0.0"
5
+ version = "=2.0.2"
6
6
  [dependencies.pigeonhole-io]
7
7
  path = "../io"
8
- version = "=2.0.0"
8
+ version = "=2.0.2"
9
9
  [features]
10
10
  sim-hooks = []
11
11
  [lints.rust.unexpected_cfgs]
@@ -22,4 +22,4 @@ name = "pigeonhole-wal"
22
22
  readme = "README.md"
23
23
  repository = "https://github.com/CodingAnarchy/pigeonhole"
24
24
  rust-version = "1.96"
25
- version = "2.0.0"
25
+ version = "2.0.2"
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pigeonhole-db
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0
4
+ version: 1.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Matt Tanous