pigeonhole-db 1.1.1 → 1.1.3

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.
Files changed (37) hide show
  1. checksums.yaml +4 -4
  2. data/Cargo.lock +16 -16
  3. data/Cargo.toml +5 -5
  4. data/lib/pigeonhole/version.rb +1 -1
  5. data/vendor/bundle/ruby/3.4.0/extensions/x86_64-linux/3.4.0/prism-1.9.0/gem_make.out +14 -6
  6. data/vendor/bundle/ruby/3.4.0/extensions/x86_64-linux/3.4.0/prism-1.9.0/prism/prism.so +0 -0
  7. data/vendor/bundle/ruby/3.4.0/extensions/x86_64-linux/3.4.0/rbs-4.2.0/gem_make.out +6 -6
  8. data/vendor/bundle/ruby/3.4.0/extensions/x86_64-linux/3.4.0/rbs-4.2.0/rbs_extension.so +0 -0
  9. data/vendor/bundle/ruby/3.4.0/gems/prism-1.9.0/lib/prism/prism.so +0 -0
  10. data/vendor/bundle/ruby/3.4.0/gems/rbs-4.2.0/lib/rbs_extension.so +0 -0
  11. data/vendor/cache/Cargo.toml +2 -2
  12. data/vendor/compaction/Cargo.toml +6 -6
  13. data/vendor/engine/Cargo.toml +11 -11
  14. data/vendor/engine/src/compact.rs +21 -13
  15. data/vendor/engine/src/engine/hooks.rs +4 -0
  16. data/vendor/engine/src/engine.rs +8 -1
  17. data/vendor/engine/src/feed.rs +125 -5
  18. data/vendor/engine/src/feed_reader.rs +32 -6
  19. data/vendor/engine/src/maintenance.rs +18 -9
  20. data/vendor/format/Cargo.toml +1 -1
  21. data/vendor/io/Cargo.toml +2 -2
  22. data/vendor/memory/Cargo.toml +4 -4
  23. data/vendor/memtable/Cargo.toml +3 -3
  24. data/vendor/memtable/src/lib.rs +12 -3
  25. data/vendor/memtable/src/mem.rs +6 -1
  26. data/vendor/pager/Cargo.toml +3 -3
  27. data/vendor/pager/src/lib.rs +10 -0
  28. data/vendor/pigeonhole/Cargo.toml +5 -5
  29. data/vendor/pigeonhole/README.md +1 -1
  30. data/vendor/runtime/Cargo.toml +2 -2
  31. data/vendor/shm/Cargo.toml +3 -3
  32. data/vendor/sst/Cargo.toml +4 -4
  33. data/vendor/text/Cargo.toml +2 -2
  34. data/vendor/vector/Cargo.toml +2 -2
  35. data/vendor/wal/Cargo.toml +3 -3
  36. data/vendor/wal/src/stream.rs +9 -4
  37. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 051ba1f3253f01d8bd59cf337efe6e202641359a46218ca9a4d9065bcc3174a9
4
- data.tar.gz: 5928e6cc99b9ff647b075ae0cc27e5887513c199e55f0e758e565a98de3d0ba4
3
+ metadata.gz: 745df12173dfa4d2b32748780d5c6a066ae4ea18b2f40b05d8600efb38cdc3bf
4
+ data.tar.gz: 87e9d152c84638623f1adfa9b41c525e3c8868fa6e1e493d564ca0d80886d59a
5
5
  SHA512:
6
- metadata.gz: f98d422fbcb95b31b070ad293784b32cfdefefab8fca2e46b032d1b3058e382b903e783523738ed53a2401bfe27e82edce947e4061d623294b4fc93ed5901d30
7
- data.tar.gz: 526bbec10351aaed21d260295f7460d57a63051a5bf738442aeb39f1d8ace6827496053dc81f40cba76c4dbd96ae6a8efd7b68c380d4cb75c621aad933329974
6
+ metadata.gz: 1244f946542da680f02dbce2252734b1d7bf31183901ead1f1424b808c3e62e55b82ee96be25b810b0a305c70b1030acf69167ffdcc885b705045875e5165259
7
+ data.tar.gz: 9a14c63a35370825d5e91d76fd0cdb1d8873c94ac9ec05e69e5d06f29e03f52ba742f7ce8f12d6db76cea0be3c818ef648d344d43f431b3b6d72d5fb496786ba
data/Cargo.lock CHANGED
@@ -367,7 +367,7 @@ checksum = "9f7c3e4beb33f85d45ae3e3a1792185706c8e16d043238c593331cc7cd313b50"
367
367
 
368
368
  [[package]]
369
369
  name = "pigeonhole"
370
- version = "1.1.1"
370
+ version = "1.1.3"
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.1"
383
+ version = "2.0.3"
384
384
  dependencies = [
385
385
  "pigeonhole-io",
386
386
  ]
387
387
 
388
388
  [[package]]
389
389
  name = "pigeonhole-compaction"
390
- version = "2.0.1"
390
+ version = "2.0.3"
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.1"
401
+ version = "2.0.3"
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.1"
420
+ version = "2.0.3"
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.1"
432
+ version = "2.0.3"
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.1"
443
+ version = "1.1.3"
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.1"
454
+ version = "2.0.3"
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.1"
462
+ version = "2.0.3"
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.1"
470
+ version = "1.1.3"
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.1"
482
+ version = "2.0.3"
483
483
  dependencies = [
484
484
  "pigeonhole-io",
485
485
  ]
