Skip to content
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

fix: EXPOSED-558 Entity cache for upsertReturning statements results in stale return values #2248

Conversation

rasharab
Copy link
Contributor

@rasharab rasharab commented Sep 22, 2024

Description

Summary of the change:
EntityLifecycleInterceptor.beforeExecution() now includes a branch to handle entity cache flushes for ReturnStatement.mainStatement.

Detailed description:

  • Why:

We were noticing weird issues where DAOs returned using upsertReturning had stale values.
We pinned it down to the EntityLifecycleInterceptor not correctly handling ReturningStatement upsertStatement cache evictions.
The test I’ve added validates this and will fail without my changes.


Type of Change

Please mark the relevant options with an "X":

  • Bug fix

Affected databases:

  • All

Checklist

  • Unit tests are in place
  • The build is green (including the Detekt check)

Related Issues

EXPOSED-558 ReturnStatements don't trigger entity cache flush before execution

ItemDAO.wrapRow(it.single())
}
assertEquals(1, result2.id.value)
assertEquals("B", result2.name)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Before my fix, this would fail.

@rasharab rasharab changed the title [BUG FIX] Fix entity cache for returning statements [BUG FIX] Fix entity cache for upsertReturning statements results in stale values Sep 22, 2024
@rasharab rasharab changed the title [BUG FIX] Fix entity cache for upsertReturning statements results in stale values [BUG FIX] Fix entity cache for upsertReturning statements results in stale return values Sep 22, 2024
We were noticing weird issues where DAOs returned using upsertReturning had stale values.
We pinned it down to the EntityLifecycleInterceptor not correctly handling ReturningStatement upsertStatement cache evictions.

The test I’ve added validates this and will fail without my changes.
@rasharab rasharab force-pushed the FixEntityCacheForReturningStatements branch from f0b8f73 to 32214ac Compare September 22, 2024 06:54
@bog-walk bog-walk changed the title [BUG FIX] Fix entity cache for upsertReturning statements results in stale return values fix: EXPOSED-558 Entity cache for upsertReturning statements results in stale return values Sep 23, 2024
@bog-walk bog-walk self-assigned this Sep 23, 2024
Copy link
Member

@bog-walk bog-walk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks very much for the fix @rasharab and for including a test.

@bog-walk bog-walk merged commit 420fe6f into JetBrains:main Sep 23, 2024
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants