Skip to content

Commit 70b04ab

Browse files
Remove Indexing flag
1 parent 70864ca commit 70b04ab

17 files changed

+191
-303
lines changed

firebase-firestore/firebase-firestore.gradle

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -105,13 +105,6 @@ android.libraryVariants.all { variant ->
105105
file("local.properties").withInputStream { localProps.load(it) }
106106
} catch (FileNotFoundException e) {
107107
}
108-
109-
// TODO(Indexing): Delete below once indexing is shipped.
110-
if (localProps['firestoreEnableIndexing']) {
111-
variant.buildConfigField("boolean", "ENABLE_INDEXING", "true")
112-
} else {
113-
variant.buildConfigField("boolean", "ENABLE_INDEXING", "false")
114-
}
115108
}
116109

117110
configurations.all {

firebase-firestore/src/androidTest/java/com/google/firebase/firestore/IndexingTest.java

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -19,29 +19,15 @@
1919
import androidx.test.ext.junit.runners.AndroidJUnit4;
2020
import com.google.android.gms.tasks.Task;
2121
import com.google.android.gms.tasks.Tasks;
22-
import com.google.firebase.firestore.local.Persistence;
2322
import com.google.firebase.firestore.testutil.Assert;
2423
import com.google.firebase.firestore.testutil.IntegrationTestUtil;
2524
import java.util.concurrent.ExecutionException;
2625
import org.junit.After;
27-
import org.junit.BeforeClass;
2826
import org.junit.Test;
2927
import org.junit.runner.RunWith;
3028

3129
@RunWith(AndroidJUnit4.class)
3230
public class IndexingTest {
33-
/** Current state of indexing support. Used for restoring after test run. */
34-
private static final boolean supportsIndexing = Persistence.INDEXING_SUPPORT_ENABLED;
35-
36-
@BeforeClass
37-
public static void beforeClass() {
38-
Persistence.INDEXING_SUPPORT_ENABLED = true;
39-
}
40-
41-
@BeforeClass
42-
public static void afterClass() {
43-
Persistence.INDEXING_SUPPORT_ENABLED = supportsIndexing;
44-
}
4531

4632
@After
4733
public void tearDown() {
@@ -115,6 +101,4 @@ public void testBadIndexDoesNotCrashClient() {
115101
+ " \"fieldOverrides\": []\n"
116102
+ "}"));
117103
}
118-
119-
// TODO(indexing): Add tests that validate that indices are active
120104
}

firebase-firestore/src/androidTest/java/com/google/firebase/firestore/testutil/IntegrationTestUtil.java

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@
3838
import com.google.firebase.firestore.QuerySnapshot;
3939
import com.google.firebase.firestore.auth.User;
4040
import com.google.firebase.firestore.core.DatabaseInfo;
41-
import com.google.firebase.firestore.local.Persistence;
4241
import com.google.firebase.firestore.model.DatabaseId;
4342
import com.google.firebase.firestore.testutil.provider.FirestoreProvider;
4443
import com.google.firebase.firestore.util.AsyncQueue;
@@ -255,8 +254,6 @@ public static FirebaseFirestore testFirestore(
255254
// This unfortunately is a global setting that affects existing Firestore clients.
256255
Logger.setLogLevel(logLevel);
257256

258-
Persistence.INDEXING_SUPPORT_ENABLED = true;
259-
260257
Context context = ApplicationProvider.getApplicationContext();
261258
DatabaseId databaseId = DatabaseId.forDatabase(projectId, DatabaseId.DEFAULT_DATABASE_ID);
262259

firebase-firestore/src/main/java/com/google/firebase/firestore/FirebaseFirestore.java

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -307,9 +307,6 @@ public FirebaseApp getApp() {
307307
Task<Void> setIndexConfiguration(String json) {
308308
ensureClientConfigured();
309309

310-
// Preconditions.checkState(BuildConfig.ENABLE_INDEXING, "Indexing support is not yet
311-
// available.");
312-
313310
List<FieldIndex> parsedIndices = new ArrayList<>();
314311

315312
// See https://firebase.google.com/docs/reference/firestore/indexes/#json_format for the

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

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -156,9 +156,7 @@ public Task<Void> terminate() {
156156
gcScheduler.stop();
157157
}
158158

159-
if (Persistence.INDEXING_SUPPORT_ENABLED) {
160-
indexBackfiller.getScheduler().stop();
161-
}
159+
indexBackfiller.getScheduler().stop();
162160
});
163161
}
164162

@@ -283,7 +281,7 @@ private void initialize(Context context, User user, FirebaseFirestoreSettings se
283281
gcScheduler.start();
284282
}
285283

