Skip to content

Commit 6418e58

Browse files
Remove Index-Free assert (#800)
1 parent 7f6621c commit 6418e58

File tree

4 files changed

+17
-7
lines changed

4 files changed

+17
-7
lines changed

firebase-firestore/CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# Unreleased
22

3+
# 21.1.1
4+
- [fixed] Addressed a regression in 21.1.0 that caused the crash: "Cannot add
5+
document to the RemoteDocumentCache with a read time of zero".
6+
37
# 21.1.0
48
- [feature] Added a `terminate()` method to `FirebaseFirestore` which
59
terminates the instance, releasing any held resources. Once it completes, you

firebase-firestore/src/main/java/com/google/firebase/firestore/core/FirestoreClient.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -268,7 +268,9 @@ private void initialize(Context context, User user, boolean usePersistence, long
268268
}
269269

270270
persistence.start();
271-
// TODO(index-free): Use IndexFreeQueryEngine/IndexedQueryEngine as appropriate.
271+
// TODO(index-free): Use IndexFreeQueryEngine/IndexedQueryEngine as appropriate. When we enable
272+
// IndexFreeQueryEngine, we have to reset the "lastLimboFreeSnapshotVersion" for all persisted
273+
// QueryData as we had to revert the part of the change that ensured that the data is reliable.
272274
QueryEngine queryEngine = new SimpleQueryEngine();
273275
localStore = new LocalStore(persistence, queryEngine, user);
274276
if (gc != null) {

firebase-firestore/src/main/java/com/google/firebase/firestore/local/MemoryRemoteDocumentCache.java

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,11 @@ final class MemoryRemoteDocumentCache implements RemoteDocumentCache {
4848

4949
@Override
5050
public void add(MaybeDocument document, SnapshotVersion readTime) {
51-
hardAssert(
52-
!readTime.equals(SnapshotVersion.NONE),
53-
"Cannot add document to the RemoteDocumentCache with a read time of zero");
51+
// TODO(index-free): This assert causes a crash for one of our customers. Re-add the assert once
52+
// we have fixed the root cause and cleaned up the underlying data.
53+
// hardAssert(
54+
// !readTime.equals(SnapshotVersion.NONE),
55+
// "Cannot add document to the RemoteDocumentCache with a read time of zero");
5456
docs = docs.insert(document.getKey(), new Pair<>(document, readTime));
5557

5658
persistence.getIndexManager().addToCollectionParentIndex(document.getKey().getPath().popLast());

firebase-firestore/src/main/java/com/google/firebase/firestore/local/SQLiteRemoteDocumentCache.java

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,9 +52,11 @@ final class SQLiteRemoteDocumentCache implements RemoteDocumentCache {
5252

5353
@Override
5454
public void add(MaybeDocument maybeDocument, SnapshotVersion readTime) {
55-
hardAssert(
56-
!readTime.equals(SnapshotVersion.NONE),
57-
"Cannot add document to the RemoteDocumentCache with a read time of zero");
55+
// TODO(index-free): This assert causes a crash for one of our customers. Re-add the assert once
56+
// we have fixed the root cause and cleaned up the underlying data.
57+
// hardAssert(
58+
// !readTime.equals(SnapshotVersion.NONE),
59+
// "Cannot add document to the RemoteDocumentCache with a read time of zero");
5860

5961
String path = pathForKey(maybeDocument.getKey());
6062
Timestamp timestamp = readTime.getTimestamp();

0 commit comments

Comments
 (0)