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

Atomicity not guaranteed when using BulkWrite #588

Closed
fourjae opened this issue Jul 22, 2023 · 1 comment
Closed

Atomicity not guaranteed when using BulkWrite #588

fourjae opened this issue Jul 22, 2023 · 1 comment
Labels
question 💭 Further information is requested

Comments

@fourjae
Copy link
Contributor

fourjae commented Jul 22, 2023

Description:

Atomicity must be guaranteed when performing bulk updates using 'bulkwrite' in mongodb.

Why:

if _, err = c.collection(colChanges).BulkWrite(

There is no guarantee of atomicity when using bulkWrite.

Transactions are required when processing many operations. However, this causes performance problems.
Which method should I use?

references:

@hackerwins
Copy link
Member

@fourjae

Yorkie Server follows a specific approach when editing a Document.

It first stores all the changes that occur during document editing in the changes collection. Then it stores the last change to server_seq in the "documents" collection. This storage process does not execute queries into transactions, to reduce the load on the database.

Even if the storage process encounters failures, the server_seq stored in the documents collection remains unaffected. When other requests attempt to load changes or save further changes, they operate based on server_seq in the documents collection. If necessary, these requests may overwrite the changes.

@krapie krapie added the question 💭 Further information is requested label Jul 23, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question 💭 Further information is requested
Projects
None yet
Development

No branches or pull requests

3 participants