Skip to content

Commit

Permalink
deal with deadlocks while fetching contracts in json-api Oracle (#11391)
Browse files Browse the repository at this point in the history
* clean up some imports

* test case trying to find deadlock situation

* add deadlocks to causes of ContractsFetch retry for Oracle

* Revert "test case trying to find deadlock situation"

This reverts commit 9b19046.

* no changelog

CHANGELOG_BEGIN
CHANGELOG_END
  • Loading branch information
S11001001 authored Oct 26, 2021
1 parent 8212c0b commit d87d3d4
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -187,11 +187,10 @@ abstract class AbstractDatabaseIntegrationTest extends AsyncFreeSpecLike with Be
}.unsafeToFuture()

"SurrogateTemplateIdCache" - {
import dao.logHandler, dao.jdbcDriver.q.queries

"should be used on template insertion and reads" in {
import dao.jdbcDriver.q.queries
def getOrElseInsertTemplate(tpid: TemplateId[String])(implicit
logHandler: LogHandler = dao.logHandler
) = instanceUUIDLogCtx(implicit lc =>
def getOrElseInsertTemplate(tpid: TemplateId[String]) = instanceUUIDLogCtx(implicit lc =>
dao.transact(
queries
.surrogateTemplateId(tpid.packageId, tpid.moduleName, tpid.entityName)
Expand All @@ -212,7 +211,6 @@ abstract class AbstractDatabaseIntegrationTest extends AsyncFreeSpecLike with Be
"doesn't cache uncommitted template IDs" in {
import dbbackend.Queries.DBContract, spray.json.{JsObject, JsNull, JsValue},
spray.json.DefaultJsonProtocol._
import dao.logHandler, dao.jdbcDriver.q.queries

val tpId = TemplateId("pkg", "mod", "UncomCollision")

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,10 @@ object SupportedJdbcDriver {
// all oracle class 23 errors yield 23000; if we want to check for *unique*
// violation specifically we'll have to look at something other than the SQLState.
// All other class 23 errors indicate a bug, which should exhaust the retry loop anyway
retrySqlStates = Set("23000", ContractDao.StaleOffsetException.SqlState),
// likewise, class 61 covers a swath of errors for which one transaction was aborted
// in favor of continuing another [conflicting] transaction, for which retrying
// seems appropriate as well
retrySqlStates = Set("23000", "61000", ContractDao.StaleOffsetException.SqlState),
)
}
}

0 comments on commit d87d3d4

Please sign in to comment.