dapr / dapr/dotnet-sdk

Optimistic Concurrency does not work well with PostgreSQL state

Open
#1,074 1 comment 0 reactions 0 assignees View on GitHub
kind/bug
Dominant language
C#
Stars
1.2k
Forks
378
Avg merge
2d 1h
Merged PRs (30d)
6

Description

## Expected Behavior

When I save state with etag value, which is obsolete, I would expect to return false as a result.

## Actual Behavior

Following exception is thrown:

``` json
{
"errorCode": "ERR_STATE_SAVE",
"message": "failed saving state in state store ...: no item was updated"
}
```

Dapr version: 1.10.0

## Steps to Reproduce the Problem

1. Prepare environment with PostgreSQL DB instance.
2. Save some value into the state.
3. Get this state and retrieve etag from headers.
4. Save again but with etag, which is different than the last one.

Screenshots from tests:
GET:
![image](https://user-images.githubusercontent.com/17142439/232207918-acd29f3f-34cb-4970-8a7a-167dd63dd3dd.png)

POST:
![image](https://user-images.githubusercontent.com/17142439/232207896-f5f7522c-daf9-483a-8b4f-c4c6ffae9a83.png)

State store configuration:
``` yaml
apiVersion: dapr.io/v1alpha1
kind: Component
metadata:
name: pa******re
spec:
type: state.postgresql
version: v1
metadata:
- name: connectionString
value: "h****o"
scopes:
- p****d

```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.