Git Product home page Git Product logo

Comments (3)

simolus3 avatar simolus3 commented on June 26, 2024 1

No you're right! I've misremembered things and thought QueryExecutor was a public and stable interface. It's explicitly marked as internal in the documentation though, so I feel comfortable adding a beginExclusive method there and implementing it in the BaseExecutor (well, and in the remote isolate implementation and so on). I haven't completed this yet, but it doesn't look like a breaking change outside of minor concerns for web workers (beginExclusive will only work with newer workers due to a backwards-compatible change to the RPC protocol, that is not a problem though).

from drift.

simolus3 avatar simolus3 commented on June 26, 2024

I think you'd still have the problem with sequential databases because they only serialize database access at a fairly low layer.

So if you do something like this Dart:

await customStatement('pragma foreign_keys = OFF;');
await transaction(() async {
  // ...
});
await customStatement('pragma foreign_keys = ON;');

If another async context is accessing the database and does its own thing, queries from there could be interleaved between the customStatement and transaction block, even with isSequential: true.

I agree that having a block that reliably locks the database is a good addition. It should ideally be implemented at a QueryExecutor level though (doing it in the database class is not reliable since this also needs to work across isolates, so there could be multiple database classes talking to the same logical database). Doing that there is a breaking change though...

from drift.

davidmartos96 avatar davidmartos96 commented on June 26, 2024

@simolus3 I was thinking at the BaseExecutor level, which already manages its own lock. Is that the database low level you were referring to or the QueryExecutor level?

If the additional method is added to the QueryExecutor and to the DatabaseConnectionUser classes, what is the breaking change? Is it because subclasses need to implement it?

from drift.

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.