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:
@@ -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
|
- omit it to create the dataset once and exit
|
||||||
- use `0` for continuous random content updates
|
- use `0` for continuous random content updates
|
||||||
- use any integer greater than `0` to rewrite mutable files every `N` seconds
|
- 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:
|
- If ACL/xattr coverage matters, ensure the generation host has:
|
||||||
- `acl` installed for `setfacl` and `getfacl`
|
- `acl` installed for `setfacl` and `getfacl`
|
||||||
- `attr` installed for `setfattr` and `getfattr`
|
- `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 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.
|
- 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.
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ set -euo pipefail
|
|||||||
usage() {
|
usage() {
|
||||||
cat <<'EOF'
|
cat <<'EOF'
|
||||||
Usage:
|
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.
|
Creates a compact filesystem migration test dataset under TARGET_DIR.
|
||||||
The dataset matches the manifest in migration-test-manifest.md.
|
The dataset matches the manifest in migration-test-manifest.md.
|
||||||
@@ -23,6 +23,12 @@ Notes:
|
|||||||
EOF
|
EOF
|
||||||
}
|
}
|
||||||
|
|
||||||
|
UPDATE_ONLY=0
|
||||||
|
if [[ ${1:-} == "--update-only" ]]; then
|
||||||
|
UPDATE_ONLY=1
|
||||||
|
shift
|
||||||
|
fi
|
||||||
|
|
||||||
if [[ $# -lt 1 || $# -gt 2 ]]; then
|
if [[ $# -lt 1 || $# -gt 2 ]]; then
|
||||||
usage
|
usage
|
||||||
exit 1
|
exit 1
|
||||||
@@ -132,17 +138,25 @@ apply_mode() {
|
|||||||
|
|
||||||
set_acl_and_xattr_metadata() {
|
set_acl_and_xattr_metadata() {
|
||||||
if (( have_setfattr )); then
|
if (( have_setfattr )); then
|
||||||
setfattr -n user.migration_case -v "xattr-text" "$ROOT/metadata/xattr_text_1mb_644.txt"
|
if ! setfattr -n user.migration_case -v "xattr-text" "$ROOT/metadata/xattr_text_1mb_644.txt"; then
|
||||||
setfattr -n user.migration_case -v "xattr-random" "$ROOT/metadata/xattr_random_3mb_600.bin"
|
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
|
else
|
||||||
echo "Skipping xattr assignment: setfattr not available"
|
log "Skipping xattr assignment: setfattr not available"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if (( have_setfacl )); then
|
if (( have_setfacl )); then
|
||||||
setfacl -m u:nobody:r-- "$ROOT/metadata/acl_text_1mb_644.txt"
|
if ! setfacl -m u:nobody:r-- "$ROOT/metadata/acl_text_1mb_644.txt"; then
|
||||||
setfacl -m u:nobody:r-x "$ROOT/metadata/acl_script_1mb_755.sh"
|
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
|
else
|
||||||
echo "Skipping ACL assignment: setfacl not available"
|
log "Skipping ACL assignment: setfacl not available"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -357,16 +371,21 @@ Notes:
|
|||||||
EOF
|
EOF
|
||||||
}
|
}
|
||||||
|
|
||||||
create_base_dirs
|
if (( UPDATE_ONLY )); then
|
||||||
create_regular_files
|
log "Running in update-only mode for $ROOT"
|
||||||
create_named_variants
|
update_mutable_files_pass
|
||||||
create_deep_and_duplicate_cases
|
log "Completed initial update-only pass"
|
||||||
create_time_and_readonly_cases
|
else
|
||||||
create_links
|
create_base_dirs
|
||||||
create_metadata_cases
|
create_regular_files
|
||||||
write_summary
|
create_named_variants
|
||||||
|
create_deep_and_duplicate_cases
|
||||||
echo "Created migration test dataset at: $ROOT"
|
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
|
if [[ -n "$UPDATE_INTERVAL" ]]; then
|
||||||
run_update_loop
|
run_update_loop
|
||||||
|
|||||||
@@ -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
|
- omit the interval argument to create the dataset once and exit
|
||||||
- use `0` for continuous rewrites with no sleep between passes
|
- use `0` for continuous rewrites with no sleep between passes
|
||||||
- use any integer greater than `0` to rewrite mutable files every `N` seconds
|
- 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:
|
Important implementation detail for update mode:
|
||||||
|
|
||||||
- the update loop rewrites content-bearing regular files that are intended to simulate active data churn
|
- 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
|
- 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
|
- 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
|
## Recommended Root Layout
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user