Skip to content

Commit

Permalink
Readonly transaction created by BackupUtil is not being cancelled by …
Browse files Browse the repository at this point in the history
…stuck transaction monitor
  • Loading branch information
leostryuk authored and andrii0lomakin committed Oct 24, 2023
1 parent f7ac0d3 commit 53b064b
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -372,6 +372,17 @@ public TransactionBase beginReadonlyTransaction(final Runnable beginHook) {
return new ReadonlyTransaction(this, false, beginHook);
}

@NotNull
public TransactionBase beginReadOnlyUnmonitoredTransaction(){
checkIsOperative();
return new ReadonlyTransaction(this, false, null) {
@Override
boolean isIgnoreInStuckTransactionMonitor() {
return true;
}
};
}

@NotNull
public ReadWriteTransaction beginGCTransaction() {
if (isReadOnly()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,10 @@ boolean isGCTransaction() {
return false;
}

boolean isIgnoreInStuckTransactionMonitor(){
return false;
}

@Nullable
TreeMetaInfo getTreeMetaInfo(@NotNull final String name) {
checkIsFinished();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ internal class StuckTransactionMonitor(env: EnvironmentImpl) : Job() {
val timeBound = System.currentTimeMillis() - this
env?.forEachActiveTransaction {
val txn = it as TransactionBase
if (!txn.isGCTransaction && txn.startTime < timeBound) {
if (!txn.isGCTransaction && !txn.isIgnoreInStuckTransactionMonitor && txn.startTime < timeBound) {
callback(it)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ class BackupController(private val env: EnvironmentImpl) : MBeanBase(getObjectNa
throw IllegalStateException("Backup is already in progress")
}

backupTransaction = env.beginReadonlyTransaction()
backupTransaction = env.beginReadOnlyUnmonitoredTransaction()
return env.prepareForBackup()
} finally {
backupTransactionLock.unlock()
Expand Down

0 comments on commit 53b064b

Please sign in to comment.