String indexName = defineCommand.getIndexName( command.getIndexNameId() ); Map<String,TransactionApplier> applierByIndex = applierByIndexMap( command ); TransactionApplier applier = applierByIndex.get( indexName );
private CommitContext commitContext( IndexCommand command ) throws ExplicitIndexNotFoundKernelException { Map<String,CommitContext> contextMap = commitContextMap( command.getEntityType() ); String indexName = definitions.getIndexName( command.getIndexNameId() ); CommitContext context = contextMap.get( indexName ); if ( context == null ) { IndexIdentifier identifier = new IndexIdentifier( IndexEntityType.byId( command.getEntityType() ), indexName ); // TODO the fact that we look up index type from config here using the index store // directly should be avoided. But how can we do it in, say recovery? // The `dataSource.getType()` call can throw an exception if the index is concurrently deleted. // To avoid bubbling an exception during commit, we instead ignore the commands related to that index, // and proceed as if the index never existed, and thus cannot accept any modifications. IndexType type = dataSource.getType( identifier, recovery ); context = new CommitContext( dataSource, identifier, type, recovery ); contextMap.put( indexName, context ); } return context; }
@Override public boolean visitIndexCreateCommand( IndexCommand.CreateCommand command ) throws IOException { indexConfigStore.setIfNecessary( IndexEntityType.byId( command.getEntityType() ).entityClass(), defineCommand.getIndexName( command.getIndexNameId() ), command.getConfig() ); return applier( command ).visitIndexCreateCommand( command ); }
String indexName = defineCommand.getIndexName( command.getIndexNameId() ); Map<String,TransactionApplier> applierByIndex = applierByIndexMap( command ); TransactionApplier applier = applierByIndex.get( indexName );
@Override public boolean visitIndexCreateCommand( IndexCommand.CreateCommand command ) throws IOException { indexConfigStore.setIfNecessary( IndexEntityType.byId( command.getEntityType() ).entityClass(), defineCommand.getIndexName( command.getIndexNameId() ), command.getConfig() ); return applier( command ).visitIndexCreateCommand( command ); }