Commit Graph
29 Commits
Author SHA1 Message Date
Brian Chen b1eb602ef4 Rename spec test functions (#3895) 2019-09-20 16:30:11 -04:00
Brian Chen 9d230de9c0 Adding onSnapshotsInSync (not public) (#3850) 2019-09-20 14:15:57 -04:00
Brian Chen 941133705a Port persistence spec test (#3844) 2019-09-13 11:56:47 -07:00
Sebastian Schmidt f0f0aeba20 Don't persist documents that we already have (#3650) 2019-09-05 15:36:29 -07:00
Sebastian Schmidt 2c76a27ebb Update spec tests (#3572) 2019-08-13 09:03:17 -07:00
Gil 05e734b2b7 Refactor Filters (#3359)
* Rename relation_filter.{h,cc} to field_filter.{h,cc}

* Rename RelationFilter to FieldFilter

* Move Filter::Create to FieldFilter

* Port api::Query::ValidateNewFilter

* Add ArrayContainsFilter

* Add KeyFieldFilter

* Make FieldFilter constructor protected

* Port FieldFilter refactor from the JS SDK

https://github.com/firebase/firebase-js-sdk/pull/1894

* Add spec test from firebase/firebase-js-sdk#1913

* Accept array-contains as a synonym for array_contains
2019-07-20 14:02:52 -07:00
Sebastian Schmidt ffb16f8a8b Update Spec tests (#3364) 2019-07-17 05:33:27 +07:00
Hui-Wu f3396f5686 fix latency-compensated query (#3363)
* fix latency compensated query

* addressing comments #1 + Changelog

* add link to issue

* add missing include

* Minor nit fix
2019-07-16 16:17:36 -04:00
Michael Lehenbauer bd0b8e9449 Collection Group Query Internals (#2378)
Includes the new index and all internals for collection group queries, but the public API will not be exposed until backend support is ready.
2019-03-08 13:37:00 -08:00
Gil 4e5c6d0234 Treat ABORTED writes as retryable (#2247)
* Treat ABORTED writes as retryable

This is a port of firebase/firebase-js-sdk#1456.

* Regenerate spec test json
2019-01-11 12:10:37 -08:00
Sebastian Schmidt 5bc4cc55a6 Remove Held Write Acks (#2029)
* Drop acknowledged mutations in schema migration (#1818)

Drop acknowledged mutations in schema migration as part of removing held write acks.

Port of firebase/firebase-js-sdk#1149

* Change removeMutationBatch to remove a single batch (#1955)

* Update Firestore Generated Protos

*  Adding UnknownDocument and hasCommittedMutations (#1971)

* Removing held write batch handling from LocalStore (#1997)

* View changes for held write acks (#2004)

* Held Write Acks Unit Test Fixes (#2008)

* Held Write Ack Removal Spec Tests (#2018)

* Fix integration test
2018-11-01 09:44:30 -07:00
Michael Lehenbauer 3827391c46 Offline get() improvements. (#1783)
[Port of https://github.com/firebase/firebase-js-sdk/pull/1197]

1. Changed MAX_WATCH_STREAM_FAILURES to 1 per conversation with @wilhuff and
   @jdimond.
2. Fixed a "race" where when a get() triggered a watch stream error, we'd
   restart the stream, then get() would remove its listener, and so we had no
   listener left once the watch stream was "opened". Without a listen to send
   we'd be stuck in Offline state (even though we should be Unknown whenever
   we have no listens to send), resulting in the next get() returning data
   from cache without even attempting to reach the backend.
2018-09-06 07:59:51 -07:00
Greg Soltis 43d15ecdf7 Start restarting persistence in spec tests (#1713)
* Update json files

* Start restarting persistence in spec tests
2018-08-28 13:40:41 -07:00
Gil bb1a44861f Implement global resume token (#1696) 2018-08-15 17:24:20 -07:00
Sebastian Schmidt d9b50374ab Add multi-client support to the iOS spec runner (#1631) 2018-08-03 17:06:04 -07:00
Gil fe0952c832 Allow remote updates from watch to heal a cache with synthesized deletes in it (#1557)
* Update spec tests from the js-sdk

* Allow remote updates from watch to heal a cache with synthesized deletes in it

Port of https://github.com/firebase/firebase-js-sdk/pull/1015

Addresses #1548
2018-07-19 07:15:47 -07:00
Michael Lehenbauer c204a1cbfc b/72533250: Fix issue with limbo resolutions triggering incorrect manufactured deletes. (#1556)
[Port of https://github.com/firebase/firebase-js-sdk/pull/1014]

This fixes an issue occurring when a limbo target receives a documentUpdate,
then a global snapshot, and then a CURRENT. Because there was a global
snapshot before the CURRENT, WatchChangeAggregator has no pending document
updates and calls SyncEngine.remoteKeysForTarget to see if we previously got any
document from the backend for the target. See:
https://github.com/firebase/firebase-js-sdk/blob/6905339235ad801291edc696dd75a08e80647f5b/packages/firestore/src/remote/watch_change.ts#L422

Prior to this change, remoteKeysForTarget returned empty because
it relies on our Views to track the contents of the target, and we don't
have Views for limbo targets. Thus WatchChangeAggregator incorrectly
manufactures a NoDocument document update which deletes data from our
cache.

The fix is to have SyncEngine track the fact that we did indeed get
a document for the limbo resolution and return it from
remoteKeysForTarget.
2018-07-18 20:33:32 -07:00
Gil 853b4deab7 Remove the exclusive tag from the Firestore spec tests (#1555)
* Remove exclusive tag in spec tests.

* Mutations can return nil

For example, a patch mutation applied to a nil baseDoc will return nil.
2018-07-18 14:55:10 -07:00
Sebastian Schmidt 4c9df5a666 Add spec test support for target-scoped resume tokens (#1498) 2018-07-06 20:46:00 +02:00
Sebastian Schmidt afea8d5aac Refactor Remote Event (#1396) 2018-06-12 10:58:35 -07:00
Michael Lehenbauer e0e6625f3e Fix issue that could cause offline get()s to wait up to 10 seconds. (#978)
Port of https://github.com/firebase/firebase-js-sdk/pull/592

FSTOnlineStateTracker was reverting to OnlineState Unknown on every stream attempt
rather than remaining Offline once the offline heuristic had been met (i.e. 2
stream failures or 10 seconds). This means that getDocument() requests made while
offline could be delayed up to 10 seconds each time (or until the next backoff
attempt failed).
2018-03-26 13:24:32 -07:00
Michael Lehenbauer 5f49b2f3f9 Fix for b/74749605: Cancel pending backoff operations when closing streams. (#958)
Port of https://github.com/firebase/firebase-js-sdk/pull/564.
2018-03-21 14:59:49 -07:00
Michael Lehenbauer f122cf7ce8 Fix MutationQueue issue resulting in re-sending acknowledged writes. (#909)
Port of: https://github.com/firebase/firebase-js-sdk/pull/559
Should address #772 once released.

getNextMutationBatchAfterBatchId() was not respecting
highestAcknowledgedBatchId and therefore we were resending writes after the
network was disabled / re-enabled.
2018-03-12 11:53:26 -07:00
Michael Lehenbauer 34ebf10b0a Add 10 second timeout waiting for connection before client behaves as-if offline. (#872)
[Port of https://github.com/firebase/firebase-js-sdk/commit/0fa319e5e019dd0d40ab441d2ff9f8f6d4724e43]

* Refactored FSTOnlineState tracking out of FSTRemoteStore and into new
  FSTOnlineStateTracker component.
* Added a 10 second timeout to transition from OnlineState.Unknown to
  OnlineState.Offline rather than waiting indefinitely for the stream to
  succeed or fail.
* Removed hack to run SpecTests using an FSTDispatchQueue that wrapped
  dispatch_get_main_queue(). This was incompatible with [FSTDispatchQueue
  runDelayedCallbacksUntil:] since it queues work and blocks waiting for
  it to complete. Now spec tests create / use a proper FSTDispatchQueue.
* Added a SpecTest to verify OnlineState timeout behavior.
* Misc cleanup:
    * Renamed FSTOnlineState states: Failed => Offline, Healthy => Online
    * Renamed FSTTimerIds (ListenStreamConnection => ListenStreamConnectionBackoff)
    * Added ability to run timers from spec tests.
2018-03-05 09:49:41 -08:00
Michael Lehenbauer 4d7c973369 Fix b/72502745: OnlineState changes cause limbo document crash. (#470) (#714)
[PORT OF https://github.com/firebase/firebase-js-sdk/pull/470]

Context: I made a previous change to raise isFromCache=true events when the
client goes offline. As part of this change I added an assert for
"OnlineState should not affect limbo documents", which it turns out was not
valid because:
* When we go offline, we set the view to non-current and call
	View.applyChanges().
* View.applyChanges() calls applyTargetChange() even though there's no target
	change and it recalculates limbo documents.
* When the view is not current, we consider no documents to be in limbo.
* Therefore all limbo documents are removed and so applyChanges() ends up
	returning unexpected LimboDocumentChanges.

Fix: I've modified the View logic so that we don't recalculate limbo documents
(and generate LimboDocumentChanges) when the View is not current, so now my
assert holds and there should be less spurious removal / re-adding of limbo
documents.
2018-01-27 15:03:05 -08:00
Michael Lehenbauer d4de7a6e86 b/68276665: Raise isFromCache=true events when offline (#567)
* Plumbs FSTOnlineState changes through to views.
* View sets this.current to false on FSTOnlineStateFailed, triggering
	isFromCache=true events. It will automatically be returned to true
	once the listen is reestablished and we get a new CURRENT message.
* Updated tests (and added one new one) to verify behavior.
* Unifies setOnlineStateToUnknown, setOnlineStateToHealthy, and
	updateAndBroadcastOnlineState into a single updateOnlineState
	method.
* Split disableNetwork into (public) disableNetwork and
	(private) disableNetworkWithTargetOnlineState methods..
* Some miscellaneous comment cleanup.

* Add missing comment per CR feedback.
2017-12-15 14:56:03 -08:00
Sebastian Schmidt 9044d2ce21 Sending an empty write request before tearing down the stream (#438) 2017-11-08 17:04:41 -08:00
Michael Lehenbauer aab276a2c8 Port of fix for b/67042460 (retry more often before considering client offline) (#403)
This ensures FSTRemoteStore always tries to connect at least twice before surfacing an FSTOnlineStateFailed
event to external code (which may trigger gets to fail, cached data to be surfaced, etc.).
2017-10-23 10:10:34 -07:00
Gil bde743ed25 Release 4.3.0 (#327)
Initial release of Firestore at 0.8.0
Bump FirebaseCommunity to 0.1.3
2017-10-03 08:55:22 -07:00