[go: nahoru, domu]

Skip to content
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

Wire together LRU GC #1905

Merged
merged 41 commits into from
Nov 26, 2018
Merged

Wire together LRU GC #1905

merged 41 commits into from
Nov 26, 2018

Conversation

gsoltis
Copy link
@gsoltis gsoltis commented Oct 3, 2018

This PR contains the public-facing API for LRU GC. It has approved by the API council and the required schema migration has already been merged.

Additionally, this PR wires up LRU garbage collection to run on a timer and log results. It implements both the timing and the size thresholds, as well as the method that executes the various pieces of the GC algorithm.

@gsoltis
Copy link
Author
gsoltis commented Oct 3, 2018

LRU GC is currently hardcoded to be disabled at the point where it is initialized in FSTFirestoreClient.

Firestore/Source/Local/FSTLRUGarbageCollector.h Outdated Show resolved Hide resolved
Firestore/Source/Local/FSTLRUGarbageCollector.h Outdated Show resolved Hide resolved
Firestore/Source/Local/FSTLRUGarbageCollector.h Outdated Show resolved Hide resolved
Firestore/Source/Local/FSTLRUGarbageCollector.h Outdated Show resolved Hide resolved
Firestore/Source/Local/FSTLRUGarbageCollector.h Outdated Show resolved Hide resolved
Firestore/Source/Local/FSTLRUGarbageCollector.h Outdated Show resolved Hide resolved
Firestore/Source/Local/FSTLRUGarbageCollector.mm Outdated Show resolved Hide resolved
Firestore/Source/Util/FSTDispatchQueue.h Outdated Show resolved Hide resolved
Firestore/Source/Local/FSTLRUGarbageCollector.mm Outdated Show resolved Hide resolved
@wilhuff wilhuff assigned gsoltis and unassigned wilhuff Oct 5, 2018
Copy link
Contributor
@wilhuff wilhuff left a comment

Choose a reason for hiding this comment

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

Basically LGTM with a last few nits.

return LruResults{NO, 0, 0, 0};
}

BOOL didRun;
Copy link
Contributor

Choose a reason for hiding this comment

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

C++ has a boolean type bool whose literals are true and false. (BOOL, YES, NO are Objective-C).

Copy link
Author

Choose a reason for hiding this comment

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

Right, done.

using firebase::firestore::model::DocumentKey;
using firebase::firestore::model::ListenSequenceNumber;

const long kFIRFirestorePersistenceCacheSizeUnlimited = -1;
Copy link
Contributor

Choose a reason for hiding this comment

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

Shouldn't this declaration should be up somewhere in API-land? Eventually this code will be platform neutral C++, while this constant has a name that's specific to Objective-C.

Copy link
Author

Choose a reason for hiding this comment

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

The declaration is in FIRFirestoreSettings.h. Although, I have now set this to use a static constant from LruParams so that when we have a C++ place to define the constant, we can set its value to the same internal constant.

@@ -18,6 +18,9 @@

NS_ASSUME_NONNULL_BEGIN

/** Used to set on-disk cache size to unlimited. Garbage collection will not run. */
extern const long kFIRFirestorePersistenceCacheSizeUnlimited;
Copy link
Contributor

Choose a reason for hiding this comment

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

Didn't we agree to make this CacheSizeUnlimited?

Also needs an NS_SWIFT_NAME and a swift-language use test in BasicCompileTests.swift to ensure that the name is mapped correctly out to swift users.

Copy link
Author

Choose a reason for hiding this comment

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

Yup, updated to kFIRFirestoreCacheSizeUnlimited and int64_t. The API review deferred to @ryanwilson for an swift naming convention, and he's out this week. I'll update it once I talk to him.

It's also now defined in terms of a value on LruParams.

@gsoltis gsoltis assigned wilhuff and unassigned gsoltis Nov 26, 2018
@gsoltis
Copy link
Author
gsoltis commented Nov 26, 2018

Updated to use DelayedOperation directly, and to properly capture self in the operation.

Copy link
Contributor
@wilhuff wilhuff left a comment

Choose a reason for hiding this comment

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

LGTM. We also need a changelog entry but we can do that in a separate PR.

@gsoltis gsoltis merged commit 305f872 into master Nov 26, 2018
@gsoltis gsoltis deleted the gsoltis/lru_gc_disabled branch November 26, 2018 22:33
bstpierr added a commit that referenced this pull request Nov 27, 2018
bstpierr added a commit that referenced this pull request Nov 27, 2018
* Revert "Custom fdl domain (#2121)"

This reverts commit ebea1ef.

* Revert "enable disabled passed integration test (#2120)"

This reverts commit 48e5f7a.

* Revert "Wire together LRU GC (#1905)"

This reverts commit 305f872.

* Revert "Fix build under linux/gcc (#2116)"

This reverts commit b0a4b6c.

* Revert "Implement PatchMutation::ApplyToLocalView (#1973)"

This reverts commit f66b5b5.

* Revert "Add Firebase Source to Header Search Path (#2114)"

This reverts commit 0540361.
@firebase firebase locked and limited conversation to collaborators Oct 26, 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.

None yet

3 participants