Commit Graph

2000 Commits

Author SHA1 Message Date
Ming-Hung Tsai
c8a1da1df9 [all] Apply cargo fmt, and fix clippy warnings 2021-10-20 20:23:27 +08:00
Ming-Hung Tsai
13aeefcdeb [thin] Fix typo 2021-10-20 20:23:27 +08:00
Joe Thornber
959b04ecb5 [thin_dump] fix overrides 2021-10-20 13:06:15 +01:00
Joe Thornber
56ea130650 [tests/thin_dump] Update help string 2021-10-19 15:24:16 +01:00
Joe Thornber
a568da8c71 [tests/thin_dump] remove some extraneous output to stderr 2021-10-19 15:23:17 +01:00
Joe Thornber
c5645d798f [tests/thin_delta] fix bad_option check 2021-10-19 14:25:56 +01:00
Joe Thornber
44d29b0467 [tests/thin_check] Clean up test dir 2021-10-19 14:25:25 +01:00
Joe Thornber
98be38dc4c [tests] Improve stdout/stderr logging when running sub processes 2021-10-19 14:20:47 +01:00
Joe Thornber
13400c2465 [tests/thin_delta] thin_delta should be a c++ command 2021-10-19 14:11:56 +01:00
Joe Thornber
6c5405ccf8 [tests] Get the run_* functions to log what they're doing. 2021-10-18 16:59:17 +01:00
Joe Thornber
024554c987 Merge rust tools into a single pdata_tools exe 2021-10-11 12:07:26 +01:00
Joe Thornber
c9b47437f2
Merge pull request #189 from mingnus/2021-08-30-functional-tests
Functional tests and misc fixes
2021-09-30 15:15:21 +01:00
Ming-Hung Tsai
d712190db4 [io_engine (rust)] Open file exclusively 2021-09-22 17:07:56 +08:00
Ming-Hung Tsai
6bd7741dfa [cache_repair] Avoid touching the output file by checking input file earlier
The output file has been checked by the caller, so there's no need
to check the output file again.
2021-09-22 17:07:56 +08:00
Ming-Hung Tsai
5abb92838c [tests] Port the remaining cache tests 2021-09-22 17:07:56 +08:00
Ming-Hung Tsai
66c1d629a4 [all (rust)] Keep silent if --quiet was applied 2021-09-22 17:07:56 +08:00
Ming-Hung Tsai
d436f35ed3 [thin_dump/thin_repair/thin_restore (rust)] Fix errors in tests
- Move error messages to stderr
- Fix the transaction_id and data_block_size in test fixture,
  and check the data_block_size in thin_restore.
- Disable the missing_something tests for Rust. The transaction_id
  and nr_data_blocks now could be recovered automatically.
- Limit the use of override options in test cases. Only broken
  superblocks could be overridden, and the provided values
  should be compatible to the original metadata.
- Remove unused option
2021-09-22 17:06:28 +08:00
Ming-Hung Tsai
c133e62353 [thin_dump] Emit superblock flags 2021-09-22 17:05:59 +08:00
Ming-Hung Tsai
34f927d989 [thin_check (rust)] Make better use of Rust's Result type
Replace the bail_out checking with the returned Result, which helps
decoupling the internal state of Report from application logic.
2021-09-22 17:05:59 +08:00
Ming-Hung Tsai
438730951e [thin_check (rust)] Allow ignoring non-fatal errors in mapping tree 2021-09-22 17:05:59 +08:00
Ming-Hung Tsai
a18fd60f3f [thin_check (rust)] Fix auto-repair related errors
- Returns error on metadata leaks
- Clear needs_check flag on success
- Check auto-repair write errors
- Fix file open flags, and correct spelling
2021-09-22 17:05:59 +08:00
Ming-Hung Tsai
e7fa012701 [btree] Fix ref-counting on overwritten values 2021-09-22 17:05:59 +08:00
Ming-Hung Tsai
f8c40a1fda [thin_check (rust)] Set compatibility between options 2021-09-22 17:05:59 +08:00
Ming-Hung Tsai
bb53083271 [array (rust)] Fix building uncontiguous array 2021-09-22 17:05:59 +08:00
Ming-Hung Tsai
2f22a8c55d [all (rust)] Fix errors in testing input option
- Fix file mode bits checking
- Return error reason from stat
2021-09-22 17:05:59 +08:00
Ming-Hung Tsai
4ed2348b36 [cache_restore (rust)] Fix errors in tests
- Move error messages to stderr (fixes unwritable_output_file,
  input_file_not_found, and missing_input_option)
- Validate XML structures implicitly (fixes corrupted_input_data)
- Check output file size (fixes tiny_output_file)
- Allow restoring XML without the hints (for creating test fixtures)
- Provide XML error context
- Remove unused option
2021-09-22 17:05:29 +08:00
Ming-Hung Tsai
59e44667a9 [tests] Port cache_restore tests 2021-09-16 21:55:46 +08:00
Ming-Hung Tsai
9253117132 [tests] Add cache fixtures
- Generate temp xml and metadata files
- Correct existing tests to use cache fixtures
- Fix cache xml generation
2021-09-16 21:55:46 +08:00
Ming-Hung Tsai
0acc57d17f [thin_restore (rust)] Fix errors in tests
- Move error messages to stderr (fixes unwritable_output_file,
  input_file_not_found, and missing_input_option)
- Validate XML structures implicitly (fixes corrupted_input_data)
- Check output file size (fixes tiny_output_file)
- Provide XML error context
- Fix mk_valid_input()
2021-09-16 21:55:46 +08:00
Ming-Hung Tsai
aaa84aa35a [tests] Enable tests for rust thin_repair 2021-09-16 21:55:46 +08:00
Ming-Hung Tsai
ea8dcb54d0 [tests] Fix the file size for testing 2021-09-16 21:55:46 +08:00
Ming-Hung Tsai
737cf2f67d [tests] Refine trait names 2021-09-16 21:55:20 +08:00
Ming-Hung Tsai
47d39d1efa [tests] Do not assume no stderr with thin_dump 2021-09-10 23:50:36 +08:00
Joe Thornber
9aa36f017a
Merge pull request #188 from mingnus/2021-08-05-thin-repair-find-roots
Support broken superblock in thin_repair
2021-09-10 13:59:16 +01:00
Ming-Hung Tsai
0d87619a93 [thin_repair/thin_dump (rust)] Show repairing progress 2021-08-27 17:30:56 +08:00
Ming-Hung Tsai
71d47ef58b [thin/cache (rust)] Validate superblock checksum 2021-08-27 11:17:27 +08:00
Ming-Hung Tsai
8a822cebec [thin_repair/thin_dump (rust)] Support rebuilding superblock 2021-08-27 02:17:57 +08:00
Ming-Hung Tsai
213442bffd [all (rust)] Fix cosmetic names for argument values 2021-08-27 02:17:57 +08:00
Ming-Hung Tsai
434d24d10a [thin_repair (rust)] Support setting missing superblock fields automatically
While rebuilding a superblock, the transaction_id, data_block_size, and
nr_data_blocks could be inherited from the current superblock if available
(assumed it's a multiple-activated copy, so supposed partially valid),
or derived from the probed data mappings and device details, that saves
the hassle of manual input.

Note that either the current superblock or user-overrides must be compatible
with the probed values, thus the filters are applied.
2021-08-27 02:17:57 +08:00
Ming-Hung Tsai
5dad1097c3 [thin_repair (rust)] Add searching for missing roots
Based on the method of commit 9e20465
2021-08-27 02:17:57 +08:00
Ming-Hung Tsai
b7132440d0 [space_map (rust)] Encapsulate implementations 2021-08-27 00:08:21 +08:00
Joe Thornber
15189aa28b
Merge pull request #187 from mingnus/2021-08-24-thin-repair-find-roots-fixes
Fix issues in finding roots
2021-08-26 16:23:24 +01:00
Ming-Hung Tsai
e6f17d4b4f [thin_repair/thin_dump] Exclude unwanted btree nodes 2021-08-24 22:26:22 +08:00
Ming-Hung Tsai
d2d6ab7926 [thin_repair/thin_dump] Check consistency of thin_ids before running a regular dump 2021-08-24 22:26:22 +08:00
Ming-Hung Tsai
d1e8168fb6 [thin_repair/thin_dump] Change the label type for empty leaves
Empty leaves now are treated as bottom-level leaves, so that empty
devices could be recovered.
2021-08-24 22:26:22 +08:00
Ming-Hung Tsai
c2e6db74b9 [thin_repair/thin_dump] Remove unused function parameter 2021-08-24 22:26:22 +08:00
Ming-Hung Tsai
c286041f25 [thin_repair/thin_dump] Fix sorting of data mapping candidates
- Fix the references for sorting. The timestamp statistics is stored
  in node_info corresponding to the second element.
- Fix the timestamp comparison routine. The mapping root with more recent
  blocks should have higher priority.
2021-08-24 22:26:15 +08:00
Joe Thornber
b58e42bb95
Merge pull request #185 from mingnus/2021-07-29-btree-builder-fixes
Fix reference counting in btree construction
2021-08-06 08:35:46 +01:00
Ming-Hung Tsai
ec44d043e8 [space_map (rust)] Restrict metadata space map size 2021-08-06 13:22:13 +08:00
Ming-Hung Tsai
c167403212 [space_map (rust)] Fix the maximum value of reference counts 2021-08-06 13:22:13 +08:00