Skip to content

Commit

Permalink
fixes lint
Browse files Browse the repository at this point in the history
  • Loading branch information
noob-se7en committed Jan 16, 2025
1 parent ed90f11 commit e88aa2a
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
*/
package org.apache.pinot.controller.api.resources;

import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.JsonNode;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiKeyAuthDefinition;
Expand Down Expand Up @@ -239,22 +238,8 @@ public JsonNode getForceCommitJobStatus(
controllerJobZKMetadata.put(CommonConstants.ControllerJob.CONSUMING_SEGMENTS_YET_TO_BE_COMMITTED_LIST,
JsonUtils.objectToString(segmentsYetToBeCommitted));

_pinotHelixResourceManager.addControllerJobToZK(forceCommitJobId,
controllerJobZKMetadata, ControllerJobType.FORCE_COMMIT, prevJobMetadata -> {
String existingSegmentsYetToBeCommittedString =
prevJobMetadata.get(CommonConstants.ControllerJob.CONSUMING_SEGMENTS_YET_TO_BE_COMMITTED_LIST);
if (existingSegmentsYetToBeCommittedString == null) {
return true;
}
try {
Set<String> existingSegmentsYetToBeCommitted =
JsonUtils.stringToObject(existingSegmentsYetToBeCommittedString, Set.class);
return segmentsYetToBeCommitted.size() < existingSegmentsYetToBeCommitted.size();
} catch (JsonProcessingException e) {
return false;
}
}
);
_pinotHelixResourceManager.updateForceCommitJobMetadata(forceCommitJobId, segmentsYetToBeCommitted,
controllerJobZKMetadata);

Map<String, Object> result = new HashMap<>(controllerJobZKMetadata);
result.put("numberOfSegmentsYetToBeCommitted", segmentsYetToBeCommitted.size());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2254,6 +2254,26 @@ public boolean addNewForceCommitJob(String tableNameWithType, String jobId, long
return addControllerJobToZK(jobId, jobMetadata, ControllerJobType.FORCE_COMMIT);
}

public void updateForceCommitJobMetadata(String forceCommitJobId, Set<String> segmentsYetToBeCommitted,
Map<String, String> controllerJobZKMetadata) {
addControllerJobToZK(forceCommitJobId,
controllerJobZKMetadata, ControllerJobType.FORCE_COMMIT, prevJobMetadata -> {
String existingSegmentsYetToBeCommittedString =
prevJobMetadata.get(CommonConstants.ControllerJob.CONSUMING_SEGMENTS_YET_TO_BE_COMMITTED_LIST);
if (existingSegmentsYetToBeCommittedString == null) {
return true;
}
try {
Set<String> existingSegmentsYetToBeCommitted =
JsonUtils.stringToObject(existingSegmentsYetToBeCommittedString, Set.class);
return segmentsYetToBeCommitted.size() < existingSegmentsYetToBeCommitted.size();
} catch (JsonProcessingException e) {
return false;
}
}
);
}

/**
* Adds a new job metadata for controller job like table rebalance or reload into ZK
* @param jobId job's UUID
Expand Down

0 comments on commit e88aa2a

Please sign in to comment.