|
28 | 28 | import com.apple.foundationdb.record.IndexState;
|
29 | 29 | import com.apple.foundationdb.record.RecordCoreException;
|
30 | 30 | import com.apple.foundationdb.record.RecordMetaData;
|
31 |
| -import com.apple.foundationdb.record.TupleRange; |
32 | 31 | import com.apple.foundationdb.record.logging.KeyValueLogMessage;
|
33 | 32 | import com.apple.foundationdb.record.logging.LogMessageKeys;
|
34 | 33 | import com.apple.foundationdb.record.metadata.Index;
|
35 |
| -import com.apple.foundationdb.record.metadata.Key; |
36 | 34 | import com.apple.foundationdb.record.metadata.MetaDataException;
|
37 | 35 | import com.apple.foundationdb.record.metadata.RecordType;
|
38 | 36 | import com.apple.foundationdb.record.provider.common.StoreTimer;
|
@@ -284,26 +282,6 @@ private IndexingByIndex getIndexerByIndex() {
|
284 | 282 | return (IndexingByIndex)indexer;
|
285 | 283 | }
|
286 | 284 |
|
287 |
| - @Nonnull |
288 |
| - private IndexingByRecords getIndexerByRecords() { |
289 |
| - if (! (indexer instanceof IndexingByRecords)) { // this covers null pointer |
290 |
| - indexer = new IndexingByRecords(common, indexingPolicy); |
291 |
| - } |
292 |
| - return (IndexingByRecords)indexer; |
293 |
| - } |
294 |
| - |
295 |
| - @Nonnull |
296 |
| - private IndexingByRecords getIndexerByRecordsOrThrow() { |
297 |
| - if (fallbackToRecordsScan) { |
298 |
| - return getIndexerByRecords(); |
299 |
| - } |
300 |
| - if (indexingPolicy.isByIndex()) { |
301 |
| - throw new RecordCoreException("Indexing by index makes no sense here"); |
302 |
| - } |
303 |
| - // default |
304 |
| - return getIndexerByRecords(); |
305 |
| - } |
306 |
| - |
307 | 285 | @Nonnull
|
308 | 286 | private IndexingMultiTargetByRecords getIndexerMultiTargetByRecords() {
|
309 | 287 | if (! (indexer instanceof IndexingMultiTargetByRecords)) {
|
@@ -409,100 +387,6 @@ public CompletableFuture<Void> eraseIndexingTypeStampTestOnly() {
|
409 | 387 | }));
|
410 | 388 | }
|
411 | 389 |
|
412 |
| - /** |
413 |
| - * Builds (transactionally) the index by adding records with primary keys within the given range. |
414 |
| - * This will look for gaps of keys within the given range that haven't yet been rebuilt and then |
415 |
| - * rebuild only those ranges. As a result, if this method is called twice, the first time, it will |
416 |
| - * build whatever needs to be built, and then the second time, it will notice that there are no ranges |
417 |
| - * that need to be built, so it will do nothing. In this way, it is idempotent and thus safe to |
418 |
| - * use in retry loops. |
419 |
| - * |
420 |
| - * This method will fail if there is too much work to be done in a single transaction. If one wants |
421 |
| - * to handle building a range that does not fit in a single transaction, one should use the |
422 |
| - * {@link #buildRange(Key.Evaluated, Key.Evaluated) buildRange()} |
423 |
| - * function that takes an {@link FDBDatabase} as its first parameter. |
424 |
| - * |
425 |
| - * @param store the record store in which to rebuild the range |
426 |
| - * @param start the (inclusive) beginning primary key of the range to build (or <code>null</code> to go to the end) |
427 |
| - * @param end the (exclusive) end primary key of the range to build (or <code>null</code> to go to the end) |
428 |
| - * @return a future that will be ready when the build has completed |
429 |
| - */ |
430 |
| - @Nonnull |
431 |
| - @Deprecated(since = "3.3.443.0", forRemoval = true) |
432 |
| - public CompletableFuture<Void> buildRange(@Nonnull FDBRecordStore store, @Nullable Key.Evaluated start, @Nullable Key.Evaluated end) { |
433 |
| - // This only makes sense at 'scan by records' mode. |
434 |
| - return getIndexerByRecordsOrThrow().buildRange(store, start, end); |
435 |
| - } |
436 |
| - |
437 |
| - /** |
438 |
| - * Builds (with a retry loop) the index by adding records with primary keys within the given range. |
439 |
| - * This will look for gaps of keys within the given range that haven't yet been rebuilt and then rebuild |
440 |
| - * only those ranges. It will also limit each transaction to the number of records specified by the |
441 |
| - * <code>limit</code> parameter of this class's constructor. In the case that that limit is too high (i.e., |
442 |
| - * it can't make any progress or errors out on a non-retriable error like <code>transaction_too_large</code>, |
443 |
| - * this method will actually decrease the limit so that less work is attempted each transaction. It will |
444 |
| - * also rate limit itself as to not make too many requests per second. |
445 |
| - * <p> |
446 |
| - * Note that it does not have the protections (synchronized sessions and index state precondition) which are imposed |
447 |
| - * on {@link #buildIndexAsync()} (or its variations), but it does use the created synchronized session if a |
448 |
| - * {@link #buildIndexAsync()} is running on the {@link OnlineIndexer} simultaneously or this range build is used as |
449 |
| - * part of {@link #buildIndexAsync()} internally. |
450 |
| - * </p> |
451 |
| - * @param start the (inclusive) beginning primary key of the range to build (or <code>null</code> to go from the beginning) |
452 |
| - * @param end the (exclusive) end primary key of the range to build (or <code>null</code> to go to the end) |
453 |
| - * @return a future that will be ready when the build has completed |
454 |
| - */ |
455 |
| - @Nonnull |
456 |
| - @Deprecated(since = "3.3.443.0", forRemoval = true) |
457 |
| - public CompletableFuture<Void> buildRange(@Nullable Key.Evaluated start, @Nullable Key.Evaluated end) { |
458 |
| - // This only makes sense at 'scan by records' mode. |
459 |
| - return getIndexerByRecordsOrThrow().buildRange(start, end); |
460 |
| - } |
461 |
| - |
462 |
| - /** |
463 |
| - * Builds (transactionally) the index by adding records with primary keys within the given range. |
464 |
| - * This requires that the range is initially "unbuilt", i.e., no records within the given |
465 |
| - * range have yet been processed by the index build job. It is acceptable if there |
466 |
| - * are records within that range that have already been added to the index because they were |
467 |
| - * added to the store after the index was added in write-only mode but have not yet been |
468 |
| - * processed by the index build job. |
469 |
| - * |
470 |
| - * Note that this function is not idempotent in that if the first time this function runs, if it |
471 |
| - * fails with <code>commit_unknown_result</code> but the transaction actually succeeds, running this |
472 |
| - * function again will result in a {@link RecordBuiltRangeException} being thrown the second |
473 |
| - * time. Retry loops used by the <code>OnlineIndexer</code> class that call this method |
474 |
| - * handle this contingency. For the most part, this method should only be used by those who know |
475 |
| - * what they are doing. It is included because it is less expensive to make this call if one |
476 |
| - * already knows that the range will be unbuilt, but the caller must be ready to handle the |
477 |
| - * circumstance that the range might be built the second time. |
478 |
| - * |
479 |
| - * Most users should use the |
480 |
| - * {@link #buildRange(FDBRecordStore, Key.Evaluated, Key.Evaluated) buildRange()} |
481 |
| - * method with the same parameters in the case that they want to build a range of keys into the index. That |
482 |
| - * method <i>is</i> idempotent, but it is slightly more costly as it firsts determines what ranges are |
483 |
| - * have not yet been built before building them. |
484 |
| - * |
485 |
| - * @param store the record store in which to rebuild the range |
486 |
| - * @param start the (inclusive) beginning primary key of the range to build (or <code>null</code> to start from the beginning) |
487 |
| - * @param end the (exclusive) end primary key of the range to build (or <code>null</code> to go to the end) |
488 |
| - * @return a future with the key of the first record not processed by this range rebuild |
489 |
| - * @throws RecordBuiltRangeException if the given range contains keys already processed by the index build |
490 |
| - */ |
491 |
| - @Nonnull |
492 |
| - @Deprecated(since = "3.3.443.0", forRemoval = true) |
493 |
| - public CompletableFuture<Key.Evaluated> buildUnbuiltRange(@Nonnull FDBRecordStore store, |
494 |
| - @Nullable Key.Evaluated start, |
495 |
| - @Nullable Key.Evaluated end) { |
496 |
| - return getIndexerByRecordsOrThrow().buildUnbuiltRange(store, start, end); |
497 |
| - } |
498 |
| - |
499 |
| - @VisibleForTesting |
500 |
| - @Nonnull |
501 |
| - @Deprecated(since = "3.3.443.0", forRemoval = true) |
502 |
| - CompletableFuture<Key.Evaluated> buildUnbuiltRange(@Nullable Key.Evaluated start, @Nullable Key.Evaluated end) { |
503 |
| - return getIndexerByRecordsOrThrow().buildUnbuiltRange(start, end); |
504 |
| - } |
505 |
| - |
506 | 390 | /**
|
507 | 391 | * Transactionally rebuild an entire index. This will (1) delete any data in the index that is
|
508 | 392 | * already there and (2) rebuild the entire key range for the given index. It will attempt to
|
@@ -550,45 +434,6 @@ public void mergeIndex() {
|
550 | 434 | asyncToSync(FDBStoreTimer.Waits.WAIT_ONLINE_MERGE_INDEX, mergeIndexAsync());
|
551 | 435 | }
|
552 | 436 |
|
553 |
| - /** |
554 |
| - * Builds (transactionally) the endpoints of an index. What this means is that builds everything from the beginning of |
555 |
| - * the key space to the first record and everything from the last record to the end of the key space. |
556 |
| - * There won't be any records within these ranges (except for the last record of the record store), but |
557 |
| - * it does mean that any records in the future that get added to these ranges will correctly update |
558 |
| - * the index. This means, e.g., that if the workload primarily adds records to the record store |
559 |
| - * after the current last record (because perhaps the primary key is based off of an atomic counter |
560 |
| - * or the current time), running this method will be highly contentious, but once it completes, |
561 |
| - * the rest of the index build should happen without any more conflicts. |
562 |
| - * |
563 |
| - * This will return a (possibly null) {@link TupleRange} that contains the primary keys of the |
564 |
| - * first and last records within the record store. This can then be used to either build the |
565 |
| - * range right away or to then divy-up the remaining ranges between multiple agents working |
566 |
| - * in parallel if one desires. |
567 |
| - * |
568 |
| - * @param store the record store in which to rebuild the index |
569 |
| - * @return a future that will contain the range of records in the interior of the record store |
570 |
| - */ |
571 |
| - @Nonnull |
572 |
| - @Deprecated(forRemoval = true) |
573 |
| - public CompletableFuture<TupleRange> buildEndpoints(@Nonnull FDBRecordStore store) { |
574 |
| - // endpoints only make sense in 'scan by records' mode. |
575 |
| - return getIndexerByRecordsOrThrow().buildEndpoints(store, null); |
576 |
| - } |
577 |
| - |
578 |
| - /** |
579 |
| - * Builds (with a retry loop) the endpoints of an index. See the |
580 |
| - * {@link #buildEndpoints(FDBRecordStore) buildEndpoints()} method that takes |
581 |
| - * an {@link FDBRecordStore} as its parameter for more details. This will retry on that function |
582 |
| - * until it gets a non-exceptional result and return the results back. |
583 |
| - * |
584 |
| - * @return a future that will contain the range of records in the interior of the record store |
585 |
| - */ |
586 |
| - @Nonnull |
587 |
| - @Deprecated(since = "3.3.443.0", forRemoval = true) |
588 |
| - public CompletableFuture<TupleRange> buildEndpoints() { |
589 |
| - return getIndexerByRecordsOrThrow().buildEndpoints(); |
590 |
| - } |
591 |
| - |
592 | 437 | /**
|
593 | 438 | * Stop any ongoing online index build (only if it uses {@link SynchronizedSession}s) by forcefully releasing
|
594 | 439 | * the lock.
|
@@ -695,35 +540,6 @@ public void buildIndex() {
|
695 | 540 | asyncToSync(FDBStoreTimer.Waits.WAIT_ONLINE_BUILD_INDEX, buildIndexAsync());
|
696 | 541 | }
|
697 | 542 |
|
698 |
| - @VisibleForTesting |
699 |
| - private CompletableFuture<Void> buildIndexAsyncSingleTarget() { |
700 |
| - // Testing only - enforce the old by-records indexer |
701 |
| - return indexingLauncher(() -> getIndexerByRecordsOrThrow().buildIndexAsync(true, common.config.shouldUseSynchronizedSession())); |
702 |
| - } |
703 |
| - |
704 |
| - @VisibleForTesting |
705 |
| - @Deprecated(since = "3.3.443.0", forRemoval = true) |
706 |
| - protected void buildIndexSingleTarget() { |
707 |
| - asyncToSync(FDBStoreTimer.Waits.WAIT_ONLINE_BUILD_INDEX, buildIndexAsyncSingleTarget()); |
708 |
| - } |
709 |
| - |
710 |
| - /** |
711 |
| - * Split the index build range to support building an index across multiple transactions in parallel if needed. |
712 |
| - * <p> |
713 |
| - * It is blocking and should not be called in asynchronous contexts. |
714 |
| - * |
715 |
| - * @param minSplit not split if it cannot be split into at least <code>minSplit</code> ranges |
716 |
| - * @param maxSplit the maximum number of splits generated |
717 |
| - * @return a list of split primary key ranges |
718 |
| - * @deprecated for removal to be replaced by {@linkplain IndexingMutuallyByRecords mutual indexing} |
719 |
| - */ |
720 |
| - @API(API.Status.DEPRECATED) |
721 |
| - @Deprecated(since = "3.3.443.0", forRemoval = true) |
722 |
| - @Nonnull |
723 |
| - public List<TupleRange> splitIndexBuildRange(int minSplit, int maxSplit) { |
724 |
| - return getIndexerByRecordsOrThrow().splitIndexBuildRange(minSplit, maxSplit); |
725 |
| - } |
726 |
| - |
727 | 543 | /**
|
728 | 544 | * Mark the index as readable if it is built.
|
729 | 545 | * @return a future that will complete to <code>true</code> if all the target indexes are readable or marked readable
|
|
0 commit comments