Class IndexBuildState
- java.lang.Object
-
- com.apple.foundationdb.record.provider.foundationdb.IndexBuildState
-
@API(UNSTABLE) public class IndexBuildState extends Object
A class that contains the build progress of a given index in a given record store.It first contains
IndexState
. If the state isIndexState.WRITE_ONLY
, it will also contain the number of records scanned and the estimated total number of records that need to be scanned.Note that index build state (especially records scanned) serves an informational purpose only as the number of records scanned is not necessarily 100% of records in total when the index build completes for several reasons:
- If the
OnlineIndexer
has been configured to disable tracking progress (by settingOnlineIndexer.Builder.setTrackProgress(boolean)
tofalse
), thengetRecordsScanned()
will not include the records scanned by thatOnlineIndexer
. - Records added or deleted during the index build progress are not included in records scanned but are in records in total.
- Records in total uses the number of all records in the store. In some cases, the real number of records that need to be scanned is less than this.
- If the
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
equals(Object o)
IndexState
getIndexState()
Get the index state.Long
getRecordsInTotal()
Get the estimated total number of records that need to be scanned to build the index.Long
getRecordsScanned()
Get the number of records successfully scanned and processed during the online index build process.int
hashCode()
static CompletableFuture<IndexBuildState>
loadIndexBuildStateAsync(FDBRecordStoreBase<?> store, Index index)
Load the build progress (IndexBuildState
) of the given index in the given record store asynchronously.static CompletableFuture<Long>
loadRecordsScannedAsync(FDBRecordStoreBase<?> store, Index index)
Load the number of records successfully scanned and processed during the online index build process asynchronously.String
toString()
-
-
-
Method Detail
-
loadIndexBuildStateAsync
@Nonnull public static CompletableFuture<IndexBuildState> loadIndexBuildStateAsync(FDBRecordStoreBase<?> store, Index index)
Load the build progress (IndexBuildState
) of the given index in the given record store asynchronously.- Parameters:
store
- the record store containing the indexindex
- the index needed to be checked- Returns:
- a future that completes to the index build state
-
loadRecordsScannedAsync
@Nonnull public static CompletableFuture<Long> loadRecordsScannedAsync(FDBRecordStoreBase<?> store, Index index)
Load the number of records successfully scanned and processed during the online index build process asynchronously.If the
OnlineIndexer
has been configured to disable tracking progress (by settingOnlineIndexer.Builder.setTrackProgress(boolean)
tofalse
), then the number returned will not include the records scanned by thatOnlineIndexer
.- Parameters:
store
- the record store containing the indexindex
- the index needed to be checked- Returns:
- a future that completes to the total records scanned
-
getIndexState
@Nonnull public IndexState getIndexState()
Get the index state.- Returns:
- the index state
-
getRecordsScanned
@Nullable public Long getRecordsScanned()
Get the number of records successfully scanned and processed during the online index build process.If the
OnlineIndexer
has been configured to disable tracking progress (by settingOnlineIndexer.Builder.setTrackProgress(boolean)
tofalse
), then the number returned will not include the records scanned by thatOnlineIndexer
.The returned value should be ignored if the index state is not
IndexState.WRITE_ONLY
.See
IndexBuildState
if this is used withgetRecordsInTotal()
to track the index build progress.- Returns:
- the number of scanned records
- See Also:
loadRecordsScannedAsync(FDBRecordStoreBase, Index)
-
getRecordsInTotal
@Nullable public Long getRecordsInTotal()
Get the estimated total number of records that need to be scanned to build the index. Currently, it uses the number of all records in the store. In some cases, the real number of records that need to be scanned is less than this.To get the count, there must be a suitably grouped
COUNT
type index defined. Otherwise, it returnsnull
.The returned value should be ignored if the index state is not
IndexState.WRITE_ONLY
.- Returns:
- the number of total records
-
-