public static void main()

in src/main/java/org/apache/accumulo/testing/continuous/UndefinedAnalyzer.java [250:327]


  public static void main(String[] args) throws Exception {
    Opts opts = new Opts();
    opts.parseArgs(UndefinedAnalyzer.class.getName(), args);

    List<UndefinedNode> undefs = new ArrayList<>();

    try (BufferedReader reader = new BufferedReader(new InputStreamReader(System.in, UTF_8))) {
      String line;
      while ((line = reader.readLine()) != null) {
        String[] tokens = line.split("\\s");
        String undef = tokens[0];
        String ref = tokens[1];

        undefs.add(new UndefinedNode(undef, ref));
      }
    }

    try (AccumuloClient client = Accumulo.newClient().from(opts.getClientProps()).build();
        BatchScanner bscanner = client.createBatchScanner(opts.tableName, opts.auths)) {

      List<Range> refs = undefs.stream().map(node -> node.ref).map(Text::new).map(Range::new)
          .collect(Collectors.toList());

      bscanner.setRanges(refs);

      HashMap<String,List<String>> refInfo = new HashMap<>();

      for (Entry<Key,Value> entry : bscanner) {
        String ref = entry.getKey().getRow().toString();
        List<String> vals = refInfo.computeIfAbsent(ref, k -> new ArrayList<>());
        vals.add(entry.getValue().toString());
      }

      IngestInfo ingestInfo = new IngestInfo(opts.logDir);
      String tableId = client.tableOperations().tableIdMap().get(opts.tableName);
      TabletHistory tabletHistory = new TabletHistory(tableId, opts.logDir);

      SimpleDateFormat sdf = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss");

      for (UndefinedNode undefinedNode : undefs) {

        List<String> refVals = refInfo.get(undefinedNode.ref);
        if (refVals != null) {
          refVals.stream().map(refVal -> refVal.split(":")).forEach(tokens -> {
            TabletAssignment ta = null;

            String uuid = tokens[0];
            String count = tokens[1];

            String t1 = "";
            String t2 = "";

            Iterator<Long> times = ingestInfo.getTimes(uuid, Long.parseLong(count, 16));
            if (times != null) {
              if (times.hasNext()) {
                long time2 = times.next();
                t2 = sdf.format(new Date(time2));
                if (times.hasNext()) {
                  long time1 = times.next();
                  t1 = sdf.format(new Date(time1));
                  ta = tabletHistory.findMostRecentAssignment(undefinedNode.undef, time2);
                }
              }
            }

            if (ta == null)
              logger.debug("{} {} {} {} {}", undefinedNode.undef, undefinedNode.ref, uuid, t1, t2);
            else
              logger.debug("{} {} {} {} {} {} {}", undefinedNode.undef, undefinedNode.ref,
                  ta.tablet, ta.server, uuid, t1, t2);

          });
        } else {
          logger.debug("{} {}", undefinedNode.undef, undefinedNode.ref);
        }
      }
    }
  }