Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

irmin-pack: fix v2 lower migration #2241

Merged
merged 3 commits into from
May 3, 2023
Merged

Conversation

metanivek
Copy link
Member

Previously we did not take the dead header of the dict into account when performing a lower layer migration for older stores. This commit fixes this issue by removing the dead header from the dict during the migration.

I also added some tests for v3 stores and updated migration tests to ensuring reading contents after a migration works. These tests all passed anyway, but thought it didn't hurt for completeness against potential future changes.

@metanivek metanivek requested a review from art-w April 28, 2023 18:27
@codecov-commenter
Copy link

codecov-commenter commented Apr 28, 2023

Codecov Report

Merging #2241 (0225111) into main (4c38a4b) will increase coverage by 0.02%.
The diff coverage is 80.00%.

❗ Current head 0225111 differs from pull request most recent head fffa054. Consider uploading reports for the commit fffa054 to get more accurate results

📣 This organization is not using Codecov’s GitHub App Integration. We recommend you install it so Codecov can continue to function properly for your repositories. Learn more

@@            Coverage Diff             @@
##             main    #2241      +/-   ##
==========================================
+ Coverage   67.93%   67.96%   +0.02%     
==========================================
  Files         136      136              
  Lines       16603    16621      +18     
==========================================
+ Hits        11279    11296      +17     
- Misses       5324     5325       +1     
Impacted Files Coverage Δ
src/irmin-pack/unix/gc.ml 69.79% <0.00%> (-3.62%) ⬇️
src/irmin-pack/unix/file_manager.ml 85.78% <100.00%> (+0.79%) ⬆️

... and 1 file with indirect coverage changes

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@metanivek metanivek changed the title imrmin-pack: fix v2 lower migration irmin-pack: fix v2 lower migration May 1, 2023
Previously we did not take the dead header of the dict into account when
performing a lower layer migration for older stores. This commit fixes
this issue by removing the dead header from the dict during the
migration.
These stores migrate fine (these tests did not fail) but adding them for
completeness as we add future stores. Also added a line that reads all
contents in the store to ensure data moved correctly during the
migration.
Copy link
Contributor

@art-w art-w left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested and it works great, thanks!

edit: the CI reports a GC crash with flambda though? https://ocaml.ci.dev/github/mirage/irmin/commit/fffa054dc2de6acb750bde44d085dac1448564d3/variant/debian-11-4.14%2Bflambda_opam-2.1 (I'm relaunching it to see if it's flaky, copied the previous crash report below)

┌──────────────────────────────────────────────────────────────────────────────┐
│ [FAIL]        upgrade                       0   upgrade From_v3.             │
└──────────────────────────────────────────────────────────────────────────────┘
...
+24066583us src/irmin-pack/unix/dict.ml:78      [DEBUG] [dict] find 0
+24066658us src/irmin-pack/unix/pack_store.ml:274 [DEBUG] key_of_offset: 164
+24066726us src/irmin-pack/unix/dispatcher.ml:90 [DEBUG] read_range_exn ~off:164 ~min_len:21 ~max_len:30
+24066797us src/irmin-pack/unix/pack_store.ml:274 [DEBUG] key_of_offset: 122
+24066856us src/irmin-pack/unix/dispatcher.ml:90 [DEBUG] read_range_exn ~off:122 ~min_len:21 ~max_len:30
+24066917us src/irmin-pack/unix/pack_store.ml:274 [DEBUG] key_of_offset: 54
+24066971us src/irmin-pack/unix/dispatcher.ml:90 [DEBUG] read_range_exn ~off:54 ~min_len:21 ~max_len:30
+24068851us src/irmin-pack/unix/dispatcher.ml:90 [DEBUG] read_range_exn ~off:54 ~min_len:34 ~max_len:34
+24068939us src/irmin-pack/unix/dict.ml:78      [DEBUG] [dict] find 0
+24068991us src/irmin-pack/unix/pack_store.ml:274 [DEBUG] key_of_offset: 29
+24069046us src/irmin-pack/unix/dispatcher.ml:90 [DEBUG] read_range_exn ~off:29 ~min_len:21 ~max_len:30
+24069848us src/irmin-pack/unix/gc_worker.ml:340 [DEBUG] GC: transfering to the new prefix
+24070334us src/irmin-pack/unix/dispatcher.ml:90 [DEBUG] read_range_exn ~off:29 ~min_len:1 ~max_len:59
+24070398us src/irmin-pack/unix/dispatcher.ml:90 [DEBUG] read_range_exn ~off:122 ~min_len:1 ~max_len:161
+24071143us index                               [DEBUG] [test-upgrade] close
+24071194us index                               [DEBUG] [test-upgrade] last open instance: closing the file descriptor
+24088199us src/irmin-pack/unix/file_manager.ml:291 [DEBUG] Remove residual file _build/test-upgrade/store.1.mapping
+24134027us src/irmin-pack/unix/file_manager.ml:291 [DEBUG] Remove residual file _build/test-upgrade/store.1.prefix
[exception] Pack_error: {"Gc_process_died_without_result_file":"success {\"No_such_file_or_directory\":\"_build/test-upgrade/store.1.out\"}"}
            Raised at Irmin_pack_unix__Errors.Base.raise_error in file "src/irmin-pack/unix/errors.ml", line 123, characters 26-46
            Called from Lwt.Sequential_composition.bind.create_result_promise_and_callback_if_deferred.callback in file "src/core/lwt.ml", line 1849, characters 23-26
            
