Skip to content

cache: Disable Index Checking on Populate #186

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

Merged
merged 1 commit into from
Jul 8, 2021

Conversation

dave-tucker
Copy link
Collaborator

The ordering of the updates from the table-update notification is
undefined. It's a hard problem to sort the update in such a way each
operation would be processed in order to ensure no indexes collided.
We can instead take the easy way out and ignore index checking
altogether as we assume the server has already take care of this.
THe cache is locked during update, so the client doesn't need to worry
about the indexes being inconsistent during the populate.

Signed-off-by: Dave Tucker [email protected]

@dave-tucker dave-tucker added the fix label Jul 7, 2021
@dave-tucker dave-tucker requested a review from amorenoz July 7, 2021 13:28
@coveralls
Copy link

coveralls commented Jul 7, 2021

Pull Request Test Coverage Report for Build 1012426259

  • 10 of 11 (90.91%) changed or added relevant lines in 2 files are covered.
  • 1 unchanged line in 1 file lost coverage.
  • Overall coverage increased (+0.5%) to 77.203%

Changes Missing Coverage Covered Lines Changed/Added Lines %
server/database.go 2 3 66.67%
Files with Coverage Reduction New Missed Lines %
cache/cache.go 1 84.17%
Totals Coverage Status
Change from base Build 1012423514: 0.5%
Covered Lines: 3180
Relevant Lines: 4119

💛 - Coveralls

@jcaamano
Copy link
Collaborator

jcaamano commented Jul 7, 2021

/lgtm

Wondering if doing two passes, handling deletes first, would have been a viable alternative.

@dave-tucker
Copy link
Collaborator Author

dave-tucker commented Jul 7, 2021

Wondering if doing two passes, handling deletes first, would have been a viable alternative.

I thought about that, but seeing as update is called in response to every db transaction we want to process as fast as possible so cache updates propagate quickly and we don't hold the lock the cache for too long. Doing a sort.Sort(ByOperation) would be expensive as would doing two iterations.

Skipping the index check should be safe as the indexes were already checked on the server side anyway.

The ordering of the updates from the table-update notification is
undefined. It's a hard problem to sort the update in such a way each
operation would be processed in order to ensure no indexes collided.
We can instead take the easy way out and ignore index checking
altogether as we assume the server has already take care of this.
THe cache is locked during update, so the client doesn't need to worry
about the indexes being inconsistent during the populate.

Signed-off-by: Dave Tucker <[email protected]>
@dave-tucker dave-tucker merged commit d17ab7f into ovn-kubernetes:main Jul 8, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants