Skip to content

Commit a6610f4

Browse files
committed
[bugfix] Add missing Undo progress bar for Journal Recovery
1 parent e23d7f8 commit a6610f4

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

exist-core/src/main/java/org/exist/storage/recovery/RecoveryManager.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -301,6 +301,8 @@ private void doRecovery(final int txnCount, final Path last, final JournalReader
301301
if (runningTxns.size() > 0) {
302302
// do a reverse scan of the log, undoing all uncommitted transactions
303303
try {
304+
final long lastSize = FileUtils.sizeQuietly(last);
305+
final ProgressBar undoProgressBar = new ProgressBar("Undo ", lastSize);
304306
while((next = reader.previousEntry()) != null) {
305307
if (next.getLogType() == LogEntryTypes.TXN_START) {
306308
if (runningTxns.get(next.getTransactionId()) != null) {
@@ -321,7 +323,10 @@ private void doRecovery(final int txnCount, final Path last, final JournalReader
321323
// LOG.debug("Undo: " + next.dump());
322324
next.undo();
323325
}
326+
327+
undoProgressBar.set(lastSize - next.getLsn().getOffset());
324328
}
329+
undoProgressBar.set(lastSize); // 100% done
325330
} catch (final Exception e) {
326331
LOG.warn("Exception caught while undoing dirty transactions. Remaining transactions to be undone: {}. Aborting recovery to avoid possible damage. Before starting again, make sure to run a check via the emergency export tool.", runningTxns.size(), e);
327332
if (next != null)

0 commit comments

Comments
 (0)