Package com.alibaba.wasp.plan.action

Examples of com.alibaba.wasp.plan.action.DeleteAction


  @Test
  public void testDelete() throws InvalidProtocolBufferException {
    String tableName = "test";
    String primary = "1234";
    DeleteAction action = new DeleteAction(tableName, Bytes.toBytes(primary));
    MessageProto message = ProtobufUtil.convertDeleteAction(action);
    action = (DeleteAction) ProtobufUtil.convertWriteAction(message);
    Assert.assertTrue(tableName.equals(action.getFTableName()));
    Assert.assertTrue(primary.equals(Bytes.toString(action.getCombinedPrimaryKey())));
  }
View Full Code Here


    if (primaryKeyPairs == null) {
      throw new NotMatchPrimaryKeyException("Not match primary key.");
    }

    byte[] primayKey = RowBuilder.build().genRowkey(primaryKeyPairs);
    DeleteAction action = new DeleteAction(wtableName, primayKey);
    if (context.isGenWholePlan()) {
      Condition entityGroupKeyCondition = ParserUtils.getCondition(table
          .getEntityGroupKey().getName(), eqConditions);
      // Get entityGroupLocation according to entity group key
      EntityGroupLocation entityGroupLocation = this.connection
          .locateEntityGroup(Bytes.toBytes(table.getTableName()), DruidParser
              .convert(table.getColumn(entityGroupKeyCondition.getFieldName()),
                  entityGroupKeyCondition.getValue()));
      action.setEntityGroupLocation(entityGroupLocation);
    }
    List<DeleteAction> actions = new ArrayList<DeleteAction>();
    actions.add(action);
    DeletePlan deletePlan = new DeletePlan(actions);
    context.setPlan(deletePlan);
View Full Code Here

      throws ServiceException {
    List<ClientProtos.WriteResultProto> writeResultProtos = new ArrayList<ClientProtos.WriteResultProto>();
    List<DeleteAction> actions = plan.getActions();
    // if actions > 1. will commit by 2pc
    if (actions.size() == 1) {
      DeleteAction action = actions.get(0);
      EntityGroupInfo entityGroupInfo = action.getEntityGroupLocation()
          .getEntityGroupInfo();
      ServerName serverName = new ServerName(action.getEntityGroupLocation()
          .getHostname(), action.getEntityGroupLocation().getPort(),
          ServerName.NON_STARTCODE);
      try {
        if (workingOnLocalServer(server, serverName)) {
          ClientProtos.DeleteResponse response = server.delete(
              entityGroupInfo.getEntityGroupName(), action);
View Full Code Here

TOP

Related Classes of com.alibaba.wasp.plan.action.DeleteAction

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.