Program: 4610
Project: 4610
Buggy source:
/** 
 * Logs initialization of program run and persists program status to   {@link ProgramRunStatus#STARTING}.
 * @param programId id of the program
 * @param pid run id
 * @param startTs initialization timestamp in seconds
 * @param twillRunId Twill run id
 * @param runtimeArgs the runtime arguments for this program run
 * @param systemArgs the system arguments for this program run
 * @param sourceId id of the source of program run status, which is proportional to the timestamp ofwhen the current program run status is reached, e.g. a message id from TMS
 * @return {@link ProgramRunStatus#STARTING} if it is successfully persisted, {@code null} otherwise.
 */
public ProgramRunStatus recordProgramStart(ProgramId programId,String pid,long startTs,String twillRunId,Map<String,String> runtimeArgs,Map<String,String> systemArgs,byte[] sourceId){
  MDSKey.Builder keyBuilder=getProgramKeyBuilder(TYPE_RUN_RECORD_STARTING,programId);
  boolean isValid=validateExistingRecords(getRuns(programId,pid),programId,pid,sourceId,"String_Node_Str",ProgramRunStatus.STARTING);
  if (!isValid) {
    return null;
  }
  String workflowRunId=null;
  if (systemArgs != null && systemArgs.containsKey(ProgramOptionConstants.WORKFLOW_NAME)) {
    addWorkflowNodeState(programId,pid,systemArgs,ProgramRunStatus.STARTING,null,sourceId);
    workflowRunId=systemArgs.get(ProgramOptionConstants.WORKFLOW_RUN_ID);
  }
  ImmutableMap.Builder<String,String> builder=ImmutableMap.builder();
  builder.put("String_Node_Str",GSON.toJson(runtimeArgs,MAP_STRING_STRING_TYPE));
  if (workflowRunId != null) {
    builder.put("String_Node_Str",workflowRunId);
  }
  MDSKey key=keyBuilder.add(pid).build();
  RunRecordMeta meta=new RunRecordMeta(programId.run(pid),startTs,null,null,ProgramRunStatus.STARTING,builder.build(),systemArgs,twillRunId,sourceId);
  write(key,meta);
  return ProgramRunStatus.STARTING;
}

Fixed version (ground truth):
/** 
 * Logs initialization of program run and persists program status to   {@link ProgramRunStatus#STARTING}.
 * @param programId id of the program
 * @param pid run id
 * @param startTs initialization timestamp in seconds
 * @param twillRunId Twill run id
 * @param runtimeArgs the runtime arguments for this program run
 * @param systemArgs the system arguments for this program run
 * @param sourceId id of the source of program run status, which is proportional to the timestamp ofwhen the current program run status is reached, e.g. a message id from TMS
 * @return {@link ProgramRunStatus#STARTING} if it is successfully persisted, {@code null} otherwise.
 */
public ProgramRunStatus recordProgramStart(ProgramId programId,String pid,long startTs,String twillRunId,Map<String,String> runtimeArgs,Map<String,String> systemArgs,byte[] sourceId){
  MDSKey.Builder keyBuilder=getProgramKeyBuilder(TYPE_RUN_RECORD_STARTING,programId);
  boolean isValid=validateExistingRecords(getRun(programId,pid),programId,pid,sourceId,"String_Node_Str",ProgramRunStatus.STARTING);
  if (!isValid) {
    return null;
  }
  String workflowRunId=null;
  if (systemArgs != null && systemArgs.containsKey(ProgramOptionConstants.WORKFLOW_NAME)) {
    addWorkflowNodeState(programId,pid,systemArgs,ProgramRunStatus.STARTING,null,sourceId);
    workflowRunId=systemArgs.get(ProgramOptionConstants.WORKFLOW_RUN_ID);
  }
  ImmutableMap.Builder<String,String> builder=ImmutableMap.builder();
  builder.put("String_Node_Str",GSON.toJson(runtimeArgs,MAP_STRING_STRING_TYPE));
  if (workflowRunId != null) {
    builder.put("String_Node_Str",workflowRunId);
  }
  MDSKey key=keyBuilder.add(pid).build();
  RunRecordMeta meta=new RunRecordMeta(programId.run(pid),startTs,null,null,ProgramRunStatus.STARTING,builder.build(),systemArgs,twillRunId,sourceId);
  write(key,meta);
  return ProgramRunStatus.STARTING;
}