286-
if (Persistence.INDEXING_SUPPORT_ENABLED && settings.isPersistenceEnabled()) {
284+
if (settings.isPersistenceEnabled()) {
287285
indexBackfiller.getScheduler().start();
288286
}
289287
}

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

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,13 +75,11 @@ public Scheduler(AsyncQueue asyncQueue) {
7575

7676
@Override
7777
public void start() {
78-
hardAssert(Persistence.INDEXING_SUPPORT_ENABLED, "Indexing support not enabled");
7978
scheduleBackfill();
8079
}
8180

8281
@Override
8382
public void stop() {
84-
hardAssert(Persistence.INDEXING_SUPPORT_ENABLED, "Indexing support not enabled");
8583
if (backfillTask != null) {
8684
backfillTask.cancel();
8785
}

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

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414

1515
package com.google.firebase.firestore.local;
1616

17-
import com.google.firebase.firestore.BuildConfig;
1817
import com.google.firebase.firestore.auth.User;
1918
import com.google.firebase.firestore.util.Supplier;
2019

@@ -53,10 +52,6 @@ public abstract class Persistence {
5352
/** Constant string to indicate a data migration is required to support overlays. */
5453
public static String DATA_MIGRATION_BUILD_OVERLAYS = "BUILD_OVERLAYS";
5554

56-
/** Temporary setting for enabling indexing-specific code paths while in development. */
57-
// TODO(Indexing): Remove this.
58-
public static boolean INDEXING_SUPPORT_ENABLED = BuildConfig.ENABLE_INDEXING;
59-
6055
// Local subclasses only, please.
6156
Persistence() {}
6257

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

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -96,11 +96,6 @@ final class SQLiteIndexManager implements IndexManager {
9696

9797
@Override
9898
public void start() {
99-
if (!Persistence.INDEXING_SUPPORT_ENABLED) {
100-
started = true;
101-
return;
102-
}
103-
10499
Map<Integer, FieldIndex.IndexState> indexStates = new HashMap<>();
105100

106101
// Fetch all index states if persisted for the user. These states contain per user information
@@ -225,7 +220,6 @@ public void deleteFieldIndex(FieldIndex index) {
225220
@Override
226221
public void updateIndexEntries(ImmutableSortedMap<DocumentKey, Document> documents) {
227222
hardAssert(started, "IndexManager not started");
228-
if (!Persistence.INDEXING_SUPPORT_ENABLED) return;
229223

230224
for (Map.Entry<DocumentKey, Document> entry : documents) {
231225
Collection<FieldIndex> fieldIndexes = getFieldIndexes(entry.getKey().getCollectionGroup());
@@ -506,10 +500,6 @@ private Object[] fillBounds(
506500
public FieldIndex getFieldIndex(Target target) {
507501
hardAssert(started, "IndexManager not started");
508502

509-
if (!Persistence.INDEXING_SUPPORT_ENABLED) {
510-
return null;
511-
}
512-
513503
TargetIndexMatcher targetIndexMatcher = new TargetIndexMatcher(target);
514504
String collectionGroup =
515505
target.getCollectionGroup() != null

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

Lines changed: 6 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@
2828
import com.google.firebase.firestore.proto.Target;
2929
import com.google.firebase.firestore.util.Consumer;
3030
import com.google.firebase.firestore.util.Logger;
31-
import com.google.firebase.firestore.util.Preconditions;
3231
import com.google.protobuf.InvalidProtocolBufferException;
3332
import java.util.ArrayList;
3433
import java.util.List;
@@ -49,10 +48,7 @@ class SQLiteSchema {
4948
* The version of the schema. Increase this by one for each migration added to runMigrations
5049
* below.
5150
*/
52-
static final int VERSION = 15;
53-
54-
// TODO(indexing): Remove this constant and increment VERSION to enable indexing support
55-
static final int INDEXING_SUPPORT_VERSION = VERSION + 1;
51+
static final int VERSION = 16;
5652

5753
/**
5854
* The batch size for data migrations.
@@ -77,11 +73,7 @@ void runSchemaUpgrades() {
7773
}
7874

7975
void runSchemaUpgrades(int fromVersion) {
80-
int toVersion = VERSION;
81-
if (Persistence.INDEXING_SUPPORT_ENABLED) {
82-
toVersion = INDEXING_SUPPORT_VERSION;
83-
}
84-
runSchemaUpgrades(fromVersion, toVersion);
76+
runSchemaUpgrades(fromVersion, VERSION);
8577
}
8678

8779
/**
@@ -183,6 +175,10 @@ void runSchemaUpgrades(int fromVersion, int toVersion) {
183175
ensureReadTime();
184176
}
185177

178+
if (fromVersion < 16 && toVersion >= 16) {
179+
createFieldIndex();
180+
}
181+
186182
/*
187183
* Adding a new schema upgrade? READ THIS FIRST!
188184
*
@@ -196,11 +192,6 @@ void runSchemaUpgrades(int fromVersion, int toVersion) {
196192
* that existing values have been properly maintained. Calculate them again, if applicable.
197193
*/
198194

199-
if (fromVersion < INDEXING_SUPPORT_VERSION && toVersion >= INDEXING_SUPPORT_VERSION) {
200-
Preconditions.checkState(Persistence.INDEXING_SUPPORT_ENABLED);
201-
createFieldIndex();
202-
}
203-
204195
Logger.debug(
205196
"SQLiteSchema",
206197
"Migration from version %s to %s took %s milliseconds",

firebase-firestore/src/test/java/com/google/firebase/firestore/local/IndexBackfillerTest.java

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,7 @@
3636
import java.util.Iterator;
3737
import java.util.Set;
3838
import org.junit.After;
39-
import org.junit.AfterClass;
4039
import org.junit.Before;
41-
import org.junit.BeforeClass;
4240
import org.junit.Rule;
4341
import org.junit.Test;
4442
import org.junit.rules.TestName;
@@ -49,18 +47,6 @@
4947
@RunWith(RobolectricTestRunner.class)
5048
@Config(manifest = Config.NONE)
5149
public class IndexBackfillerTest {
52-
/** Current state of indexing support. Used for restoring after test run. */
53-
private static final boolean supportsIndexing = Persistence.INDEXING_SUPPORT_ENABLED;
54-
55-
@BeforeClass
56-
public static void beforeClass() {
57-
Persistence.INDEXING_SUPPORT_ENABLED = true;
58-
}
59-
60-
@AfterClass
61-
public static void afterClass() {
62-
Persistence.INDEXING_SUPPORT_ENABLED = supportsIndexing;
63-
}
6450

6551
@Rule public TestName name = new TestName();
6652

firebase-firestore/src/test/java/com/google/firebase/firestore/local/IndexingEnabledSQLiteLocalStoreTest.java

Lines changed: 0 additions & 132 deletions
This file was deleted.

0 commit comments

Comments
 (0)