Skip to content

Use orphaned docs as part of GC calculation #1355

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 2 commits into from
Nov 8, 2018

Conversation

gsoltis
Copy link

@gsoltis gsoltis commented Nov 3, 2018

Port of firebase/firebase-android-sdk#80

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.

Copy link
Contributor

@schmidt-sebastian schmidt-sebastian left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM with some optional renames.

): PersistencePromise<number> {
const docCountPromise = this.orphanedDocmentCount(txn);
const targetCountPromise = this.db.getQueryCache().getQueryCount(txn);
return targetCountPromise.next(targetCount =>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We usually don't include Promise in the name. You can respond to this by just inlining the calls though :)

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm going to leave as-is. Inlining would put the operations in sequence, rather than in parallel. Also, the code is dealing with both the promise of the count, and the count itself, so I think it's worthwhile to distinguish them.

const targetCountPromise = this.persistence
.getQueryCache()
.getTargetCount(txn);
return targetCountPromise.next(targetCount =>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same comment regarding the naming as above.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As above.

@gsoltis gsoltis merged commit 54b304a into master Nov 8, 2018
@gsoltis gsoltis deleted the gsoltis/use_orphaned_docs branch November 8, 2018 18:14
Feiyang1 pushed a commit that referenced this pull request Nov 9, 2018
* Use orphaned documents in sequence number count
zijianjoy pushed a commit that referenced this pull request May 24, 2019
* Use orphaned documents in sequence number count
@firebase firebase locked and limited conversation to collaborators Oct 15, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants