fix(p6-stop): init -m scan_stopped_early; gate delete warning; stabilize partial-stop test

This commit is contained in:
2026-09-10 18:16:35 +02:00
parent ac7e9e3bc1
commit 09a07179c9
3 changed files with 14 additions and 7 deletions
+12 -6
View File
@@ -1456,9 +1456,12 @@ static int send_chunks_multithreaded(void* pipeline_context) {
context->scan_stopped_early = context->scan_stopped_early =
context->scan_stopped_early || stop_condition_reached(&context->stop_condition); context->scan_stopped_early || stop_condition_reached(&context->stop_condition);
if (context->scan_stopped_early) { if (context->scan_stopped_early) {
log_message(LOG_LEVEL_WARNING, if (context->config->use_delete || context->config->delete_missing_args)
"transfer stopped early (stop deadline); skipping --delete keep-set so " log_message(LOG_LEVEL_WARNING,
"unscanned source mirrors are not deleted"); "transfer stopped early (stop deadline); skipping --delete keep-set so "
"unscanned source mirrors are not deleted");
else
log_message(LOG_LEVEL_WARNING, "transfer stopped early (stop deadline)");
} else if (context->config->use_delete && !context->early_delete) { } else if (context->config->use_delete && !context->early_delete) {
/* Empty keep-set + scan I/O error must not delete the whole destination /* Empty keep-set + scan I/O error must not delete the whole destination
(the source may not be genuinely empty -- see send_files). */ (the source may not be genuinely empty -- see send_files). */
@@ -1911,9 +1914,12 @@ int send_files(Config* config) {
loss), so the late delete manifest is suppressed below. */ loss), so the late delete manifest is suppressed below. */
scan_stopped_early = scan_stopped_early || stop_condition_reached(&stop); scan_stopped_early = scan_stopped_early || stop_condition_reached(&stop);
if (scan_stopped_early) { if (scan_stopped_early) {
log_message(LOG_LEVEL_WARNING, if (config->use_delete || config->delete_missing_args)
"transfer stopped early (stop deadline); skipping --delete keep-set so " log_message(LOG_LEVEL_WARNING,
"unscanned source mirrors are not deleted"); "transfer stopped early (stop deadline); skipping --delete keep-set so "
"unscanned source mirrors are not deleted");
else
log_message(LOG_LEVEL_WARNING, "transfer stopped early (stop deadline)");
} else { } else {
if (had_scan_io && manifest && manifest->size == 0) { if (had_scan_io && manifest && manifest->size == 0) {
/* A scan that hit an I/O error and produced no keep entries is ambiguous; /* A scan that hit an I/O error and produced no keep entries is ambiguous;
+1
View File
@@ -31,6 +31,7 @@ PipelineContextSender* pipeline_context_sender_create(Config* config, Queue* que
context->scan_had_io_error = false; context->scan_had_io_error = false;
context->remove_source_files = NULL; context->remove_source_files = NULL;
context->early_delete = false; context->early_delete = false;
context->scan_stopped_early = false;
context->total_files = 0; context->total_files = 0;
context->progress_bytes = 0; context->progress_bytes = 0;
context->total_bytes = 0; context->total_bytes = 0;
+1 -1
View File
@@ -172,7 +172,7 @@ class TestStopPartial:
run returns 0 without corrupting any file.""" run returns 0 without corrupting any file."""
source, dest = _make("partial") source, dest = _make("partial")
_seed_many(source, count=60, size=32 * 1024) _seed_many(source, count=60, size=32 * 1024)
flags = ["--chunk-size", "262144", "--bwlimit", "300", "--stop-at=now+3s"] flags = ["--chunk-size", "262144", "--bwlimit", "100", "--stop-at=now+3s"]
result, _ = run_client(source, dest, flags=flags, port=shared_server.port) result, _ = run_client(source, dest, flags=flags, port=shared_server.port)
assert result.returncode == 0, \ assert result.returncode == 0, \
f"mid-transfer stop failed (rc {result.returncode}): " \ f"mid-transfer stop failed (rc {result.returncode}): " \