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

Bug: Can not update node properties: write-write conflict in Auto transaction. #4056

Closed
Claus1 opened this issue Aug 11, 2024 · 2 comments · Fixed by #4063
Closed

Bug: Can not update node properties: write-write conflict in Auto transaction. #4056

Claus1 opened this issue Aug 11, 2024 · 2 comments · Fixed by #4063
Assignees
Labels
bug Something isn't working

Comments

@Claus1
Copy link

Claus1 commented Aug 11, 2024

Kùzu version

0.5.0

What operating system are you using?

Ubuntu 22

What happened?

I send queries for updating a property when typing in UI from single-threaded python code:
MATCH (a: User) WHERE a.ID = 4 SET a.name = "something"
The first query executes ok, but all next queries raise Runtime exception: Write-write conflict of updating the same row.

Are there known steps to reproduce?

Update any node property more than once.

@Claus1 Claus1 added the bug Something isn't working label Aug 11, 2024
@prrao87
Copy link
Member

prrao87 commented Aug 11, 2024

I just tried this code in Python and yep, it seems to be happening if you try to update the node more than once (happens at the second occurrence).

@ray6080, could you take a look when possible?

import kuzu
import shutil

shutil.rmtree("test_db", ignore_errors=True)
db = kuzu.Database("test_db")
conn = kuzu.Connection(db)

# create a table
conn.execute("CREATE NODE TABLE IF NOT EXISTS Product (item STRING, price INT64, PRIMARY KEY (item))")

# insert some data
conn.execute("CREATE (n:Product {item: 'watch'}) SET n.price = 100")

# Check values
print(conn.execute("MATCH (n:Product) RETURN n.item, n.price").get_as_df())

# Match a node and update its values
conn.execute("MATCH (n:Product) WHERE n.item = 'watch' SET n.price = 200")

# Check values
print(conn.execute("MATCH (n:Product) RETURN n.item, n.price").get_as_df())

# Match a node and update its values
conn.execute("MATCH (n:Product) WHERE n.item = 'watch' SET n.price = 300")

# Check values
print(conn.execute("MATCH (n:Product) RETURN n.item, n.price").get_as_df())

Result:

  n.item  n.price
0  watch      100
  n.item  n.price
0  watch      200
Traceback (most recent call last):
  File "/Users/prrao/code/kuzu-debug/t.py", line 24, in <module>
    conn.execute("MATCH (n:Product) WHERE n.item = 'watch' SET n.price = 300")
  File "/Users/prrao/code/kuzu-debug/.venv/lib/python3.12/site-packages/kuzu/connection.py", line 130, in execute
    _query_result = self._connection.query(query)
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
RuntimeError: Runtime exception: Write-write conflict of updating the same row.

@ray6080 ray6080 self-assigned this Aug 11, 2024
@ray6080
Copy link
Contributor

ray6080 commented Aug 11, 2024

Will take a look soon! Thanks for reporting!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants