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

lock cache row to prevent concurrent updates #1173

Merged
merged 2 commits into from
Sep 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions grid-proxy/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,15 @@ Check `/version` on any instance to know the version.

### 3.13

---
## Releases

- include releases from v0.13.5 to v0.14.11
### v0.15.12

## Releases
---

- `fix` serialization_failure due to concurrent update
- `feat` include gpu cards in the node response
- `feat` use proper level logging

### v0.15.11

Expand Down
2 changes: 1 addition & 1 deletion grid-proxy/charts/gridproxy/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,6 @@ version: 1.0.0
# This is the version number of the application being deployed. This version number should be
# incremented each time you make changes to the application. Versions are not expected to
# follow Semantic Versioning. They should reflect the version the application is using.
appVersion: 0.15.11
appVersion: 0.15.12

# make sure to update the changelog with the changes in this release
8 changes: 7 additions & 1 deletion grid-proxy/internal/explorer/db/setup.sql
Original file line number Diff line number Diff line change
Expand Up @@ -408,6 +408,12 @@ $$
BEGIN
IF (TG_OP = 'UPDATE' AND NEW.state = 'Deleted') THEN
BEGIN
-- lock cache row to prevent concurrent updates
PERFORM 1
FROM resources_cache
WHERE node_id = NEW.node_id
FOR UPDATE;

UPDATE resources_cache
SET
used_cru = resources_cache.used_cru - contract_resources.cru,
Expand Down Expand Up @@ -621,7 +627,7 @@ BEGIN

total_ips = total_ips + (
CASE
WHEN TG_OP = 'INSERT'
WHEN TG_OP = 'INSERT'
THEN 1
WHEn TG_OP = 'DELETE'
THEN -1
Expand Down
Loading