Package org.apache.hadoop.hbase

Examples of org.apache.hadoop.hbase.DoNotRetryIOException


      if (mutation instanceof Put) {
        mutateType = MutationType.PUT;
      } else if (mutation instanceof Delete) {
        mutateType = MutationType.DELETE;
      } else {
        throw new DoNotRetryIOException("RowMutations supports only put and delete, not " +
          mutation.getClass().getName());
      }
      mutationBuilder.clear();
      MutationProto mp = ProtobufUtil.toMutation(mutateType, mutation, mutationBuilder);
      actionBuilder.clear();
View Full Code Here


      if (mutation instanceof Put) {
        type = MutationType.PUT;
      } else if (mutation instanceof Delete) {
        type = MutationType.DELETE;
      } else {
        throw new DoNotRetryIOException("RowMutations supports only put and delete, not " +
          mutation.getClass().getName());
      }
      mutationBuilder.clear();
      MutationProto mp = ProtobufUtil.toMutationNoData(type, mutation, mutationBuilder);
      cells.add(mutation);
View Full Code Here

        regionActionBuilder.addAction(actionBuilder.setMutation(
            ProtobufUtil.toMutation((Increment)row, mutationBuilder, action.getNonce())));
      } else if (row instanceof RowMutations) {
        throw new UnsupportedOperationException("No RowMutations in multi calls; use mutateRow");
      } else {
        throw new DoNotRetryIOException("Multi doesn't support " + row.getClass().getName());
      }
    }
    return regionActionBuilder;
  }
View Full Code Here

        builder.addAction(actionBuilder.setMutation(ProtobufUtil.toMutationNoData(
          MutationType.INCREMENT, i, mutationBuilder, action.getNonce())));
      } else if (row instanceof RowMutations) {
        continue; // ignore RowMutations
      } else {
        throw new DoNotRetryIOException("Multi doesn't support " + row.getClass().getName());
      }
    }
    return builder;
  }
View Full Code Here

    for (WaspProtos.Mutate.ColumnValue column : proto.getColumnValueList()) {
      byte[] family = column.getFamily().toByteArray();
      for (WaspProtos.Mutate.ColumnValue.QualifierValue qv : column.getQualifierValueList()) {
        byte[] qualifier = qv.getQualifier().toByteArray();
        if (!qv.hasValue()) {
          throw new DoNotRetryIOException(
              "Missing required field: qualifer value");
        }
        byte[] value = qv.getValue().toByteArray();
        put.add(family, qualifier, value);
      }
View Full Code Here

        break;
      } else {
        try {
          if (!existingLatch.await(this.rowLockWaitDuration,
              TimeUnit.MILLISECONDS)) {
            throw new DoNotRetryIOException("Timed out on getting lock for row="
                + Bytes.toStringBinary(row));
          }
        } catch (InterruptedException ie) {
          // Empty
        }
View Full Code Here

      context.setSql(sql);
      try {
        druidParser.generatePlan(context);
      } catch (RuntimeException e) {
        if (e instanceof ParserException || e instanceof SQLParseException) {
          throw new DoNotRetryIOException(e.getMessage(), e);
        } else {
          throw new ServiceException(new IOException(e));
        }
      } catch (UnsupportedException e) {
        throw e;
View Full Code Here

        } else {
          parser.generatePlan(context);
        }
      } catch (RuntimeException e) {
        if (e instanceof ParserException || e instanceof SQLParseException) {
          throw new DoNotRetryIOException(e.getMessage(), e);
        } else {
          throw new ServiceException(new IOException(e));
        }
      } catch (UnsupportedException e) {
        throw e;
      }
      final long afterGenPlan = EnvironmentEdgeManager.currentTimeMillis();
      ((FServer) this.service).getMetrics().updateGenPlan(
          afterGenPlan - beforeGenPlan);

      Plan executePlan = context.getPlan();
      if (executePlan instanceof DQLPlan) {
        selectSQLCount.increment();
        DQLPlan dqlPlan = (DQLPlan) executePlan;
        dqlPlan.setFetchRows(fetchSize);
        Pair<Boolean, Pair<String, Pair<List<QueryResultProto>, List<StringDataTypePair>>>> queryResults =
            executeEngine.execQueryPlan(dqlPlan, sessionId, closeSession);
        addReadMetricsCount(0, null, 1, EnvironmentEdgeManager.currentTimeMillis() - beforeGenPlan);
        return ResponseConverter.buildExecuteResponse(queryResults.getFirst(),
            queryResults.getSecond().getFirst(), queryResults.getSecond()
            .getSecond());
      } else if (executePlan instanceof DMLPlan) {
        if (executePlan instanceof InsertPlan) {
          insertSQLCount.increment();
          List<WriteResultProto> writeResults = executeEngine
              .execInsertPlan((InsertPlan) executePlan);
          addWriteMetricsCount(0, null, 1, EnvironmentEdgeManager.currentTimeMillis()
              - beforeGenPlan);
          return ResponseConverter.buildExecuteResponse(writeResults);
        } else if (executePlan instanceof UpdatePlan) {
          updateSQLCount.increment();
          List<WriteResultProto> writeResults = executeEngine
              .execUpdatePlan((UpdatePlan) executePlan);
          addWriteMetricsCount(0, null, 1, EnvironmentEdgeManager.currentTimeMillis()
              - beforeGenPlan);
          return ResponseConverter.buildExecuteResponse(writeResults);
        } else if (executePlan instanceof DeletePlan) {
          deleteSQLCount.increment();
          List<WriteResultProto> writeResults = executeEngine
              .execDeletePlan((DeletePlan) executePlan);
          addWriteMetricsCount(0, null, 1, EnvironmentEdgeManager.currentTimeMillis()
              - beforeGenPlan);
          return ResponseConverter.buildExecuteResponse(writeResults);
        } else {
          throw new ServiceException(
              "The instance of Plan is not supported. SQL:" + sql);
        }
      } else if (executePlan instanceof DDLPlan) {
        MasterAdminKeepAliveConnection masterAdminKeepAliveConnection = this.connection
            .getKeepAliveMasterAdmin();

        if(executePlan instanceof NotingTodoPlan) {
          return ResponseConverter.buildNotExecuteResponse();
        } else if (executePlan instanceof AlterTablePlan) {
          FTable hTableDesc = ((AlterTablePlan) executePlan).getNewTable();
          return modifyTable(masterAdminKeepAliveConnection, hTableDesc);
        } else if (executePlan instanceof CreateTablePlan) {
          CreateTablePlan createTable = (CreateTablePlan) executePlan;
          MasterAdminProtos.CreateTableResponse response = masterAdminKeepAliveConnection
              .createTable(
                  null,
                  RequestConverter.buildCreateTableRequest(
                      createTable.getTable(), createTable.getSplitKeys()));
          return ResponseConverter.buildExecuteResponse(response);
        } else if (executePlan instanceof CreateIndexPlan) {
          CreateIndexPlan createIndexPlan = (CreateIndexPlan) executePlan;
          Index index = createIndexPlan.getIndex();
          MasterAdminProtos.CreateIndexRequest request = RequestConverter
              .buildCreateIndexRequest(index);
          return ResponseConverter
              .buildExecuteResponse(masterAdminKeepAliveConnection.createIndex(
                  null, request));
        } else if (executePlan instanceof DropIndexPlan) {
          DropIndexPlan dropIndexPlan = (DropIndexPlan) executePlan;
          MasterAdminProtos.DropIndexRequest request = RequestConverter.buildDropIndexRequest(
              dropIndexPlan.getTableName(), dropIndexPlan.getIndexName());
          return ResponseConverter
              .buildExecuteResponse(masterAdminKeepAliveConnection.deleteIndex(
                  null, request));
        } else if (executePlan instanceof DropTablePlan) {
          List<DeleteTableResponse> responses = new ArrayList<DeleteTableResponse>();
          for (String tableName : ((DropTablePlan) executePlan).getTableNames()) {
            byte[] byteName = Bytes.toBytes(tableName);
            if (this.connection.isTableDisabled(byteName)) {
              MasterAdminProtos.DeleteTableRequest request = RequestConverter
                  .buildDeleteTableRequest(byteName);
              responses.add(masterAdminKeepAliveConnection.deleteTable(null,
                  request));
            } else {
              throw new TableNotDisabledException(tableName);
            }
          }
          return ResponseConverter.buildListExecuteResponse(responses);
        } else if (executePlan instanceof TruncateTablePlan) {
          List<TruncateTableResponse> responses = new ArrayList<TruncateTableResponse>();
          for (String tableName : ((TruncateTablePlan) executePlan)
              .getTableNames()) {
            byte[] byteName = Bytes.toBytes(tableName);
            if (this.connection.isTableDisabled(byteName)) {
              MasterAdminProtos.TruncateTableRequest request = RequestConverter
                  .buildTruncateTableRequest(byteName);
              responses.add(masterAdminKeepAliveConnection.truncateTable(null,
                  request));
            } else {
              throw new TableNotDisabledException(tableName);
            }
          }
        }
      }

      throw new ServiceException(new DoNotRetryIOException(
          "The instance of Plan is not supported. SQL:" + sql));
    } catch (ServiceException e) {
      LOG.error("ServiceException ", e);
      throw e;
    } catch (Throwable e) {
View Full Code Here

        context.setSessionId(sessionId);
        try {
            parser.generatePlan(context);
        } catch (RuntimeException e) {
          if (e instanceof ParserException || e instanceof SQLParseException) {
            throw new DoNotRetryIOException(e.getMessage(), e);
          } else {
            throw new ServiceException(new IOException(e));
          }
        } catch (UnsupportedException e) {
          throw e;
View Full Code Here

              mutations = new ArrayList<ClientProtos.Action>(actions.getActionCount());
            }
            mutations.add(action);
            break;
          default:
            throw new DoNotRetryIOException("Unsupported mutate type: " + type.name());
          }
        } else {
          throw new HBaseIOException("Unexpected Action type");
        }
        if (r != null) {
View Full Code Here

TOP

Related Classes of org.apache.hadoop.hbase.DoNotRetryIOException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.