Buggy code:
public class EntityCollectionManagerImpl implements EntityCollectionManager { private static final Logger logger = LoggerFactory . getLogger ( EntityCollectionManagerImpl . class ) ; private final CollectionScope collectionScope ; private final WriteStart writeStart ; private final WriteStart writeUpdate ; private final WriteUniqueVerify writeVerifyUnique ; private final WriteOptimisticVerify writeOptimisticVerify ; private final WriteCommit writeCommit ; private final RollbackAction rollback ; private final MarkStart markStart ; private final MarkCommit markCommit ; private final MvccLogEntrySerializationStrategy mvccLogEntrySerializationStrategy ; private final MvccEntitySerializationStrategy entitySerializationStrategy ; private final UniqueValueSerializationStrategy uniqueValueSerializationStrategy ; private final EntityVersionCleanupFactory entityVersionCleanupFactory ; private final EntityVersionCreatedFactory entityVersionCreatedFactory ; private final EntityDeletedFactory entityDeletedFactory ; private final TaskExecutor taskExecutor ; private final Keyspace keyspace ; @ Inject public EntityCollectionManagerImpl ( @ Write final WriteStart writeStart , @ WriteUpdate final WriteStart writeUpdate , final WriteUniqueVerify writeVerifyUnique , final WriteOptimisticVerify writeOptimisticVerify , final WriteCommit writeCommit , final RollbackAction rollback , final MarkStart markStart , final MarkCommit markCommit , @ ProxyImpl final MvccEntitySerializationStrategy entitySerializationStrategy , final UniqueValueSerializationStrategy uniqueValueSerializationStrategy , final MvccLogEntrySerializationStrategy mvccLogEntrySerializationStrategy , final Keyspace keyspace , final EntityVersionCleanupFactory entityVersionCleanupFactory , final EntityVersionCreatedFactory entityVersionCreatedFactory , final EntityDeletedFactory entityDeletedFactory , @ CollectionTaskExecutor final TaskExecutor taskExecutor , @ Assisted final CollectionScope collectionScope ) { } @ Override public Observable < Entity > write ( final Entity entity ) { } @ Override public Observable < Id > delete ( final Id entityId ) { } @ Override public Observable < Entity > load ( final Id entityId ) { } @ Override public Observable < EntitySet > load ( final Collection < Id > entityIds ) { } @ Override public Observable < Id > getIdField ( final Field field ) { } @ Override public Observable < FieldSet > getAllEntities ( final Collection < Field > fields ) { return rx . Observable . just ( fields ) . map ( new rx . functions . Func1 < Collection < Field > , FieldSet > ( ) { @ Override public FieldSet call ( Collection < Field > fields ) { try { final UUID startTime = UUIDGenerator . newTimeUUID ( ) ; UniqueValueSet set = uniqueValueSerializationStrategy . load ( collectionScope , fields ) ; List < Id > entityIds = new java . util . ArrayList ( fields . size ( ) ) ; List < UniqueValue > uniqueValues = new java . util . ArrayList ( fields . size ( ) ) ; for ( final Field expectedField : fields ) { UniqueValue value = set . getValue ( expectedField . getName ( ) ) ; entityIds . add ( value . getEntityId ( ) ) ; uniqueValues . add ( value ) ; } final EntitySet entitySet = entitySerializationStrategy . load ( collectionScope , entityIds , startTime ) ; final MutationBatch deleteBatch = keyspace . prepareMutationBatch ( ) ; final FieldSetImpl response = new FieldSetImpl ( fields . size ( ) ) ; for ( final UniqueValue expectedUnique : uniqueValues ) { final MvccEntity entity = entitySet . getEntity ( expectedUnique . getEntityId ( ) ) ; if ( ( entity == null ) || ( ! ( entity . getEntity ( ) . isPresent ( ) ) ) ) { final MutationBatch valueDelete = uniqueValueSerializationStrategy . delete ( collectionScope , expectedUnique ) ; deleteBatch . mergeShallow ( valueDelete ) ; continue ; } response . addEntity ( expectedUnique . getField ( ) , entity ) ; } <START_BUG> deleteBatch . executeAsync ( ) ; <END_BUG> return response ; } catch ( ConnectionException e ) { EntityCollectionManagerImpl . logger . error ( "Failed<seq2seq4repair_space>to<seq2seq4repair_space>getIdField" , e ) ; throw new RuntimeException ( e ) ; } } } ) ; } @ Override public Observable < Entity > update ( final Entity entity ) { } public Observable < CollectionIoEvent < MvccEntity > > stageRunner ( CollectionIoEvent < Entity > writeData , WriteStart writeState ) { } @ Override public Observable < VersionSet > getLatestVersion ( final Collection < Id > entityIds ) { } @ Override public Health getHealth ( ) { } }

Fix:
deleteBatch . execute ( ) ;