fix: keep prewrite-cancelled CBBs available for fresh admission

This commit is contained in:
阿白叔 committed 2026-11-23 19:34:25 +08:00
1 parent 48f38d1bdd
commit 3b4323405a
3 files changed
+46 -5

No files matched your search

+8 -4
View File
@@ -1951,7 +1951,11 @@ class MainWindow(QWidget):
write_maintenance_report(requests, results, report, ())
except Exception as error:
self._emit_job(job, 'event', {'stage': 'report_failed', 'detail': str(error)})
affected = [req.block_name for req, result in zip(requests, results) if result.status != 'SKIPPED']
# A proven pre-write cancel can be submitted again. The next
# admission still rereads the catalog, status and occupancy.
affected = [req.block_name for req, result in zip(requests, results)
if result.status != 'SKIPPED'
and not (result.status == 'CANCELLED' and result.cancelled_before_write)]
safe = all(result.safe_to_continue for result in results)
self._emit_job(job, 'batch_ready', (results, report))
refresh = None
@@ -2202,12 +2206,12 @@ class MainWindow(QWidget):
if len(outcome) <= 2:
return
results, _, affected, refresh = outcome
if refresh is None:
if refresh is not None:
self._apply_refreshed_records(refresh)
elif affected:
reason = ('状态尚未复核,请重新读取。' if all(r.safe_to_continue for r in results)
else '会话或数据库安全未确认;暂缓原生状态复核,请确认释放后重新读取。')
self._defer_status_refresh(affected, reason)
else:
self._apply_refreshed_records(refresh)
from shiboken6 import isValid
summary = getattr(self, 'summary', None)
self.status_label.setText(summary.text().replace('\n', ' ') if summary is not None and isValid(summary)
+4 -1
View File
@@ -108,6 +108,7 @@ class VerifyResult:
release_proof: dict | None = None
write_outcome: dict | None = None
session_record_path: Path | None = None
cancelled_before_write: bool = False
def resolve_importer(mentor_bin: str | None = None) -> Path:
@@ -1153,8 +1154,10 @@ def _run_verify(request, *, timing, progress=None, flag_reader=None, process_run
from .failed_session import cancelled_prewrite_startup
_stop_worker(process, wait_for_native_write=False if request.diagnostic_only else
lambda:cancelled_prewrite_startup(job,target_pid) is None)
prewrite = cancelled_prewrite_startup(job, target_pid) is not None
return finish(VerifyResult('CANCELLED', stderr='已取消当前校验。',
safe_to_continue=False, error_stage=phase.value))
safe_to_continue=False, error_stage=phase.value,
cancelled_before_write=prewrite))
if events.exists():
with events.open(encoding='utf-8') as stream:
stream.seek(offset)