Ejemplo n.º 1
0
 protected static KuduTable createTable(
     String tableName, Schema schema, CreateTableBuilder builder) {
   LOG.info("Creating table: {}", tableName);
   Deferred<KuduTable> d = client.createTable(tableName, schema, builder);
   final AtomicBoolean gotError = new AtomicBoolean(false);
   d.addErrback(
       new Callback<Object, Object>() {
         @Override
         public Object call(Object arg) throws Exception {
           gotError.set(true);
           LOG.error("Error : " + arg);
           return null;
         }
       });
   KuduTable table = null;
   try {
     table = d.join(DEFAULT_SLEEP);
   } catch (Exception e) {
     fail("Timed out");
   }
   if (gotError.get()) {
     fail(
         "Got error during table creation, is the Kudu master running at "
             + masterAddresses
             + "?");
   }
   tableNames.add(tableName);
   return table;
 }
Ejemplo n.º 2
0
 /**
  * Wait up to DEFAULT_SLEEP for an expected count of TS to connect to the master
  *
  * @param expected How many TS are expected
  * @return true if there are at least as many TS as expected, otherwise false
  */
 static boolean waitForTabletServers(int expected) throws Exception {
   int count = 0;
   Stopwatch stopwatch = new Stopwatch().start();
   while (count < expected && stopwatch.elapsedMillis() < DEFAULT_SLEEP) {
     Thread.sleep(200);
     Deferred<ListTabletServersResponse> d = client.listTabletServers();
     d.addErrback(defaultErrorCB);
     count = d.join(DEFAULT_SLEEP).getTabletServersCount();
   }
   return count >= expected;
 }