private static void logError(String msg, Context context) throws IOException {
      TableName table = getTableName(context.getConfiguration());

      LOG.error("Failure in chain verification: " + msg);
      try (Connection connection = ConnectionFactory.createConnection(context.getConfiguration());
        Admin admin = connection.getAdmin()) {
        LOG.error("cluster metrics:\n" + admin.getClusterMetrics());
        LOG.error("table regions:\n" + Joiner.on("\n").join(admin.getRegions(table)));
      }
    }
Class that does the actual checking of the links. All links in the chain should be grouped and
sorted when sent to this class. Then the chain will be traversed making sure that no link is
missing and that the chain is the correct length. This will throw an exception if anything is
not correct. That causes the job to fail if any data is corrupt.
hbase-it/src/test/java/org/apache/hadoop/hbase/mapreduce/IntegrationTestBulkLoad.java