486
486
 
487
487
  [[package]]
488
488
  name = "pigeonhole-shm"
489
- version = "2.0.1"
489
+ version = "2.0.3"
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.1"
497
+ version = "2.0.3"
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.1"
506
+ version = "1.1.3"
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.1"
516
+ version = "1.1.3"
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.1"
524
+ version = "2.0.3"
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.1"
8
+ version = "1.1.3"
9
9
  [dependencies.pigeonhole-memory]
10
10
  path = "vendor/memory"
11
- version = "1.1.1"
11
+ version = "1.1.3"
12
12
  [dependencies.pigeonhole-text]
13
13
  path = "vendor/text"
14
- version = "1.1.1"
14
+ version = "1.1.3"
15
15
  [dependencies.pigeonhole-vector]
16
16
  path = "vendor/vector"
17
- version = "1.1.1"
17
+ version = "1.1.3"
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.1"
40
+ version = "1.1.3"
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.1"
5
+ VERSION = "1.1.3"
6
6
  end
@@ -6,12 +6,12 @@ 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.20261105-2189-n76o6p sitelibdir\=./.gem.20261105-2189-n76o6p clean
9
+ make DESTDIR\= sitearchdir\=./.gem.20261113-2902-9df1jg sitelibdir\=./.gem.20261113-2902-9df1jg 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.20261105-2189-n76o6p sitelibdir\=./.gem.20261105-2189-n76o6p
13
- compiling api_node.c
12
+ make DESTDIR\= sitearchdir\=./.gem.20261113-2902-9df1jg sitelibdir\=./.gem.20261113-2902-9df1jg
14
13
  compiling api_pack.c
14
+ compiling api_node.c
15
15
  compiling extension.c
16
16
  compiling ./../../src/diagnostic.c
17
17
  compiling ./../../src/encoding.c
@@ -30,6 +30,14 @@ compiling ./../../src/util/pm_constant_pool.c
30
30
  compiling ./../../src/util/pm_integer.c
31
31
  compiling ./../../src/util/pm_list.c
32
32
  compiling ./../../src/util/pm_memchr.c
33
+ ./../../src/util/pm_memchr.c: In function ‘pm_memchr’:
34
+ ./../../src/util/pm_memchr.c:31:16: warning: return discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers]
35
+ 31 | return memchr(memory, character, number);
36
+ | ^~~~~~
37
+ At top level:
38
+ cc1: note: unrecognized command-line option ‘-Wno-self-assign’ may have been intended to silence earlier diagnostics
39
+ cc1: note: unrecognized command-line option ‘-Wno-parentheses-equality’ may have been intended to silence earlier diagnostics
40
+ cc1: note: unrecognized command-line option ‘-Wno-constant-logical-operand’ may have been intended to silence earlier diagnostics
33
41
  compiling ./../../src/util/pm_newline_list.c
34
42
  compiling ./../../src/util/pm_string.c
35
43
  compiling ./../../src/util/pm_strncasecmp.c
@@ -37,8 +45,8 @@ compiling ./../../src/util/pm_strpbrk.c
37
45
  linking shared-object prism/prism.so
38
46
 
39
47
  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.20261105-2189-n76o6p sitelibdir\=./.gem.20261105-2189-n76o6p install
41
- /usr/bin/install -c -m 0755 prism.so ./.gem.20261105-2189-n76o6p/prism
48
+ make DESTDIR\= sitearchdir\=./.gem.20261113-2902-9df1jg sitelibdir\=./.gem.20261113-2902-9df1jg install
49
+ /usr/bin/install -c -m 0755 prism.so ./.gem.20261113-2902-9df1jg/prism
42
50
 
43
51
  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.20261105-2189-n76o6p sitelibdir\=./.gem.20261105-2189-n76o6p clean
52
+ make DESTDIR\= sitearchdir\=./.gem.20261113-2902-9df1jg sitelibdir\=./.gem.20261113-2902-9df1jg clean
@@ -9,15 +9,15 @@ 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.20261105-2189-ggqkev sitelibdir\=./.gem.20261105-2189-ggqkev clean
12
+ make DESTDIR\= sitearchdir\=./.gem.20261113-2902-kbdte5 sitelibdir\=./.gem.20261113-2902-kbdte5 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.20261105-2189-ggqkev sitelibdir\=./.gem.20261105-2189-ggqkev
15
+ make DESTDIR\= sitearchdir\=./.gem.20261113-2902-kbdte5 sitelibdir\=./.gem.20261113-2902-kbdte5
16
16
  compiling ./../../src/ast.c
17
17
  compiling ./../../src/lexer.c
18
18
  compiling ./../../src/lexstate.c
19
- compiling ./../../src/location.c
20
19
  compiling ./../../src/parser.c
20
+ compiling ./../../src/location.c
21
21
  compiling ./../../src/serialize.c
22
22
  compiling ./../../src/string.c
23
23
  compiling ./../../src/util/rbs_allocator.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.20261105-2189-ggqkev sitelibdir\=./.gem.20261105-2189-ggqkev install
