src/java/org/apache/cassandra/db/index/SecondaryIndex.java
/**
     * Builds the index using the data in the underlying CF, non blocking
     * 
     * 
     * @return A future object which the caller can block on (optional)
     */
Builds the index using the data in the underlying CF, non blocking

@return A future object which the caller can block on (optional)
Builds the index using the data in the underlying CF non blocking @return A future object which the caller can block on ( optional )
public Future<?> buildIndexAsync()
    {
        boolean allAreBuilt = true;
        for (ColumnDefinition cdef : columnDefs)
        {
            if (!SystemTable.isIndexBuilt(baseCfs.table.name, getNameForSystemTable(cdef.name)))
            {
                allAreBuilt = false;
                break;
            }
        }
        if (allAreBuilt)
            return null;
        Runnable runnable = new Runnable()
        {
            public void run()
            {
                try
                {
                    baseCfs.forceBlockingFlush();
                }
                catch (ExecutionException e)
                {
                    throw new RuntimeException(e);
                }
                catch (InterruptedException e)
                {
                    throw new AssertionError(e);
                }
                try
                {
                    buildIndexBlocking();
                } 
                catch (IOException e)
                {
                    throw new RuntimeException(e);
                }
            }
        };
        FutureTask<?> f = new FutureTask<Object>(runnable, null);
        new Thread(f, "Creating index: " + getIndexName()).start();
        return f;
    }
public Future < ? > buildIndexAsync ( ) { boolean allAreBuilt = true ; for ( ColumnDefinition cdef : columnDefs ) { if ( ! SystemTable . isIndexBuilt ( baseCfs . table . name , getNameForSystemTable ( cdef . name ) ) ) { allAreBuilt = false ; break ; } } if ( allAreBuilt ) return null ; Runnable runnable = new Runnable ( ) { public void run ( ) { try { baseCfs . forceBlockingFlush ( ) ; } catch ( ExecutionException e ) { throw new RuntimeException ( e ) ; } catch ( InterruptedException e ) { throw new AssertionError ( e ) ; } try { buildIndexBlocking ( ) ; } catch ( IOException e ) { throw new RuntimeException ( e ) ; } } } ; FutureTask < ? > f = new FutureTask < Object > ( runnable , null ) ; new Thread ( f , "Creating index: " + getIndexName ( ) ) . start ( ) ; return f ; }
Builds the index using the data in the underlying CF, non blocking
Builds the index using the data in the underlying CF non blocking
// if we're just linking in the index to indexedColumns on an already-built index post-restart, we're done // build it asynchronously; addIndex gets called by CFS open and schema update, neither of which // we want to block for a long period.  (actual build is serialized on CompactionManager.)