Пример #1
0
 public static void executeNamespace(
     Instance instance, ClientExec<MasterClientService.Client> exec)
     throws AccumuloException, AccumuloSecurityException, NamespaceNotFoundException {
   try {
     executeGeneric(instance, exec);
   } catch (TableNotFoundException e) {
     if (e.getCause() instanceof NamespaceNotFoundException)
       throw (NamespaceNotFoundException) e.getCause();
   }
 }
    private void binMutations(
        MutationSet mutationsToProcess,
        Map<String, TabletServerMutations<Mutation>> binnedMutations) {
      try {
        Set<Entry<String, List<Mutation>>> es = mutationsToProcess.getMutations().entrySet();
        for (Entry<String, List<Mutation>> entry : es) {
          TabletLocator locator = getLocator(entry.getKey());

          String table = entry.getKey();
          List<Mutation> tableMutations = entry.getValue();

          if (tableMutations != null) {
            ArrayList<Mutation> tableFailures = new ArrayList<Mutation>();
            locator.binMutations(credentials, tableMutations, binnedMutations, tableFailures);

            if (tableFailures.size() > 0) {
              failedMutations.add(table, tableFailures);

              if (tableFailures.size() == tableMutations.size())
                if (!Tables.exists(instance, entry.getKey()))
                  throw new TableDeletedException(entry.getKey());
                else if (Tables.getTableState(instance, table) == TableState.OFFLINE)
                  throw new TableOfflineException(instance, entry.getKey());
            }
          }
        }
        return;
      } catch (AccumuloServerException ase) {
        updateServerErrors(ase.getServer(), ase);
      } catch (AccumuloException ae) {
        // assume an IOError communicating with !METADATA tablet
        failedMutations.add(mutationsToProcess);
      } catch (AccumuloSecurityException e) {
        updateAuthorizationFailures(
            Collections.singletonMap(
                new KeyExtent(new Text(MetadataTable.ID), null, null),
                SecurityErrorCode.valueOf(e.getSecurityErrorCode().name())));
      } catch (TableDeletedException e) {
        updateUnknownErrors(e.getMessage(), e);
      } catch (TableOfflineException e) {
        updateUnknownErrors(e.getMessage(), e);
      } catch (TableNotFoundException e) {
        updateUnknownErrors(e.getMessage(), e);
      }

      // an error ocurred
      binnedMutations.clear();
    }
Пример #3
0
 /** Write the given Mutation to the replication table. */
 protected static void update(Credentials credentials, Mutation m, KeyExtent extent) {
   Writer t = getWriter(credentials);
   while (true) {
     try {
       t.update(m);
       return;
     } catch (AccumuloException e) {
       log.error(e.toString(), e);
     } catch (AccumuloSecurityException e) {
       log.error(e.toString(), e);
     } catch (ConstraintViolationException e) {
       log.error(e.toString(), e);
     } catch (TableNotFoundException e) {
       log.error(e.toString(), e);
     }
     UtilWaitThread.sleep(1000);
   }
 }