@Override protected PrimaryResult shardOperationOnPrimary(ShardRebuildRequest shardRequest, IndexShard primary) throws IOException { IndexService indexService = indicesService.indexServiceSafe(shardRequest.shardId().getIndex()); List<String> tables = new ArrayList<String>(); List<String> indexes = new ArrayList<String>(); MetaData metaData = clusterService.state().metaData(); IndexMetaData indexMetaData = metaData.index(shardRequest.shardId().getIndex()); String secondaryIndexClass = indexMetaData.getSettings().get(IndexMetaData.SETTING_SECONDARY_INDEX_CLASS, metaData.settings().get(org.elasticsearch.cluster.service.ClusterService.SETTING_CLUSTER_SECONDARY_INDEX_CLASS, org.elasticsearch.cluster.service.ClusterService.defaultSecondaryIndexClass.getName())); for(ObjectCursor<MappingMetaData> it : indexMetaData.getMappings().values()) { MappingMetaData mapping = it.value; String table = org.elasticsearch.cluster.service.ClusterService.typeToCfName(mapping.type()); tables.add(table); CFMetaData cfMetadata = org.elasticsearch.cluster.service.ClusterService.getCFMetaData(indexService.keyspace(), table); for(IndexMetadata index : cfMetadata.getIndexes()) { if (index.isCustom() && secondaryIndexClass.equals(index.options.get("class_name"))) { indexes.add(index.name); break; } } } // Cassandra flush and rebuild_index for all mapped tables. StorageService.instance.forceKeyspaceFlush(indexService.keyspace(), tables.toArray(new String[tables.size()])); for(int i=0; i < tables.size(); i++) StorageService.instance.rebuildSecondaryIndex(shardRequest.getRequest().numThreads(), indexService.keyspace(), tables.get(i), indexes.get(i)); logger.trace("index=[{}] rebuild request executed on keyspace=[{}] tables={} with numThreads={}", shardRequest.shardId().getIndex(), indexService.mapperService().keyspace(), tables, shardRequest.getRequest().numThreads()); return new PrimaryResult(shardRequest, new ReplicationResponse()); }
StorageService.instance.forceKeyspaceFlush(cfs.keyspace.getName(), cfs.name);
StorageService.instance.forceKeyspaceFlush(cfs.keyspace.getName(), cfs.name); sstables = getSSTablesToValidate(cfs, validator); if (sstables == null)
StorageService.instance.forceKeyspaceFlush(cfs.keyspace.getName(), cfs.name); sstables = getSSTablesToValidate(cfs, validator); if (sstables == null)
StorageService.instance.forceKeyspaceFlush(cfs.keyspace.getName(), cfs.name); sstables = getSSTablesToValidate(cfs, validator); if (sstables == null)
Assert.assertEquals(0, countResults("sample_table", "part=0", true)); StorageService.instance.forceKeyspaceFlush(keyspace.toLowerCase(), "sample_table"); StorageService.instance.forceKeyspaceCleanup(keyspace.toLowerCase(), "sample_table"); StorageService.instance.forceKeyspaceCompaction(keyspace.toLowerCase(), "sample_table");