Giter Club home page Giter Club logo

Comments (4)

sapalli2989 avatar sapalli2989 commented on September 25, 2024 1

We should prevent concurrent read and write access to the same kuzu database from different processes, as there is no guarantee we can provide to make sure that read and write transactions from different processes are consistent.

To clarify and make sure I got this correctly: It is expected behavior that access from multiple (ro+rw) Database objects/instances to one database directory on filesystem within the same process is not possible either (see #2934). Here is a shorter version:

import tempfile
import kuzu

with tempfile.TemporaryDirectory() as d:
    conn_rw = kuzu.Connection(kuzu.Database(d))
    conn_ro = kuzu.Connection(kuzu.Database(d, read_only=True))

    conn_rw.execute("CREATE NODE TABLE V(id STRING,PRIMARY KEY(id));")
    conn_rw.execute("CREATE (v:V {id: 'foo'}) RETURN v;")

    print((conn_rw.execute("MATCH (v:V {id: 'foo'}) RETURN v;").get_next()[0]))
    # {'_id': {'offset': 0, 'table': 0}, '_label': 'V', 'id': 'foo'}

    print((conn_ro.execute("MATCH (v:V {id: 'foo'}) RETURN v;").get_next()[0]))
    # RuntimeError: Binder exception: Table V does not exist.

I think it makes sense to provide an appropriate error here as well.

from kuzu.

ray6080 avatar ray6080 commented on September 25, 2024 1

hi @sapalli2989 , yes. you're right. and we should error on this too. also related to #3292.

from kuzu.

hououou avatar hououou commented on September 25, 2024

We usefcntl to ensure the access mode to databases.
fcntl can not add any other locks while already holding an exclusive write lock.

An exclusive or write lock gives a process exclusive access for writing to the specified part of the file. While a write lock is in place, no other process can lock that part of the file.

from kuzu.

ray6080 avatar ray6080 commented on September 25, 2024

This should be expected. The way to share the same Kuzu database among multiple processes is to open the database under READ ONLY mode.

We should prevent concurrent read and write access to the same kuzu database from different processes, as there is no guarantee we can provide to make sure that read and write transactions from different processes are consistent. So I would suggest we don't change this behaviour. but we should document this more clearly in our docs for sure.

from kuzu.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.