Interface IndexingStateStorage
- All Known Implementing Classes:
SqlIndexingStateStorage
public interface IndexingStateStorage
Manages indexing state persistence and fingerprint generation.
Implementations may be backed by a database (like SqlIndexingStateStorage) or
use in-memory storage (like HeapMemoryIndexingStateStorage).
-
Method Summary
Modifier and TypeMethodDescriptionintdeletePendingIndexingStatesOlderThan(long timestamp) Deletes pending indexing states older than the given timestamp.intdeleteUnusedIndexingStatesOlderThan(long timestamp) Deletes unused indexing states older than the given timestamp.Finds all indexing state fingerprints which have been marked as unused but are still referenced by some used segments.intmarkIndexingStatesAsActive(List<String> stateFingerprints) Marks indexing states as activeintmarkIndexingStatesAsUsed(List<String> stateFingerprints) Marks indexing states as used.intMarks indexing states as unused if they are not referenced by any used segments.voidupsertIndexingState(String dataSource, String fingerprint, CompactionState indexingState, org.joda.time.DateTime updateTime) Upserts an indexing state to storage.
-
Method Details
-
upsertIndexingState
void upsertIndexingState(String dataSource, String fingerprint, CompactionState indexingState, org.joda.time.DateTime updateTime) Upserts an indexing state to storage.If a fingerprint already exists, update to reflect proper used state and timestamp. If a fingerprint doesn't exist, inserts a new row with the full state payload.
- Parameters:
dataSource- The datasource namefingerprint- The fingerprint of the indexing stateindexingState- The indexing state to upsertupdateTime- The timestamp for this update
-
markUnreferencedIndexingStatesAsUnused
int markUnreferencedIndexingStatesAsUnused()Marks indexing states as unused if they are not referenced by any used segments.This is used for cleanup operations.
- Returns:
- Number of rows updated, or 0 if not applicable
-
findReferencedIndexingStateMarkedAsUnused
Finds all indexing state fingerprints which have been marked as unused but are still referenced by some used segments. This is used for validation/reconciliation. Implementations may return an empty list if not applicable.- Returns:
- List of fingerprints, or empty list
-
markIndexingStatesAsUsed
Marks indexing states as used.This is used for reconciliation operations to avoid deleting states that are still in use.
- Parameters:
stateFingerprints- List of fingerprints to mark as used- Returns:
- Number of rows updated, or 0 if not applicable
-
markIndexingStatesAsActive
Marks indexing states as active- Parameters:
stateFingerprints- List of fingerprints to mark as active- Returns:
- Number of rows updated, or 0 if not applicable
-
deletePendingIndexingStatesOlderThan
int deletePendingIndexingStatesOlderThan(long timestamp) Deletes pending indexing states older than the given timestamp.- Parameters:
timestamp- The cutoff timestamp in milliseconds- Returns:
- Number of rows deleted, or 0 if not applicable
-
deleteUnusedIndexingStatesOlderThan
int deleteUnusedIndexingStatesOlderThan(long timestamp) Deletes unused indexing states older than the given timestamp.This is used for cleanup operations.
- Parameters:
timestamp- The cutoff timestamp in milliseconds- Returns:
- Number of rows deleted, or 0 if not applicable
-