Coder Social home page Coder Social logo

Comments (4)

fulmicoton avatar fulmicoton commented on July 28, 2024

Would this approach violate any internal implementation contracts of Tantivy, and is it feasible?

It will most likely not work yes.

The problem has to do with the delete and commit work.
Deletes are performed right before serialization.

The reason something like

 - add_doc(1)
 - delete_doc(1)
 - delete_doc(2)
 - add_doc(2)

work the way you expect, is because we attach an opstamp to each document and each delete operation, to know in which order those operations happened.

With your scheme, two concurrent writes could end up with very different outcomes.

 - add_doc(1)
 - add_doc(2)
 - delete_doc(1)
 - delete_doc(2)

You could end up with
no docs, doc1, doc2, doc1 and doc2 in the resulting tantivy index.

It will NOT look like the transaction were executed in the order of them taking the write lock.

from tantivy.

cyccbxhl avatar cyccbxhl commented on July 28, 2024

The problem has to do with the delete and commit work. Deletes are performed right before serialization.

Can you explain more about it?

Tantivy's commit would be called in pg's commit command, I actually don't need tantivy operations executed in the order of them taking the write lock, I need them meet the RC(Read Committed) transaction isolation level: Only committed operation/data is visible for other concurrent transaction.
The behavior I expect:
(1)
image
Because the doc1 and doc2 is invisible for delete ops in txn2, when txn1 and txn2 all committed, there are doc1 and doc2 in the resulting tantivy index;
(2)
image
when txn1 and txn2 all committed, there are no doc in the resulting tantivy index;

Can tantivy be able to do that?

from tantivy.

fulmicoton avatar fulmicoton commented on July 28, 2024

Actually I think you are right it might work.

from tantivy.

cyccbxhl avatar cyccbxhl commented on July 28, 2024

Thank you very much. I'll try implementing the code based on this plan first to see if there are any other issues. There might be some questions I will need to ask you later. I will close this issue for now.

from tantivy.

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.