示例#1
0
  @JmxOperation(
      description = "Clean all rebalancing server/cluster states from this node.",
      impact = MBeanOperationInfo.ACTION)
  public void cleanAllRebalancingState() {
    for (String key : OPTIONAL_KEYS) {
      if (!key.equals(NODE_ID_KEY))
        innerStore.delete(key, getVersions(new ByteArray(ByteUtils.getBytes(key, "UTF-8"))).get(0));
    }

    init(getNodeId());
  }
 private VProto.DeleteResponse handleDelete(
     VProto.DeleteRequest request, Store<ByteArray, byte[]> store) {
   VProto.DeleteResponse.Builder response = VProto.DeleteResponse.newBuilder();
   try {
     boolean success =
         store.delete(
             ProtoUtils.decodeBytes(request.getKey()),
             ProtoUtils.decodeClock(request.getVersion()));
     response.setSuccess(success);
   } catch (VoldemortException e) {
     response.setSuccess(false);
     response.setError(ProtoUtils.encodeError(getErrorMapper(), e));
   }
   return response.build();
 }
 @Override
 @Test
 public void testNullKeys() throws Exception {
   System.out.println("                    Testing null Keys                    ");
   Store<ByteArray, byte[], byte[]> store = getStore();
   try {
     store.put(null, new Versioned<byte[]>(getValue(), getNewIncrementedVectorClock()), null);
     fail("Store should not put null keys!");
   } catch (IllegalArgumentException e) {
     // this is good
   } catch (NullPointerException npe) {
     // this is good
   }
   try {
     store.get(null, null);
     fail("Store should not get null keys!");
   } catch (IllegalArgumentException e) {
     // this is good
   } catch (NullPointerException npe) {
     // this is good
   }
   try {
     store.getAll(null, null);
     fail("Store should not getAll null keys!");
   } catch (IllegalArgumentException e) {
     // this is good
   } catch (NullPointerException npe) {
     // this is good
   }
   try {
     store.getAll(
         Collections.<ByteArray>singleton(null),
         Collections.<ByteArray, byte[]>singletonMap(null, null));
     fail("Store should not getAll null keys!");
   } catch (IllegalArgumentException e) {
     // this is good
   } catch (NullPointerException npe) {
     // this is good
   }
   try {
     store.delete(null, new VectorClock());
     fail("Store should not delete null keys!");
   } catch (IllegalArgumentException e) {
     // this is good
   } catch (NullPointerException npe) {
     // this is good
   }
 }