private PrimitiveLongIterator filterIndexStateChanges(
      KernelStatement state, IndexDescriptor index, Object value, PrimitiveLongIterator nodeIds) {
    if (state.hasTxStateWithChanges()) {
      ReadableDiffSets<Long> labelPropertyChanges = state.txState().indexUpdates(index, value);
      ReadableDiffSets<Long> nodes = state.txState().addedAndRemovedNodes();

      // Apply to actual index lookup
      return nodes.augmentWithRemovals(labelPropertyChanges.augment(nodeIds));
    }
    return nodeIds;
  }
 private boolean checkIndexState(
     IndexDescriptor indexRule, ReadableDiffSets<IndexDescriptor> diffSet)
     throws IndexNotFoundKernelException {
   if (diffSet.isAdded(indexRule)) {
     return true;
   }
   if (diffSet.isRemoved(indexRule)) {
     throw new IndexNotFoundKernelException(
         String.format(
             "Index for label id %d on property id %d has been " + "dropped in this transaction.",
             indexRule.getLabelId(), indexRule.getPropertyKeyId()));
   }
   return false;
 }