-
Notifications
You must be signed in to change notification settings - Fork 616
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
Enable LRU GC #68
Conversation
/test connected-check |
firebase-firestore/src/main/java/com/google/firebase/firestore/FirebaseFirestoreSettings.java
Outdated
Show resolved
Hide resolved
firebase-firestore/src/main/java/com/google/firebase/firestore/FirebaseFirestoreSettings.java
Outdated
Show resolved
Hide resolved
firebase-firestore/src/main/java/com/google/firebase/firestore/FirebaseFirestoreSettings.java
Show resolved
Hide resolved
firebase-firestore/src/main/java/com/google/firebase/firestore/core/FirestoreClient.java
Outdated
Show resolved
Hide resolved
firebase-firestore/src/main/java/com/google/firebase/firestore/core/FirestoreClient.java
Outdated
Show resolved
Hide resolved
firebase-firestore/src/main/java/com/google/firebase/firestore/local/MemoryQueryCache.java
Show resolved
Hide resolved
...e-firestore/src/main/java/com/google/firebase/firestore/local/MemoryRemoteDocumentCache.java
Show resolved
Hide resolved
firebase-firestore/src/main/java/com/google/firebase/firestore/util/AsyncQueue.java
Outdated
Show resolved
Hide resolved
firebase-firestore/src/main/java/com/google/firebase/firestore/local/LruGarbageCollector.java
Show resolved
Hide resolved
firebase-firestore/src/main/java/com/google/firebase/firestore/local/LruGarbageCollector.java
Outdated
Show resolved
Hide resolved
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.
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 |
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.
Nit: Maybe Constant to use with
, since we want to describe what the value is, rather than what someone can do with it.
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.
Sure
params); | ||
lruDelegate = sqlitePersistence.getReferenceDelegate(); | ||
persistence = sqlitePersistence; | ||
scheduleLruGarbageCollection(); |
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.
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.
firebase-firestore/src/main/java/com/google/firebase/firestore/local/LruGarbageCollector.java
Show resolved
Hide resolved
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.
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(); |
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.
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?
* Use orphaned documents in sequence number calculation
* Encapsulate scheduling in an inner class
/test smoke-tests-release |
/test smoke-tests-debug |
/retest |
/retest |
/retest |
* Switch default for LRU collection to disabled
@gsoltis: The following test failed, say
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. |
Don't merge until LGTMs are collected on API proposal.
Port of firebase/firebase-ios-sdk#1905, although now this one is a little ahead since it sets GC to run by default.