-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
CORE-362: new DataSource.inTransaction signatures #3260
Conversation
@@ -170,7 +170,7 @@ class BucketMigrationServiceImpl(val dataSource: SlickDataSource, val samDAO: Sa | |||
// get migration progress if it exists | |||
workspacesWithProgressOpt <- workspaces.traverse { workspace => | |||
dataSource | |||
.inTransaction(getBucketMigrationProgress(workspace)) | |||
.inTransaction(dataAccess => getBucketMigrationProgress(workspace)(dataAccess)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the previously-working function currying here needs to be explicit with the new inTransaction
signatures.
…institute/rawls into da_CORE-362_inTransactionSignature
@@ -69,7 +70,7 @@ class CoordinatedDataSourceActorSpec | |||
val mockSlickDataSource = mock[SlickDataSource](RETURNS_SMART_NULLS) | |||
val mockDataAccessFunction = mock[DataAccess => ReadWriteAction[Any]](RETURNS_SMART_NULLS) | |||
val transactionIsolation = TransactionIsolation.RepeatableRead | |||
when(mockSlickDataSource.inTransaction(mockDataAccessFunction, transactionIsolation)) | |||
when(mockSlickDataSource.inTransaction(argeq(mockDataAccessFunction), argeq(transactionIsolation), any())) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
new signatures need updated mocks
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice prefactor!
def batchUpdateEntities(entityUpdates: Seq[EntityUpdateDefinition], parentContext: RawlsRequestContext): Future[Traversable[Entity]] | ||
def batchUpdateEntities(entityUpdates: Seq[EntityUpdateDefinition], | ||
parentContext: RawlsRequestContext | ||
): Future[Traversable[Entity]] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not sure why this PR has so much reformatting; this happened after rebasing #3249 into here.
* @tparam T type returned by the query | ||
* @return query results | ||
*/ | ||
// the `null` default for concurrency is ugly. However, it is the value specified by |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you could wrap it in an Option
Ticket: CORE-362
Some prefactoring for the main changes in CORE-362.
This PR adds new, hopefully more readable, signatures for the
DataSource.inTransaction
method. This includes a new ability to specify the result set concurrency:ReadOnly
vs.Updatable
. See https://dev.mysql.com/doc/refman/8.4/en/innodb-performance-ro-txn.html for more info on theReadOnly
hint.See
EntityStatisticsCacheMonitor
andLocalEntityProvider
for example changes of how these new signatures look. The TL;DR is it changes the code fromdataSource.inTransaction{ … many lines of code … }, ReadCommitted
to
dataSource.inTransaction(ReadCommitted){ … many lines of code … }