Package org.apache.helix

Examples of org.apache.helix.HelixDataAccessor.removeProperty()


      // nop messages are simply removed. It is used to trigger onMessage() in
      // situations such as register a new message handler factory
      if (message.getMsgType().equalsIgnoreCase(MessageType.NO_OP.toString())) {
        LOG.info("Dropping NO-OP message. mid: " + message.getId() + ", from: "
            + message.getMsgSrc());
        accessor.removeProperty(message.getKey(keyBuilder, instanceName));
        continue;
      }

      SessionId tgtSessionId = message.getTypedTgtSessionId();
View Full Code Here


        String warningMessage =
            "SessionId does NOT match. expected sessionId: " + sessionId
                + ", tgtSessionId in message: " + tgtSessionId + ", messageId: "
                + message.getMessageId();
        LOG.warn(warningMessage);
        accessor.removeProperty(message.getKey(keyBuilder, instanceName));
        _statusUpdateUtil.logWarning(message, HelixStateMachineEngine.class, warningMessage,
            accessor);
        continue;
      }
View Full Code Here

            "Failed to create message handler for " + message.getMessageId() + ", exception: " + e;

        _statusUpdateUtil.logError(message, HelixStateMachineEngine.class, e, error, accessor);

        message.setMsgState(MessageState.UNPROCESSABLE);
        accessor.removeProperty(message.getKey(keyBuilder, instanceName));
        LOG.error("Message cannot be processed: " + message.getRecord(), e);

        continue;
      }
View Full Code Here

    // create a cluster with the same id
    boolean created2 = createCluster(clusterId, accessor, MODIFIER, 2);
    Assert.assertFalse(created2); // should fail since cluster exists

    // remove a required property
    helixAccessor.removeProperty(helixAccessor.keyBuilder().liveInstances());

    // try again, should work this time
    created2 = createCluster(clusterId, accessor, MODIFIER, 2);
    Assert.assertTrue(created2);
View Full Code Here

    // create a participant with the same id
    boolean created2 = createParticipant(participantId, accessor, MODIFIER, 2);
    Assert.assertFalse(created2); // should fail since participant exists

    // remove a required property
    helixAccessor.removeProperty(helixAccessor.keyBuilder().messages(participantId.stringify()));

    // try again, should work this time
    created2 = createParticipant(participantId, accessor, MODIFIER, 2);
    Assert.assertTrue(created2);
View Full Code Here

    LiveInstance leader = accessor.getProperty(keyBuilder.controllerLeader());
    Assert.assertNotNull(leader);
    Assert.assertEquals(leader.getInstanceName(), controllerId.stringify());

    // remove leader znode externally
    accessor.removeProperty(keyBuilder.controllerLeader());

    // verify leader is re-elected
    boolean result = TestHelper.verify(new TestHelper.Verifier() {

      @Override
View Full Code Here

    // round3: node0 removes message and controller's rebalance pipeline should be
    // triggered
    // and sends S->M to node0
    messages = accessor.getChildNames(keyBuilder.messages("localhost_0"));
    accessor.removeProperty(keyBuilder.message("localhost_0", messages.get(0)));
    Thread.sleep(1000);

    messages = accessor.getChildNames(keyBuilder.messages("localhost_0"));
    Assert.assertEquals(messages.size(), 1);
    ZNRecord msg =
View Full Code Here

    // round3: remove O->S for localhost_0, controller should now send O->DROPPED to
    // localhost_0
    Builder keyBuilder = accessor.keyBuilder();
    List<String> msgIds = accessor.getChildNames(keyBuilder.messages("localhost_0"));
    accessor.removeProperty(keyBuilder.message("localhost_0", msgIds.get(0)));
    HelixTestUtil.runPipeline(event, dataRefresh);
    HelixTestUtil.runPipeline(event, rebalancePipeline);
    msgSelOutput = event.getAttribute(AttributeName.MESSAGES_SELECTED.toString());
    messages =
        msgSelOutput.getMessages(ResourceId.from(resourceName),
View Full Code Here

        Assert.assertTrue(callback.isFinalizeTypeInvoked());
      }
    }

    // Remove fake instance
    accessor.removeProperty(keyBuilder.liveInstance("fakeInstance"));

    // Re-enable custom-code runner
    admin.enableResource(clusterName, customCodeRunnerResource, true);
    result =
        ClusterStateVerifier
View Full Code Here

    // Remove all ideal states and resource configs to trigger a drop event
    HelixDataAccessor accessor = _manager.getHelixDataAccessor();
    PropertyKey.Builder keyBuilder = accessor.keyBuilder();
    final Set<String> toRemove = Sets.newHashSet(config.getJobDag().getAllNodes());
    for (String resourceName : toRemove) {
      accessor.removeProperty(keyBuilder.idealStates(resourceName));
      accessor.removeProperty(keyBuilder.resourceConfig(resourceName));
      // Delete context
      String contextKey = Joiner.on("/").join(TaskConstants.REBALANCER_CONTEXT_ROOT, resourceName);
      _manager.getHelixPropertyStore().remove(contextKey, AccessOption.PERSISTENT);
    }
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.