mirror of
https://github.com/corda/corda.git
synced 2025-06-01 15:10:54 +00:00
[CORDA-2807] Don't retry db transaction in AbstactNode start (#4942)
Retries can lead to confusing error messages in case the CFT notary is misconfigured and throws a SQLException causing a retry.
This commit is contained in:
parent
d9e11b21ae
commit
dc46446432
@ -227,6 +227,15 @@ class CordaPersistence(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Executes given statement in the scope of transaction with the transaction level specified at the creation time.
|
||||||
|
* @param statement to be executed in the scope of this transaction.
|
||||||
|
* @param recoverableFailureTolerance number of transaction commit retries for SQL while SQL exception is encountered.
|
||||||
|
*/
|
||||||
|
fun <T> transaction(recoverableFailureTolerance: Int, statement: DatabaseTransaction.() -> T): T {
|
||||||
|
return transaction(defaultIsolationLevel, recoverableFailureTolerance, false, statement)
|
||||||
|
}
|
||||||
|
|
||||||
private fun <T> inTopLevelTransaction(isolationLevel: TransactionIsolationLevel, recoverableFailureTolerance: Int,
|
private fun <T> inTopLevelTransaction(isolationLevel: TransactionIsolationLevel, recoverableFailureTolerance: Int,
|
||||||
recoverAnyNestedSQLException: Boolean, statement: DatabaseTransaction.() -> T): T {
|
recoverAnyNestedSQLException: Boolean, statement: DatabaseTransaction.() -> T): T {
|
||||||
var recoverableFailureCount = 0
|
var recoverableFailureCount = 0
|
||||||
|
@ -368,7 +368,7 @@ abstract class AbstractNode<S>(val configuration: NodeConfiguration,
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Do all of this in a database transaction so anything that might need a connection has one.
|
// Do all of this in a database transaction so anything that might need a connection has one.
|
||||||
return database.transaction {
|
return database.transaction(recoverableFailureTolerance = 0) {
|
||||||
networkParametersStorage.setCurrentParameters(signedNetParams, trustRoot)
|
networkParametersStorage.setCurrentParameters(signedNetParams, trustRoot)
|
||||||
identityService.loadIdentities(nodeInfo.legalIdentitiesAndCerts)
|
identityService.loadIdentities(nodeInfo.legalIdentitiesAndCerts)
|
||||||
attachments.start()
|
attachments.start()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user