Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 13 additions & 2 deletions src/java/org/apache/cassandra/index/SecondaryIndexManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -300,6 +300,7 @@ public Future<?> buildIndex(final Index index)
{
try
{
logger.debug("IndexBuildDecider#onInitialBuild for index {} returned {}", index.getIndexMetadata().name, IndexBuildDecider.instance.onInitialBuild());
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe add the keyspace name too?

Suggested change
logger.debug("IndexBuildDecider#onInitialBuild for index {} returned {}", index.getIndexMetadata().name, IndexBuildDecider.instance.onInitialBuild());
logger.debug("IndexBuildDecider#onInitialBuild for index {}.{} returned {}",
keyspace, index.getIndexMetadata().name, IndexBuildDecider.instance.onInitialBuild());

initialBuildTask = index.shouldSkipInitialization() ? null : index.getInitializationTask();
}
catch (Throwable t)
Expand All @@ -312,8 +313,12 @@ public Future<?> buildIndex(final Index index)
// if there's no initialization, just mark as built (if it should be queryable) and return:
if (initialBuildTask == null)
{
logger.debug("No initialization task for index [{}], assuming index is built", index.getIndexMetadata().name);
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe add the keyspace name too?

Suggested change
logger.debug("No initialization task for index [{}], assuming index is built", index.getIndexMetadata().name);
logger.debug("No initialization task for index [{}.{}], assuming index is built", keyspace.getName(), index.getIndexMetadata().name);


if (IndexBuildDecider.instance.isIndexQueryableAfterInitialBuild(baseCfs))
markIndexBuilt(index, true);
else
logger.debug("Not marking index [{}] as built because IndexBuildDecider#isIndexQueryableAfterInitialBuild returned false", index.getIndexMetadata().name);
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
logger.debug("Not marking index [{}] as built because IndexBuildDecider#isIndexQueryableAfterInitialBuild returned false", index.getIndexMetadata().name);
logger.debug("Not marking index [{}.{}] as built because IndexBuildDecider#isIndexQueryableAfterInitialBuild returned false",
keyspace.getName(), index.getIndexMetadata().name);


return Futures.immediateFuture(null);
}
Expand All @@ -332,8 +337,11 @@ public void onFailure(Throwable t)
@Override
public void onSuccess(Object o)
{
logger.debug("Initial build task completed successfully for index [{}]", index.getIndexMetadata().name);
if (IndexBuildDecider.instance.isIndexQueryableAfterInitialBuild(baseCfs))
markIndexBuilt(index, true);
else
logger.debug("Not marking index [{}] as built because IndexBuildDecider returned false", index.getIndexMetadata().name);

initialization.set(o);
}
Expand Down Expand Up @@ -853,12 +861,12 @@ private synchronized void markIndexFailed(Index index, boolean isInitialBuild)

private void logAndMarkIndexesFailed(Set<Index> indexes, Throwable indexBuildFailure, boolean isInitialBuild)
{
JVMStabilityInspector.inspectThrowable(indexBuildFailure);
if (indexBuildFailure != null)
logger.warn("Index build of {} failed. Please run full index rebuild to fix it.", Index.joinNames(indexes), indexBuildFailure);
else
logger.warn("Index build of {} failed. Please run full index rebuild to fix it.", Index.joinNames(indexes));
indexes.forEach(i -> this.markIndexFailed(i, isInitialBuild));
JVMStabilityInspector.inspectThrowable(indexBuildFailure);
}

/**
Expand Down Expand Up @@ -1923,7 +1931,10 @@ public void makeIndexNonQueryable(Index index, Index.Status status)
{
propagateLocalIndexStatus(keyspace.getName(), name, status);
if (!index.isQueryable(status))
queryableIndexes.remove(name);
{
if (queryableIndexes.remove(name))
logger.info("Index [{}] became non-queryable (status: {}))", name, status);
}
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/java/org/apache/cassandra/index/sai/IndexContext.java
Original file line number Diff line number Diff line change
Expand Up @@ -925,7 +925,7 @@ public Pair<Set<SSTableIndex>, Set<SSTableContext>> getBuiltIndexes(Collection<S
var perIndexComponents = perSSTableComponents.indexDescriptor().perIndexComponents(this);
if (!perSSTableComponents.isComplete() || !perIndexComponents.isComplete())
{
logger.debug(logMessage("An on-disk index build for SSTable {} has not completed (per-index components={})."), context.descriptor(), perIndexComponents.all());
logger.debug(logMessage("An on-disk index build for SSTable {} has not completed (per-sstable components={}, per-index components={})."), context.descriptor(), perSSTableComponents.all(), perIndexComponents.all());
return;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,8 @@ private void initialize(Set<IndexContext> indices, SSTableIndexComponentsState d
{
this.perSSTable = initializeGroup(null, discovered.perSSTableBuild());
initializeIndexes(indices, discovered);
logger.debug("Initialized IndexDescriptor for SSTable {} with per-sstable components {} and per-index components: {}",
descriptor, perSSTable, perIndexes);
}

private void initializeIndexes(Set<IndexContext> indices, SSTableIndexComponentsState discovered)
Expand Down Expand Up @@ -229,6 +231,7 @@ public IndexDescriptor reload(SSTableReader sstable, Set<IndexContext> indices)
{
Preconditions.checkArgument(sstable.getDescriptor().equals(this.descriptor));
SSTableIndexComponentsState discovered = IndexComponentDiscovery.instance().discoverComponents(sstable);
logger.debug("Discovered index components for sstable {}: {}", sstable.descriptor, discovered);

// We want to make sure the descriptor only has data for the provided `indices` on reload, so we remove any
// index data that is not in the ones provided. This essentially make sure we don't hold up memory for
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,8 @@ public Set<SSTableContext> update(Collection<SSTableReader> oldSSTables,
Collection<SSTableContext> newSSTableContexts,
boolean validate)
{
logger.debug("Updating view of index [{}]. Removed: {}. Added: {}.", context.getIndexName(), oldSSTables, newSSTableContexts);

// Valid indexes on the left and invalid SSTable contexts on the right...
// The valid indexes are referenced as a part of object initialization.
Pair<Set<SSTableIndex>, Set<SSTableContext>> indexes = context.getBuiltIndexes(newSSTableContexts, validate);
Expand Down