Skip to content

Commit 5971fa1

Browse files
Revert "Revert "Add logging for query mode (#776)" (#797)"
This reverts commit 98d83b4.
1 parent 98d83b4 commit 5971fa1

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

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

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
import com.google.firebase.firestore.model.DocumentKey;
2525
import com.google.firebase.firestore.model.MaybeDocument;
2626
import com.google.firebase.firestore.model.SnapshotVersion;
27+
import com.google.firebase.firestore.util.Logger;
2728
import java.util.Collections;
2829
import java.util.Map;
2930

@@ -51,6 +52,8 @@
5152
* </ol>
5253
*/
5354
public class IndexFreeQueryEngine implements QueryEngine {
55+
private static final String LOG_TAG = "IndexFreeQueryEngine";
56+
5457
private LocalDocumentsView localDocumentsView;
5558

5659
@Override
@@ -83,6 +86,14 @@ && needsRefill(previousResults, remoteKeys, queryData.getLastLimboFreeSnapshotVe
8386
return executeFullCollectionScan(query);
8487
}
8588

89+
if (Logger.isDebugEnabled()) {
90+
Logger.debug(
91+
LOG_TAG,
92+
"Re-using previous result from %s to execute query: %s",
93+
queryData.getLastLimboFreeSnapshotVersion().toString(),
94+
query.toString());
95+
}
96+
8697
// Retrieve all results for documents that were updated since the last limbo-document free
8798
// remote snapshot.
8899
ImmutableSortedMap<DocumentKey, Document> updatedResults =
@@ -161,6 +172,9 @@ public void handleDocumentChange(MaybeDocument oldDocument, MaybeDocument newDoc
161172
}
162173

163174
private ImmutableSortedMap<DocumentKey, Document> executeFullCollectionScan(Query query) {
175+
if (Logger.isDebugEnabled()) {
176+
Logger.debug(LOG_TAG, "Using full collection scan to execute query: %s", query.toString());
177+
}
164178
return localDocumentsView.getDocumentsMatchingQuery(query, SnapshotVersion.NONE);
165179
}
166180
}

0 commit comments

Comments
 (0)