@Test public void testBadFam() throws Exception { LOG.info("test=testBadFam"); Table table = UTIL.getConnection().getTable(TEST_TABLE); List<Row> actions = new ArrayList<>(); Put p = new Put(Bytes.toBytes("row1")); p.addColumn(Bytes.toBytes("bad_family"), Bytes.toBytes("qual"), Bytes.toBytes("value")); actions.add(p); p = new Put(Bytes.toBytes("row2")); p.addColumn(BYTES_FAMILY, Bytes.toBytes("qual"), Bytes.toBytes("value")); actions.add(p); // row1 and row2 should be in the same region. Object [] r = new Object[actions.size()]; try { table.batch(actions, r); fail(); } catch (RetriesExhaustedWithDetailsException ex) { LOG.debug(ex.toString(), ex); // good! assertFalse(ex.mayHaveClusterIssues()); } assertEquals(2, r.length); assertTrue(r[0] instanceof Throwable); assertTrue(r[1] instanceof Result); table.close(); }
System.out.println("Row[" + n + "]: " + e.getRow(n)); // co PutListErrorExample3-3-ErrorPut Gain access to the failed operation. System.out.println("Cluster issues: " + e.mayHaveClusterIssues()); System.out.println("Description: " + e.getExhaustiveDescription());
MDC.put("mayHaveClusterIssues", String.valueOf(details.mayHaveClusterIssues())); for (int i = 0; i < details.getNumExceptions(); ++i) { MDC.put("host name port", details.getHostnamePort(i));
@Test public void testBadFam() throws Exception { LOG.info("test=testBadFam"); Table table = UTIL.getConnection().getTable(TEST_TABLE); List<Row> actions = new ArrayList<>(); Put p = new Put(Bytes.toBytes("row1")); p.addColumn(Bytes.toBytes("bad_family"), Bytes.toBytes("qual"), Bytes.toBytes("value")); actions.add(p); p = new Put(Bytes.toBytes("row2")); p.addColumn(BYTES_FAMILY, Bytes.toBytes("qual"), Bytes.toBytes("value")); actions.add(p); // row1 and row2 should be in the same region. Object [] r = new Object[actions.size()]; try { table.batch(actions, r); fail(); } catch (RetriesExhaustedWithDetailsException ex) { LOG.debug(ex.toString(), ex); // good! assertFalse(ex.mayHaveClusterIssues()); } assertEquals(2, r.length); assertTrue(r[0] instanceof Throwable); assertTrue(r[1] instanceof Result); table.close(); }