maedhroz commented on code in PR #2492:
URL: https://github.com/apache/cassandra/pull/2492#discussion_r1269847069
##########
src/java/org/apache/cassandra/index/SecondaryIndexManager.java:
##########
@@ -492,16 +495,100 @@ public static String getIndexName(String cfName)
}
/**
- * Performs a blocking (re)indexing/recovery of the specified SSTables for
the specified indexes.
+ * Validates all index groups against the specified SSTables.
+ *
+ * @param sstables SSTables for which indexes in the group should be built
+ * @param throwOnIncomplete whether to throw an error if any index in the
group is incomplete
+ *
+ * @return true if all indexes in all groups are complete and valid
+ * false if an index in any group is incomplete and {@code
throwOnIncomplete} is false
*
+ * @throws IllegalStateException if {@code throwOnIncomplete} is true and
an index in any group is incomplete
+ */
+ public boolean validateSSTableAttachedIndexes(Collection<SSTableReader>
sstables, boolean throwOnIncomplete)
+ {
+ boolean complete = true;
+
+ for (Index.Group group : indexGroups.values())
+ {
+ if (group.getIndexes().stream().anyMatch(Index::isSSTableAttached))
+ complete &= group.validateSSTableAttachedIndexes(sstables,
throwOnIncomplete);
+ }
+
+ return complete;
+ }
+
+ /**
+ * Incrementally builds indexes for the specified SSTables in a blocking
fashion.
+ * <p>
+ * This is similar to {@link #buildIndexesBlocking}, but it is designed to
be used in cases where failure will
+ * cascade through to failing the containing operation that actuates the
build. (ex. streaming and SSTable import)
+ * <p>
+ * It does not update index build status or queryablility on failure or
success and does not call
+ * {@link #flushIndexesBlocking(Set, FutureCallback)}, as this is an
artifact of the legacy non-SSTable-attached
+ * index implementation.
+ *
+ * @param sstables the SSTables for which indexes must be built
+ */
+ public void buildIndexesBlockingIncremental(Collection<SSTableReader>
sstables)
Review Comment:
What about `buildSSTableAttachedIndexesBlocking()`?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]