Skip to content

Enable LRU GC #68

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 20 commits into from
Dec 19, 2018
Merged

Enable LRU GC #68

merged 20 commits into from
Dec 19, 2018

Conversation

gsoltis
Copy link
Contributor

@gsoltis gsoltis commented Oct 9, 2018

Don't merge until LGTMs are collected on API proposal.

  • Implements threshold and scheduling for LRU GC and sets up default behavior.
  • Fixes bug with memory LRU persistence where all documents were being iterated rather than just orphaned documents.

Port of firebase/firebase-ios-sdk#1905, although now this one is a little ahead since it sets GC to run by default.

@gsoltis
Copy link
Contributor Author

gsoltis commented Oct 9, 2018

/test connected-check

@gsoltis gsoltis assigned schmidt-sebastian and unassigned gsoltis Oct 12, 2018
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.

Some (somewhat optional) comments remaining. Thanks for the changes!

@@ -24,6 +24,14 @@
/** Settings used to configure a FirebaseFirestore instance. */
@PublicApi
public final class FirebaseFirestoreSettings {
/**
* Set this constant as the value for {@link
Copy link
Contributor

Choose a reason for hiding this comment

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

Nit: Maybe Constant to use with , since we want to describe what the value is, rather than what someone can do with it.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sure

params);
lruDelegate = sqlitePersistence.getReferenceDelegate();
persistence = sqlitePersistence;
scheduleLruGarbageCollection();
Copy link
Contributor

Choose a reason for hiding this comment

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

We can look at this more in the future, but it might actually make sense to split these up, using the same argument that you provided: In FirebaseFirestoreSettings/FirestoreClient we can validate whether the settings for the GC algorithm make sense. In the GC code, we can then always assume that all values make sense and we don't have to special case anything.

That's just my two cents and your mileage may vary. I believe that for now the PR could be simplified if we didn't have to differentiate between -1 and >0 in the LRU GC.

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 an optional "idea" on how to remove the scheduling if GC is disabled, while still keeping everything encapsulated.

params);
lruDelegate = sqlitePersistence.getReferenceDelegate();
persistence = sqlitePersistence;
scheduleLruGarbageCollection();
Copy link
Contributor

@schmidt-sebastian schmidt-sebastian Oct 20, 2018

Choose a reason for hiding this comment

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

Hm, I think that would indeed be a compromise, and it's one that I am less happy with than what we currently have. I prefer the current solution over asking GC whether it is enabled and then acting upon this by asking GC to do its job.

I thought of another approach though - can we passed the AsyncQueue to the GC algorithm and let it schedule itself if it needs to?

Greg Soltis added 2 commits October 23, 2018 10:20
* Use orphaned documents in sequence number calculation
* Encapsulate scheduling in an inner class
@googlebot googlebot added the cla: yes Override cla label Nov 8, 2018
@gsoltis
Copy link
Contributor Author

gsoltis commented Nov 8, 2018

/test smoke-tests-release

@gsoltis
Copy link
Contributor Author

gsoltis commented Nov 20, 2018

/test smoke-tests-debug

@gsoltis
Copy link
Contributor Author

gsoltis commented Nov 27, 2018

/retest

@gsoltis
Copy link
Contributor Author

gsoltis commented Dec 4, 2018

/retest

@gsoltis
Copy link
Contributor Author

gsoltis commented Dec 18, 2018

/retest

* Switch default for LRU collection to disabled
@google-oss-bot
Copy link
Contributor

@gsoltis: The following test failed, say /retest to rerun them all:

Test name Commit Details Rerun command
smoke-tests-release 793b0b4 link /test smoke-tests-release

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. I understand the commands that are listed here.

@gsoltis gsoltis merged commit c627b48 into master Dec 19, 2018
@gsoltis gsoltis deleted the gsoltis/enable_lru branch December 19, 2018 23:11
@firebase firebase locked and limited conversation to collaborators Oct 14, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants