Ensures that family delete markers are present in the columns requested for any scan operation.
@param scan The original scan request
@return The modified scan request with the family delete qualifiers represented
961199
private Scan projectFamilyDeletes(Scan scan) {
    for (Map.Entry<byte[], NavigableSet<byte[]>> entry : scan.getFamilyMap().entrySet()) {
      NavigableSet<byte[]> columns = entry.getValue();
      // wildcard scans will automatically include the delete marker, so only need to add it when we have
      // explicit columns listed
      if (columns != null && !columns.isEmpty()) {
        scan.addColumn(entry.getKey(), TxConstants.FAMILY_DELETE_QUALIFIER);
      }
    }
    return scan;
  }
298342
public List<Scan<Beans<T>>> getAllScan()
   {
      List<Scan<Beans<T>>> list = new ArrayList<Scan<Beans<T>>>();
      List<Node> nodeList = childNode.get("scan");
      for(Node node: nodeList)
      {
         Scan<Beans<T>>  type = new ScanImpl<Beans<T>>(this, "scan", childNode, node);
         list.add(type);
      }
      return list;
   }
745976
@Override
    void setScanResult(final ScanResult scanResult) {
        super.setScanResult(scanResult);
        if (this.typeDescriptor != null) {
            this.typeDescriptor.setScanResult(scanResult);
        }
        if (this.typeSignature != null) {
            this.typeSignature.setScanResult(scanResult);
        }
        if (this.annotationInfo != null) {
            for (final AnnotationInfo ai : this.annotationInfo) {
                ai.setScanResult(scanResult);
            }
        }
        if (this.parameterAnnotationInfo != null) {
            for (final AnnotationInfo[] pai : this.parameterAnnotationInfo) {
                if (pai != null) {
                    for (final AnnotationInfo ai : pai) {
                        ai.setScanResult(scanResult);
                    }
                }
            }
        }
        if (this.parameterInfo != null) {
            for (final MethodParameterInfo mpi : parameterInfo) {
                mpi.setScanResult(scanResult);
            }
        }
    }
385688
static private boolean deleteIsTruncate(ParsedDeleteStmt stmt, AbstractPlanNode plan) {
        if (!(plan instanceof SeqScanPlanNode)) {
            return false;
        }

        // Assume all index scans have filters in this context, so only consider seq scans.
        SeqScanPlanNode seqScanNode = (SeqScanPlanNode)plan;
        if (seqScanNode.getPredicate() != null) {
            return false;
        }

        if (stmt.hasLimitOrOffset()) {
            return false;
        }

        return true;
    }
198068
private void cancelScan() {
        if (rescanIncompleteTask != null) {
            rescanIncompleteTask.cancel(true);
            rescanIncompleteTask = null;
        }
        if (rescanUndeployTask != null) {
            rescanUndeployTask.cancel(true);
            rescanUndeployTask = null;
        }
        if (scanTask != null) {
            scanTask.cancel(true);
            scanTask = null;
        }
    }
54566
@Override
    void setScanResult(final ScanResult scanResult) {
        super.setScanResult(scanResult);
        if (typeParameters != null) {
            for (final TypeParameter typeParameter : typeParameters) {
                typeParameter.setScanResult(scanResult);
            }
        }
        if (this.superclassSignature != null) {
            this.superclassSignature.setScanResult(scanResult);
        }
        if (superinterfaceSignatures != null) {
            for (final ClassRefTypeSignature classRefTypeSignature : superinterfaceSignatures) {
                classRefTypeSignature.setScanResult(scanResult);
            }
        }
    }
403622
@Override
    public Iterator<MultiTableScanResult> multiTableScan(final MultiTableScanOptions query, final TableSet tables,
                                                         final LimitCounter limit, final ReadConsistency consistency, @Nullable Instant cutoffTime) {
        checkNotNull(query, "query");
        String placementName = checkNotNull(query.getPlacement(), "placement");
        final DeltaPlacement placement = (DeltaPlacement) _placementCache.get(placementName);

        ScanRange scanRange = Objects.firstNonNull(query.getScanRange(), ScanRange.all());

        // Since the range may wrap from high to low end of the token range we need to unwrap it
        List<ScanRange> ranges = scanRange.unwrapped();

        return touch(FluentIterable.from(ranges)
                .transformAndConcat(new Function<ScanRange, Iterable<MultiTableScanResult>>() {
                    @Override
                    public Iterable<MultiTableScanResult> apply(final ScanRange rowRange) {
                        return new Iterable<MultiTableScanResult>() {
                            @Override
                            public Iterator<MultiTableScanResult> iterator() {
                                return scanMultiTableRows(
                                        tables, placement, rowRange.asByteBufferRange(), limit, query.isIncludeDeletedTables(),
                                        query.isIncludeMirrorTables(), _maxColumnsRange.getLimit(), consistency, cutoffTime);
                            }
                        };
                    }
                })
                .iterator());

    }
915743
@Override
    void setScanResult(final ScanResult scanResult) {
        super.setScanResult(scanResult);
        if (elementTypeSignature != null) {
            elementTypeSignature.setScanResult(scanResult);
        }
    }
569678
private boolean asyncRangeScan(ScanRangeTask task) {
        final String scanId = task.getScanId();
        final int taskId = task.getId();
        final String placement = task.getPlacement();
        final ScanRange range = task.getRange();
        RangeScanUploaderResult result;

        try {
            // Verify that this range hasn't already been completed (protect against queue re-posts)
            ScanStatus status = _scanStatusDAO.getScanStatus(scanId);

            if (status.isCanceled()) {
                _log.info("Ignoring scan range from canceled task: [task={}]", task);
                return true;
            }

            ScanRangeStatus completedStatus = Iterables.getOnlyElement(
                    Iterables.filter(status.getCompleteScanRanges(), new Predicate<ScanRangeStatus>() {
                        @Override
                        public boolean apply(ScanRangeStatus rangeStatus) {
                            return rangeStatus.getTaskId() == taskId;
                        }
                    }), null);

            if (completedStatus != null) {
                _log.info("Ignoring duplicate post of completed scan range task: [task={}, completeTime={}]",
                        task, completedStatus.getScanCompleteTime());
                return true;
            }

            _log.info("Started scan range task: {}", task);

            _scanStatusDAO.setScanRangeTaskActive(scanId, taskId, new Date());

            // Perform the range scan
            result = _rangeScanUploader.scanAndUpload(scanId, taskId, status.getOptions(), placement, range, status.getCompactionControlTime());

            _log.info("Completed scan range task: {}", task);
        } catch (Throwable t) {
            _log.error("Scan range task failed: {}", task, t);
            result = RangeScanUploaderResult.failure();
        }

        try {
            switch (result.getStatus()) {
                case SUCCESS:
                    _scanStatusDAO.setScanRangeTaskComplete(scanId, taskId, new Date());
                    break;
                case FAILURE:
                    _scanStatusDAO.setScanRangeTaskInactive(scanId, taskId);
                    break;
                case REPSPLIT:
                    // The portion of the range up to the resplit is what was completed.
                    //noinspection ConstantConditions
                    ScanRange completedRange = ScanRange.create(range.getFrom(), result.getResplitRange().getFrom());
                    _scanStatusDAO.setScanRangeTaskPartiallyComplete(scanId, taskId, completedRange, result.getResplitRange(), new Date());
                    break;
            }
        } catch (Throwable t) {
            _log.error("Failed to mark scan range result: [id={}, placement={}, range={}, result={}]",
                    scanId, placement, range, result, t);

            // Since the scan result wasn't marked the leader will not have an accurate view of the state.
            return false;
        }

        return true;
    }
503139
public void deleteColumnFamily() {
    System.out.println("\nDelete column family: " + COLUMN_FAMILY_2);
    // [START bigtable_delete_family]
    // Deletes a column family.
    try {
      ModifyColumnFamiliesRequest deleted =
          ModifyColumnFamiliesRequest.of(tableId).dropFamily(COLUMN_FAMILY_2);
      adminClient.modifyFamilies(deleted);
      System.out.printf("Column family %s deleted successfully%n", COLUMN_FAMILY_2);
    } catch (NotFoundException e) {
      System.err.println("Failed to delete a non-existent column family: " + e.getMessage());
    }
    // [END bigtable_delete_family]
  }
643533
public List<SuggestedFix> drive(Scanner scanner, Pattern includeFilePattern) {
    JsFlumeCallback callback = new JsFlumeCallback(scanner, includeFilePattern);
    NodeTraversal.traverse(compiler, rootNode, callback);
    List<SuggestedFix> fixes = callback.getFixes();
    fixes.addAll(scanner.processAllMatches(callback.getMatches()));
    return fixes;
  }
424534
public static DeleteRequest checkRequest(final HttpServletRequest request,
			final DeleteResponse deleteResponse) {
		final DeleteRequestType type = checkType(request, deleteResponse);
		if (type != null) {
			return new DeleteRequest(type);
		}

		return null;
	}
903131
public boolean isInSubset(IScan scan) {
    int num = scan.getNum();
    if (scanNumLo != null) {
      if (num < scanNumLo) {
        return false;
      }
    }
    if (scanNumHi != null) {
      if (num > scanNumHi) {
        return false;
      }
    }
    Integer msLevel = scan.getMsLevel();
    if (msLvls != null) {
      if (!msLvls.contains(msLevel)) {
        return false;
      }
    }
    DoubleRange range;
    if (mzRanges != null) {
      if (msLevel == 1) {
        if (scan.getScanMzWindowLower() == null || scan.getScanMzWindowUpper() == null) {
          throw new IllegalStateException(String.format(
              "Could not check if scan #%d (MS%d) is in LCMSDataSubset, as lower/upper m/z range was not present in the scan.",
              num, msLevel));
        }
        range = new DoubleRange(scan.getScanMzWindowLower(), scan.getScanMzWindowUpper());

      } else {
        if (scan.getPrecursor() == null) {
          throw new IllegalStateException(String.format(
              "Could not check if scan #%d (MS%d) is in LCMSDataSubset, as precursor info was not present in the scan.",
              num, msLevel));
        }
        range = new DoubleRange(scan.getPrecursor().getMzRangeStart(),
            scan.getPrecursor().getMzRangeEnd());
      }
      for (DoubleRange listedRange : mzRanges) {
        if (range.overlapRelative(listedRange) < IScanCollection.MIN_GROUP_OVERLAP) {
          return false;
        }
      }
    }
    return true;
  }
308015
public int delete(Request request)
    {
        DeleteResponse response = executeRequest(request,objectMapper.getTypeFactory().constructType(
                DeleteResponse.class));
        return response.getCount();
    }
55386
public Scan getResultScan(String tableName, String famName,
             ByteBuffer startKey, ByteBuffer endKey) throws IOException {
	 logger.debug("AbstractHBaseUtils Begin of getResultScan(" + tableName + ", " + famName + ")");
         Scan scan = new Scan();
         scan.addFamily(Bytes.toBytes(famName));
         // For a range scan, set start / stop id or just start.
         if (startKey != null)
             scan.setStartRow(Bytes.toBytes(startKey));
         if (endKey != null)
             scan.setStopRow(Bytes.toBytes(endKey));
         return scan;
     }
1339901
@SuppressWarnings("rawtypes")
    private boolean getOrReplaceAllIndices(final Object request, final IndicesProvider provider, boolean allowEmptyIndices) {

        if(log.isTraceEnabled()) {
            log.trace("getOrReplaceAllIndices() for "+request.getClass());
        }

        boolean result = true;

        if (request instanceof BulkRequest) {

            for (DocWriteRequest ar : ((BulkRequest) request).requests()) {
                result = getOrReplaceAllIndices(ar, provider, false) && result;
            }

        } else if (request instanceof MultiGetRequest) {

            for (ListIterator<Item> it = ((MultiGetRequest) request).getItems().listIterator(); it.hasNext();){
                Item item = it.next();
                result = getOrReplaceAllIndices(item, provider, false) && result;
                /*if(item.index() == null || item.indices() == null || item.indices().length == 0) {
                    it.remove();
                }*/
            }

        } else if (request instanceof MultiSearchRequest) {

            for (ListIterator<SearchRequest> it = ((MultiSearchRequest) request).requests().listIterator(); it.hasNext();) {
                SearchRequest ar = it.next();
                result = getOrReplaceAllIndices(ar, provider, false) && result;
                /*if(ar.indices() == null || ar.indices().length == 0) {
                    it.remove();
                }*/
            }

        } else if (request instanceof MultiTermVectorsRequest) {

            for (ActionRequest ar : (Iterable<TermVectorsRequest>) () -> ((MultiTermVectorsRequest) request).iterator()) {
                result = getOrReplaceAllIndices(ar, provider, false) && result;
            }

        } else if(request instanceof PutMappingRequest) {
            PutMappingRequest pmr = (PutMappingRequest) request;
            Index concreteIndex = pmr.getConcreteIndex();
            if(concreteIndex != null && (pmr.indices() == null || pmr.indices().length == 0)) {
                String[] newIndices = provider.provide(new String[]{concreteIndex.getName()}, request, true);
                if(checkIndices(request, newIndices, true, allowEmptyIndices) == false) {
                    return false;
                }
                
                ((PutMappingRequest) request).indices(newIndices);
                ((PutMappingRequest) request).setConcreteIndex(null);
            } else {
                String[] newIndices = provider.provide(((PutMappingRequest) request).indices(), request, true);
                if(checkIndices(request, newIndices, false, allowEmptyIndices) == false) {
                    return false;
                }
                ((PutMappingRequest) request).indices(newIndices);
            }
        } else if(request instanceof RestoreSnapshotRequest) {
            
                if(clusterInfoHolder.isLocalNodeElectedMaster() == Boolean.FALSE) {
                    return true;
                }      

                final RestoreSnapshotRequest restoreRequest = (RestoreSnapshotRequest) request;
                final SnapshotInfo snapshotInfo = SnapshotRestoreHelper.getSnapshotInfo(restoreRequest);

                if (snapshotInfo == null) {
                    log.warn("snapshot repository '" + restoreRequest.repository() + "', snapshot '" + restoreRequest.snapshot() + "' not found");
                    provider.provide(new String[]{"*"}, request, false);
                } else {
                    final List<String> requestedResolvedIndices = SnapshotUtils.filterIndices(snapshotInfo.indices(), restoreRequest.indices(), restoreRequest.indicesOptions());
                    final List<String> renamedTargetIndices = renamedIndices(restoreRequest, requestedResolvedIndices);
                    //final Set<String> indices = new HashSet<>(requestedResolvedIndices);
                    //indices.addAll(renamedTargetIndices);
                    if(log.isDebugEnabled()) {
                        log.debug("snapshot: {} contains this indices: {}", snapshotInfo.snapshotId().getName(), renamedTargetIndices);
                    }
                    provider.provide(renamedTargetIndices.toArray(new String[0]), request, false);
                }

        } else if (request instanceof IndicesAliasesRequest) {
            for(AliasActions ar: ((IndicesAliasesRequest) request).getAliasActions()) {
                result = getOrReplaceAllIndices(ar, provider, false) && result;
            }
        } else if (request instanceof DeleteRequest) {
            String[] newIndices = provider.provide(((DeleteRequest) request).indices(), request, true);
            if(checkIndices(request, newIndices, true, allowEmptyIndices) == false) {
                return false;
            }
            ((DeleteRequest) request).index(newIndices.length!=1?null:newIndices[0]);
        } else if (request instanceof UpdateRequest) {
            String[] newIndices = provider.provide(((UpdateRequest) request).indices(), request, true);
            if(checkIndices(request, newIndices, true, allowEmptyIndices) == false) {
                return false;
            }
            ((UpdateRequest) request).index(newIndices.length!=1?null:newIndices[0]);
        } else if (request instanceof SingleShardRequest) {
            final SingleShardRequest<?> gr = (SingleShardRequest<?>) request;
            final String[] indices = gr.indices();
            final String index = gr.index();

            final List<String> indicesL = new ArrayList<String>();

            if (index != null) {
                indicesL.add(index);
            }

            if (indices != null && indices.length > 0) {
                indicesL.addAll(Arrays.asList(indices));
            }

            String[] newIndices = provider.provide(indicesL.toArray(new String[0]), request, true);
            if(checkIndices(request, newIndices, true, allowEmptyIndices) == false) {
                return false;
            }
            ((SingleShardRequest) request).index(newIndices.length!=1?null:newIndices[0]);
        } else if (request instanceof IndexRequest) {
            String[] newIndices = provider.provide(((IndexRequest) request).indices(), request, true);
            if(checkIndices(request, newIndices, true, allowEmptyIndices) == false) {
                return false;
            }
            ((IndexRequest) request).index(newIndices.length!=1?null:newIndices[0]);
        } else if (request instanceof Replaceable) {
            String[] newIndices = provider.provide(((Replaceable) request).indices(), request, true);
            if(checkIndices(request, newIndices, false, allowEmptyIndices) == false) {
                return false;
            }
            ((Replaceable) request).indices(newIndices);
        } else if (request instanceof BulkShardRequest) {
            provider.provide(((ReplicationRequest) request).indices(), request, false);
            //replace not supported?
        } else if (request instanceof ReplicationRequest) {
            String[] newIndices = provider.provide(((ReplicationRequest) request).indices(), request, true);
            if(checkIndices(request, newIndices, true, allowEmptyIndices) == false) {
                return false;
            }
            ((ReplicationRequest) request).index(newIndices.length!=1?null:newIndices[0]);
        } else if (request instanceof MultiGetRequest.Item) {
            String[] newIndices = provider.provide(((MultiGetRequest.Item) request).indices(), request, true);
            if(checkIndices(request, newIndices, true, allowEmptyIndices) == false) {
                return false;
            }
            ((MultiGetRequest.Item) request).index(newIndices.length!=1?null:newIndices[0]);
        } else if (request instanceof CreateIndexRequest) {
            String[] newIndices = provider.provide(((CreateIndexRequest) request).indices(), request, true);
            if(checkIndices(request, newIndices, true, allowEmptyIndices) == false) {
                return false;
            }
            ((CreateIndexRequest) request).index(newIndices.length!=1?null:newIndices[0]);
        } else if (request instanceof ReindexRequest) {
            result = getOrReplaceAllIndices(((ReindexRequest) request).getDestination(), provider, false) && result;
            result = getOrReplaceAllIndices(((ReindexRequest) request).getSearchRequest(), provider, false) && result;
        } else if (request instanceof BaseNodesRequest) {
            //do nothing
        } else if (request instanceof MainRequest) {
            //do nothing
        } else if (request instanceof ClearScrollRequest) {
            //do nothing
        } else if (request instanceof SearchScrollRequest) {
            //do nothing
        } else {
            if(log.isDebugEnabled()) {
                log.debug(request.getClass() + " not supported (It is likely not a indices related request)");
            }
            result = false;
        }

        return result;
    }
1336644
private AnnotationBulkDelete parseBulkDeleteQS(final HttpQuery query) {
    final AnnotationBulkDelete settings = new AnnotationBulkDelete();
    settings.start_time = query.getRequiredQueryStringParam("start_time");
    settings.end_time = query.getQueryStringParam("end_time");
    
    if (query.hasQueryStringParam("tsuids")) {
      String[] tsuids = query.getQueryStringParam("tsuids").split(",");
      settings.tsuids = new ArrayList<String>(tsuids.length);
      for (String tsuid : tsuids) {
        settings.tsuids.add(tsuid.trim());
      }
    }
    
    if (query.hasQueryStringParam("global")) {
      settings.global = true;
    }
    return settings;
  }