/** * Selectively removes fields appearing in the given IdealState (input) from the IdealState in ZK. * @param clusterName * @param resourceName * @param idealState */ @Override public void removeFromIdealState(String clusterName, String resourceName, IdealState idealState) { String zkPath = PropertyPathBuilder.idealState(clusterName, resourceName); ZKUtil.subtract(_zkClient, zkPath, idealState.getRecord()); }
ZKUtil.subtract(zkClient, splits[0], update);
ZKUtil.subtract(zkClient, splits[0], update);
/** * Remove multiple configs * * @param scope scope specification of the entity set to query (e.g. cluster, resource, * participant, etc.) * @param recordToRemove the ZNRecord that holds the entries that needs to be removed */ public void remove(HelixConfigScope scope, ZNRecord recordToRemove) { if (scope == null || scope.getType() == null || !scope.isFullKey()) { LOG.error("fail to remove. invalid scope: " + scope); return; } String clusterName = scope.getClusterName(); if (!ZKUtil.isClusterSetup(clusterName, zkClient)) { throw new HelixException("fail to remove. cluster " + clusterName + " is not setup yet"); } String zkPath = scope.getZkPath(); ZKUtil.subtract(zkClient, zkPath, recordToRemove); }
/** * Remove multiple configs * * @param scope scope specification of the entity set to query (e.g. cluster, resource, * participant, etc.) * @param recordToRemove the ZNRecord that holds the entries that needs to be removed */ public void remove(HelixConfigScope scope, ZNRecord recordToRemove) { if (scope == null || scope.getType() == null || !scope.isFullKey()) { LOG.error("fail to remove. invalid scope: " + scope); return; } String clusterName = scope.getClusterName(); if (!ZKUtil.isClusterSetup(clusterName, zkClient)) { throw new HelixException("fail to remove. cluster " + clusterName + " is not setup yet"); } String zkPath = scope.getZkPath(); ZKUtil.subtract(zkClient, zkPath, recordToRemove); }
ZKUtil.subtract(zkClient, zkPath, update);
ZKUtil.subtract(zkClient, zkPath, update);
@Test() public void testSubtract() { String path = PropertyPathBuilder.instanceConfig(clusterName, "id5"); ZNRecord record = new ZNRecord("id5"); record.setSimpleField("key1", "value1"); _gZkClient.createPersistent(path, record); ZKUtil.subtract(_gZkClient, path, record); record = _gZkClient.readData(path); AssertJUnit.assertNull(record.getSimpleField("key1")); }