long newEndTime = curState.getEndTime(partition); if (prevState == null || prevState.getEndTime(partition) < newEndTime) { if (partitionUpdateEndTimes == null) { partitionUpdateEndTimes = new HashMap<>();
continue; long transitionCompleteTime = currentState.getEndTime(partitionName);
if (currentState.getState(partition.getPartitionName()).equalsIgnoreCase(topState)) { handOffEndTime = Math.min(handOffEndTime, currentState.getEndTime(partition.getPartitionName()));
continue; long transitionCompleteTime = currentState.getEndTime(partitionName);
startTime = fromTopStateStartTime; fromTopStateUserLatency = currentState.getEndTime(partition.getPartitionName()) - startTime;
.get(resourceName); if (currentState.getState(partition.getPartitionName()).equalsIgnoreCase(topState)) { if (currentState.getEndTime(partition.getPartitionName()) <= handOffEndTime) { handOffEndTime = currentState.getEndTime(partition.getPartitionName()); toTopStateUserLatency = handOffEndTime - currentState.getStartTime(partition.getPartitionName());
long endTime = cache.getCurrentState(curTopStateInstance, curTopStateSession).get(resourceName) .getEndTime(partition.getPartitionName()); long toTopStateuserLatency = endTime - cache.getCurrentState(curTopStateInstance, curTopStateSession).get(resourceName) fromTopStateUserLatency = cache.getCurrentState(lastTopStateInstance, lastTopStateSession).get(resourceName) .getEndTime(partition.getPartitionName()) - startTime;
.setInfo(resourceName, partition, instanceName, currentState.getInfo(partitionName)); currentStateOutput.setEndTime(resourceName, partition, instanceName, currentState.getEndTime(partitionName));
.setInfo(resourceName, partition, instanceName, currentState.getInfo(partitionName)); currentStateOutput.setEndTime(resourceName, partition, instanceName, currentState.getEndTime(partitionName));
@Test public void testAddedFieldsInCurrentState() { String instanceName = PARTICIPANT_PREFIX + "_" + _startPort; HelixDataAccessor accessor = _manager.getHelixDataAccessor(); LiveInstance liveInstance = accessor.getProperty(accessor.keyBuilder().liveInstance(instanceName)); CurrentState currentState = accessor.getProperty(accessor.keyBuilder() .currentState(instanceName, liveInstance.getSessionId(), WorkflowGenerator.DEFAULT_TGT_DB)); // Test start time should happen after test start time Assert.assertTrue( currentState.getStartTime(WorkflowGenerator.DEFAULT_TGT_DB + "_0") >= _testStartTime); // Test end time is always larger than start time Assert.assertTrue( currentState.getEndTime(WorkflowGenerator.DEFAULT_TGT_DB + "_0") >= currentState .getStartTime(WorkflowGenerator.DEFAULT_TGT_DB + "_0")); // Final state is MASTER, so SLAVE will be the previous state Assert.assertEquals(currentState.getPreviousState(WorkflowGenerator.DEFAULT_TGT_DB + "_0"), "SLAVE"); } }