Skip to content

Conversation

vincent-pochet
Copy link
Collaborator

This PR removes the legacy organizations.clickhouse_aggregation column, that is not used anymore.

This PR is a new attempt to approach the issue of parallel wallet
refresh refresh in the case of in payed in advance events.

The PR moves fro pessimistic locking (`FOR UPDATE NOWAIT`) to an
optimistic one using the `lock_version` already present on the wallets
table.
An automatic retry logic is added around the wallet decrease logic with
a random wait time between each attempt. It reduce the effect of the
error to the decrease logic only instead of the all event processing
like it is today.
Finally in case of error, the error is re-raised and the entire logic
will be retried by Sidekiq
@vincent-pochet vincent-pochet changed the title fix(wallet): Optimistic locking for in advance events (#3720) misc(organization): Remove legacy clickhouse_aggregation column (#3720) May 26, 2025
@vincent-pochet vincent-pochet merged commit d6dc9e7 into main May 26, 2025
14 checks passed
@vincent-pochet vincent-pochet deleted the misc-drop-clickhouse-aggregation-organization branch May 26, 2025 16:04
vincent-pochet added a commit that referenced this pull request May 27, 2025
## Description

This PR follows #3722.

The `clickhouse_aggregation` was recently removed from the organization
table.
Because the deploy of this change lead to a lot of issues as we are
relying on `ApplicationRecord#ignored_columns` to avoid
`ActiveRecord::PreparedStatementCacheExpired`, this PR mark the removed
column as ignored_columns to reduce the risk of error.

For future columns removal, this approach will be done before pushing
the migration.
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.

3 participants