38
- /usr/bin/install -c -m 0755 rbs_extension.so ./.gem.20261105-2189-ggqkev
37
+ make DESTDIR\= sitearchdir\=./.gem.20261113-2902-kbdte5 sitelibdir\=./.gem.20261113-2902-kbdte5 install
38
+ /usr/bin/install -c -m 0755 rbs_extension.so ./.gem.20261113-2902-kbdte5
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.20261105-2189-ggqkev sitelibdir\=./.gem.20261105-2189-ggqkev clean
41
+ make DESTDIR\= sitearchdir\=./.gem.20261113-2902-kbdte5 sitelibdir\=./.gem.20261113-2902-kbdte5 clean
@@ -2,7 +2,7 @@
2
2
 
3
3
  [dependencies.pigeonhole-io]
4
4
  path = "../io"
5
- version = "=2.0.1"
5
+ version = "=2.0.3"
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.1"
20
+ version = "2.0.3"
21
21
  [target."cfg(loom)"]
@@ -2,19 +2,19 @@
2
2
 
3
3
  [dependencies.pigeonhole-cache]
4
4
  path = "../cache"
5
- version = "=2.0.1"
5
+ version = "=2.0.3"
6
6
  [dependencies.pigeonhole-format]
7
7
  path = "../format"
8
- version = "=2.0.1"
8
+ version = "=2.0.3"
9
9
  [dependencies.pigeonhole-io]
10
10
  path = "../io"
11
- version = "=2.0.1"
11
+ version = "=2.0.3"
12
12
  [dependencies.pigeonhole-pager]
13
13
  path = "../pager"
14
- version = "=2.0.1"
14
+ version = "=2.0.3"
15
15
  [dependencies.pigeonhole-sst]
16
16
  path = "../sst"
17
- version = "=2.0.1"
17
+ version = "=2.0.3"
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.1"
32
+ version = "2.0.3"
@@ -4,34 +4,34 @@
4
4
  version = "1"
5
5
  [dependencies.pigeonhole-cache]
6
6
  path = "../cache"
7
- version = "=2.0.1"
7
+ version = "=2.0.3"
8
8
  [dependencies.pigeonhole-compaction]
9
9
  path = "../compaction"
10
- version = "=2.0.1"
10
+ version = "=2.0.3"
11
11
  [dependencies.pigeonhole-format]
12
12
  path = "../format"
13
- version = "=2.0.1"
13
+ version = "=2.0.3"
14
14
  [dependencies.pigeonhole-io]
15
15
  path = "../io"
16
- version = "=2.0.1"
16
+ version = "=2.0.3"
17
17
  [dependencies.pigeonhole-memtable]
18
18
  path = "../memtable"
19
- version = "=2.0.1"
19
+ version = "=2.0.3"
20
20
  [dependencies.pigeonhole-pager]
21
21
  path = "../pager"
22
- version = "=2.0.1"
22
+ version = "=2.0.3"
23
23
  [dependencies.pigeonhole-runtime]
24
24
  path = "../runtime"
25
- version = "=2.0.1"
25
+ version = "=2.0.3"
26
26
  [dependencies.pigeonhole-shm]
27
27
  path = "../shm"
28
- version = "=2.0.1"
28
+ version = "=2.0.3"
29
29
  [dependencies.pigeonhole-sst]
30
30
  path = "../sst"
31
- version = "=2.0.1"
31
+ version = "=2.0.3"
32
32
  [dependencies.pigeonhole-wal]
33
33
  path = "../wal"
34
- version = "=2.0.1"
34
+ version = "=2.0.3"
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.1"
53
+ version = "2.0.3"
54
54
  [target."cfg(engine_loom)".dependencies.loom]
55
55
  version = "0.7"
56
56
  [target."cfg(unix)"]
@@ -533,7 +533,8 @@ pub(crate) struct CompactionWork {
533
533
  pub task: CompactionTask,
534
534
  job: Option<CompactionJob>,
535
535
  /// The view the inputs were taken from: pins their extents while the job reads them.
536
- view: Arc<View>,
536
+ /// Released by [`report`](Self::report), before the shard hears the job is done (#1765).
537
+ view: Option<Arc<View>>,
537
538
  /// A `Drop`'s blob live-byte changes: the pointers its SSTs held (read before submit).
538
539
  drop_delta: Vec<(BlobFileId, i64)>,
539
540
  /// The finished job's per-SST blob references (#240).
@@ -629,7 +630,7 @@ impl CompactionWork {
629
630
  shard,
630
631
  task,
631
632
  job,
632
- view,
633
+ view: Some(view),
633
634
  drop_delta: Vec::new(),
634
635
  blob_refs: Vec::new(),
635
636
  meta,
@@ -657,17 +658,14 @@ impl CompactionWork {
657
658
  use pigeonhole_sst::{ReadOptions, ScanFilter};
658
659
 
659
660
  let family = self.task.family;
660
- if !self
661
- .view
662
- .catalog
663
- .blob_files
664
- .values()
665
- .any(|b| b.family == family)
666
- {
661
+ // Read before the report, which is what releases the view.
662
+ let Some(view) = self.view.clone() else {
663
+ return Err(Error::Closed);
664
+ };
665
+ if !view.catalog.blob_files.values().any(|b| b.family == family) {
667
666
  return Ok(());
668
667
  }
669
- let fam = self
670
- .view
668
+ let fam = view
671
669
  .ssts
672
670
  .family(self.task.tablet, family)
673
671
  .ok_or_else(|| Error::Corruption("dropped SSTs are gone".to_owned()))?;
@@ -684,7 +682,7 @@ impl CompactionWork {
684
682
  // Its recorded references (#240) count every row: usable unless the SST also
685
683
  // holds rows outside this tablet (shared with a sibling, or inherited from a
686
684
  // split's parent).
687
- let catalog = &self.view.catalog;
685
+ let catalog = &view.catalog;
688
686
  if let Some(refs) = catalog.blob_refs.get(id)
689
687
  && !catalog.sst_shared(*id)
690
688
  && !sticks_out(&sst.meta, range)
@@ -699,7 +697,7 @@ impl CompactionWork {
699
697
  continue;
700
698
  }
701
699
  let mut it = sst
702
- .reader(&self.view.ssts, priority)?
700
+ .reader(&view.ssts, priority)?
703
701
  .iter(ScanFilter::all(), read);
704
702
  match &range.start {
705
703
  Some(s) => it.seek(s)?,
@@ -732,6 +730,11 @@ impl CompactionWork {
732
730
  }
733
731
 
734
732
  fn report(&mut self, result: Result<ManifestVersion>) {
733
+ // The inputs' pin goes first (#1765): once the shard hears of the report, the
734
+ // compaction's caller may run on (`compact` returns), and a `shrink` it starts must
735
+ // find the inputs this job retired free to reclaim, not pinned by a task the runtime
736
+ // has yet to drop.
737
+ self.view = None;
735
738
  let nanos = self
736
739
  .shared
737
740
  .vfs
@@ -1131,6 +1134,11 @@ impl Task for CompactionWork {
1131
1134
  Stage::Commit(rx) => match self.waker.poll(waker, rx) {
1132
1135
  Poll::Ready(Some(r)) => {
1133
1136
  self.report(r);
1137
+ #[cfg(feature = "test-hooks")]
1138
+ self.shared
1139
+ .hooks
1140
+ .sites
1141
+ .run(crate::engine::hooks::HookSite::CompactionReported);
1134
1142
  return TaskPoll::Done;
1135
1143
  }
1136
1144
  Poll::Ready(None) => {
@@ -84,6 +84,10 @@ pub enum HookSite {
84
84
  /// cross-shard commit whose share apply failed: where a caller that heard the answer
85
85
  /// commits again while the shard thread is still inside the handler (#1358).
86
86
  FailedShareAnswered,
87
+ /// On the thread running a compaction task, after the task reported its committed
88
+ /// result to its shard and before the task ends: where the compaction's caller can run
89
+ /// on while the runtime still holds the task (#1765).
90
+ CompactionReported,
87
91
  }
88
92
 
89
93
  /// A one-shot test callback.
@@ -969,6 +969,13 @@ impl Engine {
969
969
  // The change feed's sequence check (D310 §2.2): the superblock's sequence before any
970
970
  // root commit of this open.
971
971
  let opened_at = opened.sequence();
972
+ // And its checksum: a trailing RootIntent a 1.2 build's crash left in the sidecar is
973
+ // decided by both (D315 amendment, #1504; resolved as 1.2 does, so a later 1.2 open
974
+ // still chains through it).
975
+ let opened_root = crate::feed::OpenedRoot {
976
+ sequence: opened_at,
977
+ checksum: opened.checksum(),
978
+ };
972
979
  // The clean flag is informational only: WAL replay is never skipped (decision D57).
973
980
  let _clean = opened.clean_shutdown();
974
981
  let (mut catalog, manifest_extents) =
@@ -1025,7 +1032,7 @@ impl Engine {
1025
1032
  let feed = if no_writes {
1026
1033
  None
1027
1034
  } else {
1028
- crate::feed::open_session(&vfs, path, db_id, &catalog, &options, shards, opened_at)?
1035
+ crate::feed::open_session(&vfs, path, db_id, &catalog, &options, shards, opened_root)?
1029
1036
  };
1030
1037
  if let Some(f) = &feed {
1031
1038
  let weak = Arc::downgrade(f);
@@ -90,6 +90,7 @@ pub(crate) fn open_sidecar(
90
90
  db_id: [u8; 16],
91
91
  entry: &FeedEntry,
92
92
  create: bool,
93
+ opened: OpenedRoot,
93
94
  ) -> Result<Option<Sidecar>> {
94
95
  let path = sidecar_path(db);
95
96
  let exists = vfs.exists(&path)?;
@@ -105,7 +106,12 @@ pub(crate) fn open_sidecar(
105
106
  let valid = match FeedHeader::decode(&bytes) {
106
107
  Ok(h) if h.db_id == db_id => {
107
108
  let (_, end) = decode_entries(&bytes[FeedHeader::LEN..]);
108
- Some(FeedHeader::LEN + end)
109
+ Some(resolve_intent(
110
+ &file,
111
+ &bytes,
112
+ FeedHeader::LEN + end,
113
+ opened,
114
+ )?)
109
115
  }
110
116
  // Another database's, or a torn or damaged header: its history is not ours. A reader
111
117
  // finds no session for the segments' marks and expires.
@@ -148,6 +154,99 @@ pub(crate) fn open_sidecar(
148
154
  Ok(Some(sidecar))
149
155
  }
150
156
 
157
+ /// The superblock an open read, before any root commit of its own: its `sequence` and
158
+ /// checksum (FORMAT §8.2), which decide a trailing `RootIntent` (D315 amendment).
159
+ #[derive(Debug, Clone, Copy, PartialEq, Eq)]
160
+ pub(crate) struct OpenedRoot {
161
+ pub(crate) sequence: u64,
162
+ pub(crate) checksum: u64,
163
+ }
164
+
165
+ /// A 1.2 build's sidecar entry types this build reads as `FeedEntry::Unknown` (FORMAT §10
166
+ /// on 1.2): a root commit's catalog change, and a root commit's intent.
167
+ const CATALOG: u8 = 4;
168
+ const ROOT_INTENT: u8 = 5;
169
+
170
+ /// Resolves a `RootIntent` a 1.2 build left as the sidecar's last entry, before this open
171
+ /// appends anything, as 1.2's own open does (D315 amendment, #1504): a process crash came
172
+ /// between that root commit's intent and its Root entry. Returns where the valid entries
173
+ /// now end. Left in place, the intent would sit before this open's own entry, and a later
174
+ /// 1.2 open reads an intent anywhere but last as a break in the feed's history: the feed
175
+ /// would survive the rollback to this build and expire on the move back.
176
+ ///
177
+ /// - The root landed (the superblock this open read has the intent's sequence and
178
+ /// checksum): the intent becomes that session's `Root`, written over it in place (the two
179
+ /// frames are the same length), as if no crash happened.
180
+ /// - It didn't (its sequence is one past the superblock's): the intent goes, with the
181
+ /// `Catalog` entry of the same root before it, if any, cut off as a torn tail is. So does
182
+ /// a lone `Catalog` entry at the end for a root one past the superblock's.
183
+ /// - Anything else: left alone.
184
+ ///
185
+ /// `bytes` is the whole file and `end` where its valid entries end.
186
+ fn resolve_intent(file: &FileRef, bytes: &[u8], end: usize, opened: OpenedRoot) -> Result<usize> {
187
+ // Each valid frame's offset and payload: `len` u32, CRC32C u32, then the payload, whose
188
+ // first byte is its type (the framing every build shares).
189
+ let mut frames: Vec<(usize, &[u8])> = Vec::new();
190
+ let mut at = FeedHeader::LEN;
191
+ while at + 8 <= end {
192
+ let len = u32::from_le_bytes(bytes[at..at + 4].try_into().expect("4 bytes")) as usize;
193
+ let payload = &bytes[at + 8..at + 8 + len];
194
+ frames.push((at, payload));
195
+ at += 8 + len;
196
+ }
197
+ // A u64 field of a payload, after its type byte.
198
+ let field = |p: &[u8], i: usize| -> Option<u64> {
199
+ Some(u64::from_le_bytes(
200
+ p.get(1 + 8 * i..9 + 8 * i)?.try_into().ok()?,
201
+ ))
202
+ };
203
+ let Some(&(last_at, last)) = frames.last() else {
204
+ return Ok(end);
205
+ };
206
+ match last.first() {
207
+ // A Catalog's fields: session, sequence, ...
208
+ Some(&CATALOG) if field(last, 1) == Some(opened.sequence + 1) => {
209
+ file.set_len(last_at as u64)?;
210
+ Ok(last_at)
211
+ }
212
+ Some(&ROOT_INTENT) => {
213
+ let (Some(sequence), Some(checksum)) = (field(last, 0), field(last, 1)) else {
214
+ return Ok(end);
215
+ };
216
+ if sequence == opened.sequence && checksum == opened.checksum {
217
+ // The session that wrote it: the last Session entry before it.
218
+ let (entries, _) = decode_entries(&bytes[FeedHeader::LEN..end]);
219
+ let session = entries.iter().rev().find_map(|e| match e {
220
+ FeedEntry::Session { session, .. } => Some(*session),
221
+ _ => None,
222
+ });
223
+ if let Some(session) = session {
224
+ let mut root = Vec::with_capacity(32);
225
+ FeedEntry::Root { session, sequence }.encode(&mut root);
226
+ if root.len() == 8 + last.len() {
227
+ file.write_at(&root, last_at as u64)?;
228
+ }
229
+ }
230
+ Ok(end)
231
+ } else if sequence == opened.sequence + 1 {
232
+ let cut = match frames.iter().rev().nth(1) {
233
+ Some(&(before, p))
234
+ if p.first() == Some(&CATALOG) && field(p, 1) == Some(sequence) =>
235
+ {
236
+ before
237
+ }
238
+ _ => last_at,
239
+ };
240
+ file.set_len(cut as u64)?;
241
+ Ok(cut)
242
+ } else {
243
+ Ok(end)
244
+ }
245
+ }
246
+ _ => Ok(end),
247
+ }
248
+ }
249
+
151
250
  /// What an open inherits from the sidecar's last session (the D310 amendment, the owner
152
251
  /// 2026-11-02): its retention, age, stream count and fed tables, so an open that doesn't
153
252
  /// mention the feed (a tool's, `phdb`'s) continues its history instead of ending it.
@@ -161,7 +260,8 @@ pub(crate) struct LastSession {
161
260
 
162
261
  /// The sidecar's last session, read-only: `None` without a sidecar, with another database's
163
262
  /// or a damaged header, or when the last open recorded "fed: none" (or an entry this build
164
- /// doesn't know, which fails closed). Root entries after the session don't change it.
263
+ /// doesn't know, which fails closed). Root entries after the session don't change it, nor
264
+ /// do a 1.2 build's Catalog and RootIntent entries.
165
265
  pub(crate) fn last_session(
166
266
  vfs: &VfsRef,
167
267
  db: &Path,
@@ -186,7 +286,10 @@ pub(crate) fn last_session(
186
286
  pub(crate) fn last_of(entries: &[FeedEntry]) -> Option<LastSession> {
187
287
  for e in entries.iter().rev() {
188
288
  match e {
189
- FeedEntry::Root { .. } => continue,
289
+ // A 1.2 build's catalog change (type 4) and root-commit intent (type 5) are its
290
+ // session's, as its Root entries are: they never change what it fed. So an open
291
+ // that inherits the feed after 1.2 (a rollback to this build) keeps it on.
292
+ FeedEntry::Root { .. } | FeedEntry::Unknown(CATALOG | ROOT_INTENT) => continue,
190
293
  FeedEntry::Session {
191
294
  retention_bytes,
192
295
  retention_age_secs,
@@ -217,8 +320,9 @@ pub(crate) fn open_session(
217
320
  catalog: &Catalog,
218
321
  options: &EngineOptions,
219
322
  shards: usize,
220
- opened_at: u64,
323
+ opened: OpenedRoot,
221
324
  ) -> Result<Option<Arc<Feed>>> {
325
+ let opened_at = opened.sequence;
222
326
  let Some(cfg) = &options.feed else {
223
327
  open_sidecar(
224
328
  vfs,
@@ -228,6 +332,7 @@ pub(crate) fn open_session(
228
332
  sequence: opened_at,
229
333
  },
230
334
  false,
335
+ opened,
231
336
  )?;
232
337
  return Ok(None);
233
338
  };
@@ -263,7 +368,7 @@ pub(crate) fn open_session(
263
368
  streams: streams as u32,
264
369
  tables: tables.clone(),
265
370
  };
266
- let sidecar = open_sidecar(vfs, path, db_id, &entry, true)?
371
+ let sidecar = open_sidecar(vfs, path, db_id, &entry, true, opened)?
267
372
  .ok_or_else(|| Error::Corruption("the feed sidecar could not be created".into()))?;
268
373
  let mut feed = Feed::new(session, retain, cfg.max_age_micros, tables, shards);
269
374
  feed.retain_bytes_per_stream = cfg.retention_bytes / streams;
@@ -951,6 +1056,21 @@ mod tests {
951
1056
  );
952
1057
  // An entry this build doesn't know: fail closed.
953
1058
  assert_eq!(last_of(&[session(3), FeedEntry::Unknown(0xee)]), None);
1059
+ // A 1.2 build's Catalog and RootIntent entries are its session's (a rollback from
1060
+ // 1.2 after a crash inside a root commit leaves both last).
1061
+ assert_eq!(
1062
+ last_of(&[
1063
+ session(3),
1064
+ FeedEntry::Unknown(CATALOG),
1065
+ FeedEntry::Root {
1066
+ session: 1,
1067
+ sequence: 2,
1068
+ },
1069
+ FeedEntry::Unknown(CATALOG),
1070
+ FeedEntry::Unknown(ROOT_INTENT),
1071
+ ]),
1072
+ Some(want.clone())
1073
+ );
954
1074
  // A feed-off open, then a feeding one: that one.
955
1075
  assert_eq!(
956
1076
  last_of(&[FeedEntry::Unfed { sequence: 1 }, session(3)]),
@@ -199,7 +199,8 @@ struct StreamRead {
199
199
  must_reach: Option<Lsn>,
200
200
  }
201
201
 
202
- /// The sessions whose segments the feed's history runs through (the mark rule).
202
+ /// The sessions whose segments the feed's history runs through (the mark rule), newest
203
+ /// first ([`chain`]'s order).
203
204
  #[derive(Debug)]
204
205
  struct History {
205
206
  sessions: Vec<u64>,
@@ -209,6 +210,18 @@ impl History {
209
210
  fn holds(&self, session: u64) -> bool {
210
211
  session != 0 && self.sessions.contains(&session)
211
212
  }
213
+
214
+ /// Whether `session` came after `than` in the history: by the chain's order, never by
215
+ /// value, since session ids are random (#1810). Any held session is later than none
216
+ /// (0, a feed that has read nothing yet) and than one the history doesn't hold.
217
+ fn later(&self, session: u64, than: u64) -> bool {
218
+ let at = |s: u64| self.sessions.iter().position(|&x| x == s);
219
+ match (at(session), at(than)) {
220
+ (Some(a), Some(b)) => a < b,
221
+ (Some(_), None) => true,
222
+ (None, _) => false,
223
+ }
224
+ }
212
225
  }
213
226
 
214
227
  /// Distinguishes feed readers' entries in the watermark registries from commits' and
@@ -392,8 +405,12 @@ impl FeedReader {
392
405
  };
393
406
  // Where each stream starts, and the bound below which nothing is delivered.
394
407
  let starts: Vec<(Lsn, Option<Lsn>)> = match (spec.start, earlier) {
395
- (_, Some((bound, at))) => {
408
+ (_, Some((bound, at, session))) => {
396
409
  this.delivered = bound;
410
+ // The earlier session it starts in, as a non-token start names its own
411
+ // (P2-C6): with 0 a token taken before any record skipped the history check.
412
+ // Records of later sessions move it on (`raise_session`).
413
+ this.session = session;
397
414
  at.into_iter().map(|a| (a, None)).collect()
398
415
  }
399
416
  (FeedStart::Token(bytes), None) => match this.decode_token(&bytes, db_id)? {
@@ -441,6 +458,10 @@ impl FeedReader {
441
458
  FeedStart::Token(_) => unreachable!("handled above"),
442
459
  };
443
460
  this.delivered = bound;
461
+ // The bound and the starts are this session's state, so a token taken
462
+ // before any record is read names it: with 0 a resume skipped the history
463
+ // check (audit120's P2-C6).
464
+ this.session = this.current;
444
465
  let mut starts = Vec::with_capacity(this.shared.shards);
445
466
  for (s, m) in marks.iter().enumerate() {
446
467
  // A reader process has no checkpoint history: from its checkpoint for
@@ -854,8 +875,11 @@ impl FeedReader {
854
875
  }
855
876
  }
856
877
  let inside = self.history.holds(session);
857
- if inside {
858
- self.session = self.session.max(session);
878
+ // The token names the latest session read through, by the history's order: a
879
+ // resume on a copy without it must expire (#1810).
880
+ // Compared only when it differs, once per session crossed, not per record.
881
+ if inside && session != self.session && self.history.later(session, self.session) {
882
+ self.session = session;
859
883
  }
860
884
  match item {
861
885
  Item::Single { seqno, ts, changes } => {
@@ -1266,7 +1290,9 @@ impl FeedReader {
1266
1290
  ///
1267
1291
  /// `None` (the current history decides) when no earlier session qualifies or anything
1268
1292
  /// read fails: a later start only has a larger bound, so it is always safe (simp724).
1269
- fn earlier_start(&self, db_id: [u8; 16]) -> Option<(Seqno, Vec<Lsn>)> {
1293
+ /// With the bound and the starts, the session they are in: a token taken before any
1294
+ /// record is read names it (audit120's P2-C6, perf2's remainder).
1295
+ fn earlier_start(&self, db_id: [u8; 16]) -> Option<(Seqno, Vec<Lsn>, u64)> {
1270
1296
  let shards = self.shared.shards;
1271
1297
  let open = |s: usize, at: Lsn| {
1272
1298
  FeedCursor::open(
@@ -1337,7 +1363,7 @@ impl FeedReader {
1337
1363
  // A session that logged nothing: the next one decides.
1338
1364
  let Some(first) = first else { continue };
1339
1365
  let at = firsts.iter().map(|f| Lsn::new(f[&session], 0)).collect();
1340
- return Some((first.saturating_sub(1), at));
1366
+ return Some((first.saturating_sub(1), at, session));
1341
1367
  }
1342
1368
  None
1343
1369
  }
@@ -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
  }
@@ -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.1"
40
+ version = "2.0.3"
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.1"
5
+ version = "=2.0.3"
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.1"
20
+ version = "2.0.3"
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.1"
7
+ version = "1.1.3"
8
8
  [dependencies.pigeonhole-text]
9
9
  path = "../text"
10
- version = "1.1.1"
10
+ version = "1.1.3"
11
11
  [dependencies.pigeonhole-vector]
12
12
  path = "../vector"
13
- version = "1.1.1"
13
+ version = "1.1.3"
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.1"
34
+ version = "1.1.3"
@@ -2,10 +2,10 @@
2
2
 
3
3
  [dependencies.pigeonhole-format]
4
4
  path = "../format"
5
- version = "=2.0.1"
5
+ version = "=2.0.3"
6
6
  [dependencies.pigeonhole-io]
7
7
  path = "../io"
8
- version = "=2.0.1"
8
+ version = "=2.0.3"
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.1"
23
+ version = "2.0.3"
24
24
  [target."cfg(loom)"]
@@ -561,9 +561,7 @@ impl ShardArena {
561
561
  count += 1;
562
562
  }
563
563
  if self.usable(first, count) >= bytes {
564
- for c in first..first + count {
565
- self.free[c] = false;
566
- }
564
+ self.free[first..first + count].fill(false);
567
565
  self.free_count -= count;
568
566
  return Ok(Run {
569
567
  first: first as u32,
@@ -1155,6 +1153,17 @@ impl MemtableReader {
1155
1153
  self.len() == 0
1156
1154
  }
1157
1155
 
1156
+ /// The bytes written into the arena for its entries (the header's byte field, which the
1157
+ /// writer raises as it inserts; at most the writer's [`Memtable::allocated_bytes`]):
1158
+ /// about an upper bound on the SST written from them. A size estimate only (a backup
1159
+ /// sizes its SSTs' extents by it, #1595): read Relaxed, as the writer stores it, so on a
1160
+ /// memtable still taking inserts it can trail [`len`](Self::len)'s entries.
1161
+ pub fn bytes(&self) -> u64 {
1162
+ self.region
1163
+ .mem
1164
+ .load_u64(self.root as usize + layout::H_BYTES, Ordering::Relaxed)
1165
+ }
1166
+
1158
1167
  /// A cursor, initially unpositioned. Holds its own clone of the reader, so it can be
1159
1168
  /// stored beside the view that keeps the arena memory alive.
1160
1169
  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.1"
5
+ version = "=2.0.3"
6
6
  [dependencies.pigeonhole-io]
7
7
  path = "../io"
8
- version = "=2.0.1"
8
+ version = "=2.0.3"
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.1"
23
+ version = "2.0.3"
@@ -270,6 +270,16 @@ impl OpenedPager {
270
270
  self.superblock.sequence
271
271
  }
272
272
 
273
+ /// The newest valid superblock's checksum (FORMAT §8.2: its bytes 120..128, the xxh3-64
274
+ /// of bytes 0..120), before any root commit of this open: what a 1.2 build's change feed
275
+ /// recorded in a root commit's intent (`RootIntent`, D315 amendment, #1504), which this
276
+ /// open resolves.
277
+ pub fn checksum(&self) -> u64 {
278
+ let mut page = [0u8; PAGE_SIZE];
279
+ self.superblock.encode(&mut page);
280
+ u64::from_le_bytes(page[120..128].try_into().expect("8 bytes"))
281
+ }
282
+
273
283
  /// Whether the last writer closed cleanly. The flag stays set until the next root
274
284
  /// commit, which clears it.
275
285
  pub fn clean_shutdown(&self) -> bool {
@@ -8,16 +8,16 @@ optional = true
8
8
  version = "0.3"
9
9
  [dependencies.pigeonhole-engine]
10
10
  path = "../engine"
11
- version = "=2.0.1"
11
+ version = "=2.0.3"
12
12
  [dependencies.pigeonhole-format]
13
13
  path = "../format"
14
- version = "=2.0.1"
14
+ version = "=2.0.3"
15
15
  [dependencies.pigeonhole-io]
16
16
  path = "../io"
17
- version = "=2.0.1"
17
+ version = "=2.0.3"
18
18
  [dependencies.pigeonhole-shm]
19
19
  path = "../shm"
20
- version = "=2.0.1"
20
+ version = "=2.0.3"
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.1"
42
+ version = "1.1.3"
@@ -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.1 release](https://github.com/CodingAnarchy/pigeonhole/releases/tag/v1.1.1).
42
+ [1.1.3 release](https://github.com/CodingAnarchy/pigeonhole/releases/tag/v1.1.3).
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.1"
5
+ version = "=2.0.3"
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.1"
20
+ version = "2.0.3"
21
21
  [target."cfg(loom)"]
@@ -2,10 +2,10 @@
2
2
 
3
3
  [dependencies.pigeonhole-format]
4
4
  path = "../format"
5
- version = "=2.0.1"
5
+ version = "=2.0.3"
6
6
  [dependencies.pigeonhole-io]
7
7
  path = "../io"
8
- version = "=2.0.1"
8
+ version = "=2.0.3"
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.1"
23
+ version = "2.0.3"
24
24
  [target."cfg(unix)"]
@@ -2,13 +2,13 @@
2
2
 
3
3
  [dependencies.pigeonhole-cache]
4
4
  path = "../cache"
5
- version = "=2.0.1"
5
+ version = "=2.0.3"
6
6
  [dependencies.pigeonhole-format]
7
7
  path = "../format"
8
- version = "=2.0.1"
8
+ version = "=2.0.3"
9
9
  [dependencies.pigeonhole-io]
10
10
  path = "../io"
11
- version = "=2.0.1"
11
+ version = "=2.0.3"
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.1"
26
+ version = "2.0.3"
@@ -4,7 +4,7 @@
4
4
  version = "0.2.1"
5
5
  [dependencies.pigeonhole]
6
6
  path = "../pigeonhole"
7
- version = "1.1.1"
7
+ version = "1.1.3"
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.1"
26
+ version = "1.1.3"
@@ -6,7 +6,7 @@ optional = true
6
6
  version = "0.3"
7
7
  [dependencies.pigeonhole]
8
8
  path = "../pigeonhole"
9
- version = "1.1.1"
9
+ version = "1.1.3"
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.1"
28
+ version = "1.1.3"
@@ -2,10 +2,10 @@
2
2
 
3
3
  [dependencies.pigeonhole-format]
4
4
  path = "../format"
5
- version = "=2.0.1"
5
+ version = "=2.0.3"
6
6
  [dependencies.pigeonhole-io]
7
7
  path = "../io"
8
- version = "=2.0.1"
8
+ version = "=2.0.3"
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.1"
25
+ version = "2.0.3"
@@ -62,13 +62,18 @@ pub(crate) struct Grid {
62
62
  }
63
63
 
64
64
  /// The segment header in `probe`, or `None` where there is none (a blank or torn slot). A
65
- /// header whose checksum passed but whose version is newer was written by a newer build:
66
- /// refused, never read as a blank or torn slot with its records skipped, nor the stream as
67
- /// empty (#496, the #774 hazard).
65
+ /// header whose checksum passed but whose version is newer, or which carries a `features`
66
+ /// bit this build doesn't know, was written by a newer build: refused, never read as a blank
67
+ /// or torn slot with its records skipped, nor the stream as empty (#496, the #774 hazard).
68
+ /// The checksum is verified before the features are read, so a torn header stays blank. As
69
+ /// `phdb check` reads them (`check.rs`).
68
70
  fn decode_header(probe: &[u8]) -> Result<Option<SegmentHeader>> {
69
71
  match SegmentHeader::decode(probe) {
70
72
  Ok(h) => Ok(Some(h)),
71
- Err(e @ pigeonhole_format::Error::UnsupportedVersion { .. }) => Err(e.into()),
73
+ Err(
74
+ e @ (pigeonhole_format::Error::UnsupportedVersion { .. }
75
+ | pigeonhole_format::Error::UnsupportedFeature { .. }),
76
+ ) => Err(e.into()),
72
77
  Err(_) => Ok(None),
73
78
  }
74
79
  }
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.1
4
+ version: 1.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Matt Tanous