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

write conflicts not detected because of dirty tracking and race condition #146

Closed
langalex opened this issue Oct 20, 2021 · 0 comments
Closed
Labels

Comments

@langalex
Copy link
Owner

  • one process loads a document
  • another process loads the same document
  • the first process changes and saves the doc
  • the 2nd process makes a change that leads to dirty tracking not detecting a change
  • the 2nd process does not actyually save the doc and hence detects no write conflict

process 1:

d = db.load '1'
d.some_value # 'bar'
db.save d do |dd|
  dd.some_value = 'foo'
end

process 2:

d = db.load '1'
d.some_value # 'bar'
db.save d do |dd| # does not save because d.some_value == 'bar', even though by now d.some_value == 'foo'
  dd.some_value = 'bar'
end
@langalex langalex added the bug label Oct 20, 2021
langalex added a commit that referenced this issue Nov 8, 2021
fix #146

the problem:

* one process loads a document 
* another process loads the same document
* the first process changes and saves the doc
* the 2nd process makes a change that leads to dirty tracking not detecting a change
* the 2nd process does not actually save the doc and hence detects no write conflict

process 1:
```ruby
d = db.load '1'
d.some_value # 'bar'
db.save d do |dd|
  dd.some_value = 'foo'
end
```

process 2:
```ruby
d = db.load '1'
d.some_value # 'bar'
db.save d do |dd| # does not save because d.some_value == 'bar', even though by now d.some_value == 'foo'
  dd.some_value = 'bar'
end
```
@langalex langalex closed this as completed Apr 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant