public void apply ( Mutation mutation , boolean writeCommitLog , boolean updateIndexes ) { try ( OpOrder . Group opGroup = writeOrder . start ( ) ) { // write the mutation to the commitlog and memtables ReplayPosition replayPosition = null ; if ( writeCommitLog ) { Tracing . trace ( "Appending to commitlog" ) ; replayPosition = CommitLog . instance . add ( mutation ) ; } DecoratedKey key = StorageService . getPartitioner ( ) . decorateKey ( mutation . key ( ) ) ; for ( ColumnFamily cf : mutation . getColumnFamilies ( ) ) { ColumnFamilyStore cfs = columnFamilyStores . get ( cf . id ( ) ) ; if ( cfs == null ) { logger . error ( "Attempting to mutate non-existant column family {}" , cf . id ( ) ) ; continue ; } Tracing . trace ( "Adding to {} memtable" , cf . metadata ( ) . cfName ) ; SecondaryIndexManager . Updater updater = updateIndexes ? cfs . indexManager . updaterFor ( key , cf , opGroup ) : SecondaryIndexManager . nullUpdater ; cfs . apply ( key , cf , updater , opGroup , replayPosition ) ; } } }
This method appends a row to the global CommitLog then updates memtables and indexes .