Skip to content

Commit 14fe1f6

Browse files
pthirunclaude
andcommitted
Fix SpotBugs violation in getRepushInfo route
The gRPC response from the handler was not being used - instead, the code was calling admin.getRepushInfo() directly. This fix adds a conversion method to properly map RepushInfoGrpc and VersionGrpc to their Java counterparts and uses the converted response. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
1 parent 8a0edd7 commit 14fe1f6

1 file changed

Lines changed: 34 additions & 2 deletions

File tree

  • services/venice-controller/src/main/java/com/linkedin/venice/controller/server

services/venice-controller/src/main/java/com/linkedin/venice/controller/server/StoresRoutes.java

Lines changed: 34 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,8 @@
108108
import com.linkedin.venice.meta.StoreDataAudit;
109109
import com.linkedin.venice.meta.StoreInfo;
110110
import com.linkedin.venice.meta.Version;
111+
import com.linkedin.venice.meta.VersionImpl;
112+
import com.linkedin.venice.meta.VersionStatus;
111113
import com.linkedin.venice.protocols.controller.ClusterStoreGrpcInfo;
112114
import com.linkedin.venice.protocols.controller.GetRepushInfoGrpcRequest;
113115
import com.linkedin.venice.protocols.controller.GetRepushInfoGrpcResponse;
@@ -116,6 +118,7 @@
116118
import com.linkedin.venice.protocols.controller.RepushInfoGrpc;
117119
import com.linkedin.venice.protocols.controller.ValidateStoreDeletedGrpcRequest;
118120
import com.linkedin.venice.protocols.controller.ValidateStoreDeletedGrpcResponse;
121+
import com.linkedin.venice.protocols.controller.VersionGrpc;
119122
import com.linkedin.venice.pubsub.PubSubTopicRepository;
120123
import com.linkedin.venice.pubsub.api.PubSubTopic;
121124
import com.linkedin.venice.pubsub.api.exceptions.PubSubTopicDoesNotExistException;
@@ -283,8 +286,7 @@ public void internalHandle(Request request, RepushInfoResponse veniceResponse) {
283286
veniceResponse.setName(storeName);
284287

285288
// Convert proto RepushInfo back to Java RepushInfo for HTTP response
286-
RepushInfoGrpc repushInfoProto = grpcResponse.getRepushInfo();
287-
RepushInfo repushInfo = admin.getRepushInfo(clusterName, storeName, Optional.ofNullable(fabricName));
289+
RepushInfo repushInfo = mapGrpcRepushInfoToRepushInfo(grpcResponse.getRepushInfo(), storeName);
288290

289291
veniceResponse.setRepushInfo(repushInfo);
290292
}
@@ -1245,4 +1247,34 @@ public void internalHandle(Request request, StoreDeletedValidationResponse venic
12451247
}
12461248
};
12471249
}
1250+
1251+
/**
1252+
* Converts a gRPC RepushInfoGrpc message to a RepushInfo object.
1253+
* @param repushInfoProto the gRPC message
1254+
* @param storeName the store name needed for Version creation
1255+
* @return the converted RepushInfo object
1256+
*/
1257+
RepushInfo mapGrpcRepushInfoToRepushInfo(RepushInfoGrpc repushInfoProto, String storeName) {
1258+
Version version = null;
1259+
if (repushInfoProto.hasVersion()) {
1260+
VersionGrpc versionProto = repushInfoProto.getVersion();
1261+
version = new VersionImpl(
1262+
storeName,
1263+
versionProto.getNumber(),
1264+
versionProto.getCreatedTime(),
1265+
versionProto.getPushJobId(),
1266+
versionProto.getPartitionCount(),
1267+
null,
1268+
null);
1269+
version.setStatus(VersionStatus.getVersionStatusFromInt(versionProto.getStatus()));
1270+
}
1271+
1272+
return RepushInfo.createRepushInfo(
1273+
version,
1274+
repushInfoProto.getKafkaBrokerUrl(),
1275+
repushInfoProto.hasSystemSchemaClusterD2ServiceName()
1276+
? repushInfoProto.getSystemSchemaClusterD2ServiceName()
1277+
: null,
1278+
repushInfoProto.hasSystemSchemaClusterD2ZkHost() ? repushInfoProto.getSystemSchemaClusterD2ZkHost() : null);
1279+
}
12481280
}

0 commit comments

Comments
 (0)