Logs saved to `/src/_build/default/test/irmin-pack/_build/_tests/irmin-pack/upgrade.000.output'.
 ──────────────────────────────────────────────────────────────────────────────
Full test results in `/src/_build/default/test/irmin-pack/_build/_tests/irmin-pack'.
1 failure! in 134.178s. 239 tests run.
...
...
"/bin/bash" "-c" "opam exec -- dune build @install @check @runtest && rm -rf _build" failed with exit status 1
2023-05-02 18:31.32: Job failed: Failed: Build failed
2023-05-02 18:31.32: Log analysis:
2023-05-02 18:31.32: >>> [FAIL]        upgrade                       0   upgrade From_v3. (score = 30)
2023-05-02 18:31.32: >>> [FAIL]        upgrade                       0   upgrade From_v3.             │ (score = 30)
2023-05-02 18:31.32: >>> Unix_error(Unix.ENOENT, "unlink", "_build/test-upgrade/store.1.out") (score = 30)
2023-05-02 18:31.32: >>> Unix_error(Unix.ENOENT, "unlink", "_build/test-upgrade/store.1.out") (score = 30)
2023-05-02 18:31.32: >>> Unix_error(Unix.ENOENT, "unlink", "_build/test-upgrade/store.1.out") (score = 30)
2023-05-02 18:31.32: >>> Unix_error(Unix.ENOENT, "unlink", "_build/test-upgrade/store.1.out") (score = 30)
2023-05-02 18:31.32: >>> Unix_error(Unix.ENOENT, "unlink", "_build/test-upgrade/store.1.out") (score = 30)
2023-05-02 18:31.32: >>> Unix_error(Unix.ENOENT, "unlink", "_build/test-upgrade/store.1.out") (score = 30)
2023-05-02 18:31.32: >>> Unix_error(Unix.ENOENT, "unlink", "_build/test-upgrade/store.1.out") (score = 30)
2023-05-02 18:31.32: >>> [exception] Pack_error: {"Gc_process_died_without_result_file":"success {\"No_such_file_or_directory\":\"_build/test-upgrade/store.1.out\"}"} (score = 35)
2023-05-02 18:31.32: Exception: Pack_error: {"Gc_process_died_without_result_file":"success {\"No_such_file_or_directory\":\"_build/test-upgrade/store.1.out\"}"}

@metanivek metanivek merged commit a17f820 into mirage:main May 3, 2023
3 of 5 checks passed
@metanivek metanivek deleted the fix_v2_migration branch May 3, 2023 13:55
metanivek added a commit to metanivek/opam-repository that referenced this pull request May 3, 2023
…min-pack, irmin-pack-tools, irmin-mirage, irmin-mirage-graphql, irmin-mirage-git, irmin-http, irmin-graphql, irmin-git, irmin-fs, irmin-containers, irmin-cli, irmin-chunk and irmin-bench (3.7.1)

CHANGES:

### Fixed

- **irmin-pack**
  - Fix issue when migrating v2 stores to use lower layer (@metanivek, mirage/irmin#2241)
  - Fix issue when calling GC for a commit in the lower after migration
    (@metanivek, mirage/irmin#2242)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants