Source:
<code>public List<String> checkIndex(PairDataSet index, String indexName, KeyHashDecoder indexKeyDecoder, ExecRow indexKey, LeadingIndexColumnInfo leadingIndexColumnInfo) throws Exception { this.indexName = indexName; this.indexKeyDecoder = indexKeyDecoder; this.indexKeyTemplate = indexKey; this.leadingIndexColumnInfo = leadingIndexColumnInfo; List<String> messages = Lists.newLinkedList(); JavaFutureAction<Long> tableCountFuture = null; filteredTable = baseTable.filter(new IndexFilter<>(leadingIndexColumnInfo)).index(new KeyByRowIdFunction<>()); if (baseTableCount == 0 || leadingIndexColumnInfo != null) { SpliceSpark.pushScope(String.format("Count table %s.%s", schemaName, tableName)); tableCountFuture = ((SparkPairDataSet) filteredTable).rdd.countAsync(); SpliceSpark.popScope(); } SpliceSpark.pushScope(String.format("Count index %s.%s", schemaName, indexName)); JavaFutureAction<Long> indexCountFuture = ((SparkPairDataSet)index).rdd.countAsync(); SpliceSpark.popScope(); messages.addAll(checkMissingIndexes(filteredTable, index)); <START> messages.addAll(checkInvalidIndexes(filteredTable, index)); <END> if (tableCountFuture != null) { if (leadingIndexColumnInfo == null) { baseTableCount = tableCountFuture.get(); } else { filteredTableCount = tableCountFuture.get(); } } indexCount = indexCountFuture.get(); long count = leadingIndexColumnInfo != null ? filteredTableCount : baseTableCount; if (indexCount - invalidIndexCount > count - missingIndexCount) { messages.addAll(checkDuplicateIndexes(index)); } return messages; }</code><technical_language>I call of checkInvalidIndexes() moved rowcount table index. if rowcounts of table index checkMissingIndexes() return error, need call checkInvalidIndexes()</technical_language>

Target:
public List<String> checkIndex(PairDataSet index, String indexName, KeyHashDecoder indexKeyDecoder, ExecRow indexKey, LeadingIndexColumnInfo leadingIndexColumnInfo) throws Exception { this.indexName = indexName; this.indexKeyDecoder = indexKeyDecoder; this.indexKeyTemplate = indexKey; this.leadingIndexColumnInfo = leadingIndexColumnInfo; List<String> messages = Lists.newLinkedList(); JavaFutureAction<Long> tableCountFuture = null; filteredTable = baseTable.filter(new IndexFilter<>(leadingIndexColumnInfo)).index(new KeyByRowIdFunction<>()); if (baseTableCount == 0 || leadingIndexColumnInfo != null) { SpliceSpark.pushScope(String.format("Count table %s.%s", schemaName, tableName)); tableCountFuture = ((SparkPairDataSet) filteredTable).rdd.countAsync(); SpliceSpark.popScope(); } SpliceSpark.pushScope(String.format("Count index %s.%s", schemaName, indexName)); JavaFutureAction<Long> indexCountFuture = ((SparkPairDataSet)index).rdd.countAsync(); SpliceSpark.popScope(); messages.addAll(checkMissingIndexes(filteredTable, index)); if (tableCountFuture != null) { if (leadingIndexColumnInfo == null) { baseTableCount = tableCountFuture.get(); } else { filteredTableCount = tableCountFuture.get(); } } indexCount = indexCountFuture.get(); long tableCount = leadingIndexColumnInfo != null ? filteredTableCount : baseTableCount; if (indexCount != tableCount || missingIndexCount != 0) { messages.addAll(checkInvalidIndexes(filteredTable, index)); } if (indexCount - invalidIndexCount > tableCount - missingIndexCount) { messages.addAll(checkDuplicateIndexes(index)); } return messages; }