RetriesExhaustedWithDetailsException retryException = (RetriesExhaustedWithDetailsException) exp; processException(retryException.getCause(0));
exceptionByCaught = e.getCause(0);
Throwable cause = ClientExceptionsUtil.findException(e.getCause(0)); Assert.assertNotNull(cause); Assert.assertTrue(cause instanceof RegionMovedException);
protected static void rethrowException(RetriesExhaustedWithDetailsException exception) throws Exception { if (exception.getCauses().size() == 1) { throw (Exception) exception.getCause(0); } else { throw exception; } }
protected static void rethrowException(RetriesExhaustedWithDetailsException exception) throws Exception { if (exception.getCauses().size() == 1) { throw (Exception) exception.getCause(0); } else { throw exception; } }
@Test public void testCheckAndMutate() throws Throwable { try (Table table = createTable()) { // put one row putOneRow(table); // get row back and assert the values getOneRowAndAssertAllExist(table); // put the same row again with C column deleted RowMutations rm = makeRowMutationsWithColumnCDeleted(); boolean res = table.checkAndMutate(ROWKEY, FAMILY).qualifier(Bytes.toBytes("A")) .ifEquals(Bytes.toBytes("a")).thenMutate(rm); assertTrue(res); // get row back and assert the values getOneRowAndAssertAllButCExist(table); //Test that we get a region level exception try { rm = getBogusRowMutations(); table.checkAndMutate(ROWKEY, FAMILY).qualifier(Bytes.toBytes("A")) .ifEquals(Bytes.toBytes("a")).thenMutate(rm); fail("Expected NoSuchColumnFamilyException"); } catch (RetriesExhaustedWithDetailsException e) { try { throw e.getCause(0); } catch (NoSuchColumnFamilyException e1) { // expected } } } }
protected static void rethrowException(RetriesExhaustedWithDetailsException exception) throws Exception { if (exception.getCauses().size() == 1) { throw (Exception) exception.getCause(0); } else { throw exception; } }
@Test public void testCheckAndMutateWithBuilder() throws Throwable { try (Table table = createTable()) { // put one row putOneRow(table); // get row back and assert the values getOneRowAndAssertAllExist(table); // put the same row again with C column deleted RowMutations rm = makeRowMutationsWithColumnCDeleted(); boolean res = table.checkAndMutate(ROWKEY, FAMILY).qualifier(Bytes.toBytes("A")) .ifEquals(Bytes.toBytes("a")).thenMutate(rm); assertTrue(res); // get row back and assert the values getOneRowAndAssertAllButCExist(table); //Test that we get a region level exception try { rm = getBogusRowMutations(); table.checkAndMutate(ROWKEY, FAMILY).qualifier(Bytes.toBytes("A")) .ifEquals(Bytes.toBytes("a")).thenMutate(rm); fail("Expected NoSuchColumnFamilyException"); } catch (RetriesExhaustedWithDetailsException e) { try { throw e.getCause(0); } catch (NoSuchColumnFamilyException e1) { // expected } } } }
exception.getMessage(), furtherInfo), exception.getCause(0));
System.out.println("Number of exceptions: " + numErrors); for (int n = 0; n < numErrors; n++) { System.out.println("Cause[" + n + "]: " + e.getCause(n)); System.out.println("Hostname[" + n + "]: " + e.getHostnamePort(n)); System.out.println("Row[" + n + "]: " + e.getRow(n)); // co PutListErrorExample3-3-ErrorPut Gain access to the failed operation.
exceptionByCaught = e.getCause(0);
public static void logRetriesExhaustedWithDetailsException( Logger log, String context, RetriesExhaustedWithDetailsException exception) { if (log.isDebugEnabled()) { log.error("For context {}: exception occured during a bulk operation: {}", context, exception.getExhaustiveDescription()); } if (exception.getNumExceptions() == 0) { log.error( "For context {}: Got a RetriesExhaustedWithDetailsException without any details.", exception); return; } log.error( String.format( "For context %s: %d exceptions occured during a bulk operation:\n\t%s.\n" + "The stack trace is a sample exception, of the first exception.\n" + "Breakdown of exceptions {type - count}: %s", context, exception.getNumExceptions(), exception.getMessage(), getFurtherInfo(exception)), exception.getCause(0)); }
public static void logRetriesExhaustedWithDetailsException( Logger log, String context, RetriesExhaustedWithDetailsException exception) { if (log.isDebugEnabled()) { log.error("For context {}: exception occured during a bulk operation: {}", context, exception.getExhaustiveDescription()); } if (exception.getNumExceptions() == 0) { log.error( "For context {}: Got a RetriesExhaustedWithDetailsException without any details.", exception); return; } log.error( String.format( "For context %s: %d exceptions occured during a bulk operation:\n\t%s.\n" + "The stack trace is a sample exception, of the first exception.\n" + "Breakdown of exceptions {type - count}: %s", context, exception.getNumExceptions(), exception.getMessage(), getFurtherInfo(exception)), exception.getCause(0)); }
Assert.assertArrayEquals("Row key", badkey, thrownException.getRow(0).getRow()); Assert.assertTrue("Cause: NoSuchColumnFamilyException", thrownException.getCause(0) instanceof NoSuchColumnFamilyException); table.close();
@Test public void testCheckAndMutate() throws Throwable { try (Table table = createTable()) { // put one row putOneRow(table); // get row back and assert the values getOneRowAndAssertAllExist(table); // put the same row again with C column deleted RowMutations rm = makeRowMutationsWithColumnCDeleted(); boolean res = table.checkAndMutate(ROWKEY, FAMILY).qualifier(Bytes.toBytes("A")) .ifEquals(Bytes.toBytes("a")).thenMutate(rm); assertTrue(res); // get row back and assert the values getOneRowAndAssertAllButCExist(table); //Test that we get a region level exception try { rm = getBogusRowMutations(); table.checkAndMutate(ROWKEY, FAMILY).qualifier(Bytes.toBytes("A")) .ifEquals(Bytes.toBytes("a")).thenMutate(rm); fail("Expected NoSuchColumnFamilyException"); } catch (RetriesExhaustedWithDetailsException e) { try { throw e.getCause(0); } catch (NoSuchColumnFamilyException e1) { // expected } } } }
@Test public void testCheckAndMutateWithBuilder() throws Throwable { try (Table table = createTable()) { // put one row putOneRow(table); // get row back and assert the values getOneRowAndAssertAllExist(table); // put the same row again with C column deleted RowMutations rm = makeRowMutationsWithColumnCDeleted(); boolean res = table.checkAndMutate(ROWKEY, FAMILY).qualifier(Bytes.toBytes("A")) .ifEquals(Bytes.toBytes("a")).thenMutate(rm); assertTrue(res); // get row back and assert the values getOneRowAndAssertAllButCExist(table); //Test that we get a region level exception try { rm = getBogusRowMutations(); table.checkAndMutate(ROWKEY, FAMILY).qualifier(Bytes.toBytes("A")) .ifEquals(Bytes.toBytes("a")).thenMutate(rm); fail("Expected NoSuchColumnFamilyException"); } catch (RetriesExhaustedWithDetailsException e) { try { throw e.getCause(0); } catch (NoSuchColumnFamilyException e1) { // expected } } } }