System.out.println("START cluster. SETTING lastTestStartTimestamp to "
+ new Timestamp(timestampVal) + "\nline:" + inputLine);
lastTestStartTimestamp = timestampVal;
}
ZNRecord record = getZNRecord(inputLine);
LiveInstance liveInstance = new LiveInstance(record);
String session = getAttributeValue(inputLine, "session:");
sessionMap.put(session, inputLine);
System.out.println(new Timestamp(Long.parseLong(timestamp)) + ": create LIVEINSTANCE "
+ liveInstance.getInstanceName());
}
else if (inputLine.indexOf("closeSession") != -1)
{
// kill any instance
String session = getAttributeValue(inputLine, "session:");
if (sessionMap.containsKey(session))
{
if (timestampVal < lastTestStartTimestamp)
{
System.out.println("KILL node. SETTING lastTestStartTimestamp to " + timestampVal
+ " line:" + inputLine);
lastTestStartTimestamp = timestampVal;
}
String line = sessionMap.get(session);
ZNRecord record = getZNRecord(line);
LiveInstance liveInstance = new LiveInstance(record);
System.out.println(new Timestamp(Long.parseLong(timestamp)) + ": close session "
+ liveInstance.getInstanceName());
dump = true;
}
}
else if (inputLine.indexOf("/" + clusterName + "/CONFIGS/PARTICIPANT") != -1)
{
// disable a partition
String type = getAttributeValue(inputLine, "type:");
if (type.equals("setData") && inputLine.indexOf("HELIX_DISABLED_PARTITION") != -1)
{
if (timestampVal < lastTestStartTimestamp)
{
System.out.println("DISABLE partition. SETTING lastTestStartTimestamp to " + timestampVal
+ " line:" + inputLine);
lastTestStartTimestamp = timestampVal;
}
}
} else if (inputLine.indexOf("/" + clusterName + "/CONTROLLER/LEADER") != -1)
{
// leaderLine = inputLine;
ZNRecord record = getZNRecord(inputLine);
LiveInstance liveInstance = new LiveInstance(record);
String session = getAttributeValue(inputLine, "session:");
leaderSession = session;
controllerStartTime = Long.parseLong(getAttributeValue(inputLine, "time:"));
sessionMap.put(session, inputLine);
System.out.println(new Timestamp(Long.parseLong(timestamp)) + ": create LEADER "
+ liveInstance.getInstanceName());
}
else if (inputLine.indexOf("/" + clusterName + "/") != -1
&& inputLine.indexOf("/CURRENTSTATES/") != -1)
{
String type = getAttributeValue(inputLine, "type:");
if (type.equals("create"))
{
stats.curStateCreateCount++;
}
else if (type.equals("setData"))
{
String path = getAttributeValue(inputLine, "path:");
csUpdateLines.add(inputLine);
stats.curStateUpdateCount++;
// getAttributeValue(line, "data");
System.out.println("Update currentstate:"
+ new Timestamp(Long.parseLong(timestamp)) + ":" + timestamp + " path:"
+ path);
}
}
else if (inputLine.indexOf("/" + clusterName + "/EXTERNALVIEW/") != -1)
{
String session = getAttributeValue(inputLine, "session:");
if (session.equals(leaderSession))
{
String type = getAttributeValue(inputLine, "type:");
if (type.equals("create"))
{
stats.extViewCreateCount++;
}
else if (type.equals("setData"))
{
stats.extViewUpdateCount++;
}
}
// pos = inputLine.indexOf("EXTERNALVIEW");
// pos = inputLine.indexOf("data:{", pos);
// if (pos != -1)
// {
// String timestamp = getAttributeValue(inputLine, "time:");
// ZNRecord record =
// (ZNRecord) _deserializer.deserialize(inputLine.substring(pos + 5)
// .getBytes());
// ExternalView extView = new ExternalView(record);
// int masterCnt = ClusterStateVerifier.countStateNbInExtView(extView,
// "MASTER");
// int slaveCnt = ClusterStateVerifier.countStateNbInExtView(extView, "SLAVE");
// if (masterCnt == 1200)
// {
// System.out.println(timestamp + ": externalView " + extView.getResourceName()
// + " has " + masterCnt + " MASTER, " + slaveCnt + " SLAVE");
// }
// }
}
else if (inputLine.indexOf("/" + clusterName + "/") != -1
&& inputLine.indexOf("/MESSAGES/") != -1)
{
String type = getAttributeValue(inputLine, "type:");
if (type.equals("create"))
{
ZNRecord record = getZNRecord(inputLine);
Message msg = new Message(record);
String sendSession = getAttributeValue(inputLine, "session:");
if (sendSession.equals(leaderSession)
&& msg.getMsgType().equals("STATE_TRANSITION")
&& msg.getMsgState() == MessageState.NEW)