What happens
RestoreTask.runTask() guards the restore with if (verifyOnly || lockBackend(backend)) and has no else branch (
|
if (verifyOnly || lockBackend(backend)) |
). When
lockBackend() returns false — the backend lock file is held by another process or cannot be created — the whole restore block is skipped,
errorsEncountered stays
false, the
finally re-enables the backend and notifies the restore task listeners with
successful == true, and the task returns
getFinalTaskState(), i.e.
COMPLETED_SUCCESSFULLY.
The only trace is the ERR_RESTOREDB_CANNOT_LOCK_BACKEND line lockBackend() logs. The task entry, manage-tasks, the restore CLI exit code and every RestoreTaskListener all see a successful restore that never touched the backend.
Expected
The task should end in STOPPED_BY_ERROR (or at least COMPLETED_WITH_ERRORS) and the listeners should be told successful == false, as they are when restoreBackup() itself fails.
Fix
An else { errorsEncountered = true; } on that if, or a plain early return mirroring ImportTask's lock-failure path (ImportTask.java:658-662), which returns STOPPED_BY_ERROR.
Pre-existing, unchanged by #969; found while reviewing it.
What happens
RestoreTask.runTask()guards the restore withif (verifyOnly || lockBackend(backend))and has noelsebranch (OpenDJ/opendj-server-legacy/src/main/java/org/opends/server/tasks/RestoreTask.java
Line 293 in 7850557
lockBackend()returns false — the backend lock file is held by another process or cannot be created — the whole restore block is skipped,errorsEncounteredstaysfalse, thefinallyre-enables the backend and notifies the restore task listeners withsuccessful == true, and the task returnsgetFinalTaskState(), i.e.COMPLETED_SUCCESSFULLY.The only trace is the
ERR_RESTOREDB_CANNOT_LOCK_BACKENDlinelockBackend()logs. The task entry,manage-tasks, therestoreCLI exit code and everyRestoreTaskListenerall see a successful restore that never touched the backend.Expected
The task should end in
STOPPED_BY_ERROR(or at leastCOMPLETED_WITH_ERRORS) and the listeners should be toldsuccessful == false, as they are whenrestoreBackup()itself fails.Fix
An
else { errorsEncountered = true; }on thatif, or a plain early return mirroringImportTask's lock-failure path (ImportTask.java:658-662), which returnsSTOPPED_BY_ERROR.Pre-existing, unchanged by #969; found while reviewing it.