Skip to content

Commit

Permalink
Fixing requestId generator bug in PinotBrokerDebug Resource
Browse files Browse the repository at this point in the history
  • Loading branch information
xiangfu0 committed Jul 30, 2024
1 parent a6cf197 commit a137615
Showing 1 changed file with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@
public class PinotBrokerDebug {

// Request ID is passed to the RoutingManager to rotate the selected replica-group.
private final AtomicLong _requestIdGenerator = new AtomicLong();
private final static AtomicLong REQUEST_ID_GENERATOR = new AtomicLong();

@Inject
private BrokerRoutingManager _routingManager;
Expand Down Expand Up @@ -272,7 +272,10 @@ public String getServerRoutingStats() {
}

private long getRequestId() {
return _requestIdGenerator.getAndIncrement();
if (REQUEST_ID_GENERATOR.get() == Long.MAX_VALUE) {
REQUEST_ID_GENERATOR.set(0);
}
return REQUEST_ID_GENERATOR.getAndIncrement();
}

@GET
Expand Down

0 comments on commit a137615

Please sign in to comment.