-
Notifications
You must be signed in to change notification settings - Fork 616
Use orphaned docs as part of GC calculation #80
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
Conversation
long orphanedDocumentCount = | ||
persistence | ||
.query( | ||
"SELECT COUNT(*) FROM (SELECT sequence_number FROM target_documents GROUP BY path HAVING COUNT(*) = 1 AND target_id = 0)") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't know SQLite, and I assume you tried "SELECT COUNT() FROM target_documents GROUP BY path HAVING COUNT() = 1 AND target_id = 0"?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I did indeed try that first. I believe COUNT(*)
in the projection interacts poorly with GROUP BY
in terms of getting what we want here. Using the subquery technique works, and in retrospect is I think a little more obvious when compared with the similar query used to find the sequence numbers.
/test smoke-tests-release |
/test smoke-tests-debug |
/test smoke-tests-release |
1 similar comment
/test smoke-tests-release |
We had originally decided to only look at targets when assessing how much to run GC. However, based on running a write-heavy workload test, we need to include documents that ended up cached without being part of a target.
This is a port of a portion of firebase/firebase-ios-sdk#1961
Note that merge base is into the LRU branch, not master.
Integration tests pass :)