Add update-only mode for test dataset generator

Add support for running content updates against an existing migration
test dataset without recreating the filesystem structure.

Also make ACL/xattr updates non-fatal on filesystems that do not
support those operations.
This commit is contained in:
2026-04-21 13:21:22 -04:00
parent 4275956259
commit 7c27535e2a
3 changed files with 42 additions and 17 deletions

View File

@@ -19,6 +19,9 @@ For migration test datasets in this workspace, follow this process by default:
- omit it to create the dataset once and exit
- use `0` for continuous random content updates
- use any integer greater than `0` to rewrite mutable files every `N` seconds
- The generator script also accepts `--update-only`:
- use it to update an existing dataset in place without recreating files, links, or directories
- combine it with `UPDATE_INTERVAL_SECONDS` to keep mutating an existing dataset on a fixed interval
- If ACL/xattr coverage matters, ensure the generation host has:
- `acl` installed for `setfacl` and `getfacl`
- `attr` installed for `setfattr` and `getfattr`
@@ -55,3 +58,4 @@ Preferred verification commands include:
- If the destination host lacks `acl` or `attr`, ACL/xattr verification will be incomplete.
- If the destination filesystem does not support ACLs or xattrs, those attributes may not survive transfer even when the copy method is correct.
- The generator now logs and continues when ACL/xattr assignment is unsupported on the target filesystem instead of exiting.

View File

@@ -5,7 +5,7 @@ set -euo pipefail
usage() {
cat <<'EOF'
Usage:
generate_migration_test_dataset.sh TARGET_DIR [UPDATE_INTERVAL_SECONDS]
generate_migration_test_dataset.sh [--update-only] TARGET_DIR [UPDATE_INTERVAL_SECONDS]
Creates a compact filesystem migration test dataset under TARGET_DIR.
The dataset matches the manifest in migration-test-manifest.md.
@@ -23,6 +23,12 @@ Notes:
EOF
}
UPDATE_ONLY=0
if [[ ${1:-} == "--update-only" ]]; then
UPDATE_ONLY=1
shift
fi
if [[ $# -lt 1 || $# -gt 2 ]]; then
usage
exit 1
@@ -132,17 +138,25 @@ apply_mode() {
set_acl_and_xattr_metadata() {
if (( have_setfattr )); then
setfattr -n user.migration_case -v "xattr-text" "$ROOT/metadata/xattr_text_1mb_644.txt"
setfattr -n user.migration_case -v "xattr-random" "$ROOT/metadata/xattr_random_3mb_600.bin"
if ! setfattr -n user.migration_case -v "xattr-text" "$ROOT/metadata/xattr_text_1mb_644.txt"; then
log "Skipping xattr assignment on $ROOT/metadata/xattr_text_1mb_644.txt: operation not supported"
fi
if ! setfattr -n user.migration_case -v "xattr-random" "$ROOT/metadata/xattr_random_3mb_600.bin"; then
log "Skipping xattr assignment on $ROOT/metadata/xattr_random_3mb_600.bin: operation not supported"
fi
else
echo "Skipping xattr assignment: setfattr not available"
log "Skipping xattr assignment: setfattr not available"
fi
if (( have_setfacl )); then
setfacl -m u:nobody:r-- "$ROOT/metadata/acl_text_1mb_644.txt"
setfacl -m u:nobody:r-x "$ROOT/metadata/acl_script_1mb_755.sh"
if ! setfacl -m u:nobody:r-- "$ROOT/metadata/acl_text_1mb_644.txt"; then
log "Skipping ACL assignment on $ROOT/metadata/acl_text_1mb_644.txt: operation not supported"
fi
if ! setfacl -m u:nobody:r-x "$ROOT/metadata/acl_script_1mb_755.sh"; then
log "Skipping ACL assignment on $ROOT/metadata/acl_script_1mb_755.sh: operation not supported"
fi
else
echo "Skipping ACL assignment: setfacl not available"
log "Skipping ACL assignment: setfacl not available"
fi
}
@@ -357,16 +371,21 @@ Notes:
EOF
}
create_base_dirs
create_regular_files
create_named_variants
create_deep_and_duplicate_cases
create_time_and_readonly_cases
create_links
create_metadata_cases
write_summary
echo "Created migration test dataset at: $ROOT"
if (( UPDATE_ONLY )); then
log "Running in update-only mode for $ROOT"
update_mutable_files_pass
log "Completed initial update-only pass"
else
create_base_dirs
create_regular_files
create_named_variants
create_deep_and_duplicate_cases
create_time_and_readonly_cases
create_links
create_metadata_cases
write_summary
echo "Created migration test dataset at: $ROOT"
fi
if [[ -n "$UPDATE_INTERVAL" ]]; then
run_update_loop

View File

@@ -7,12 +7,14 @@ The generator script can also run in continuous update mode after initial creati
- omit the interval argument to create the dataset once and exit
- use `0` for continuous rewrites with no sleep between passes
- use any integer greater than `0` to rewrite mutable files every `N` seconds
- use `--update-only` to run updates against an already-existing dataset without recreating the special-case filesystem objects first
Important implementation detail for update mode:
- the update loop rewrites content-bearing regular files that are intended to simulate active data churn
- it does not rewrite script files, sparse files, symlinks, hard links, or empty files
- this preserves the special-case filesystem structure while still generating ongoing content changes
- if ACL/xattr assignment is unsupported on the target filesystem, the script logs that condition and continues
## Recommended Root Layout