diff --git a/internal/venice-test-common/src/integrationTest/java/com/linkedin/venice/fastclient/FastClientIndividualFeatureConfigurationTest.java b/internal/venice-test-common/src/integrationTest/java/com/linkedin/venice/fastclient/FastClientIndividualFeatureConfigurationTest.java index 91740a0ed6..f7f2d1cc5e 100644 --- a/internal/venice-test-common/src/integrationTest/java/com/linkedin/venice/fastclient/FastClientIndividualFeatureConfigurationTest.java +++ b/internal/venice-test-common/src/integrationTest/java/com/linkedin/venice/fastclient/FastClientIndividualFeatureConfigurationTest.java @@ -186,6 +186,10 @@ public void testServerReadQuota() throws Exception { LOGGER.info("RESTARTING servers"); veniceCluster.stopAndRestartVeniceServer(veniceServerWrapper.getPort()); } + serverMetrics.clear(); + for (int i = 0; i < veniceCluster.getVeniceServers().size(); i++) { + serverMetrics.add(veniceCluster.getVeniceServers().get(i).getMetricsRepository()); + } for (int j = 0; j < 5; j++) { for (int i = 0; i < recordCnt; i++) { String key = keyPrefix + i; @@ -198,7 +202,7 @@ public void testServerReadQuota() throws Exception { quotaRequestedQPSSum += serverMetric.getMetric(readQuotaRequestedQPSString).value(); assertEquals(serverMetric.getMetric(readQuotaAllowedUnintentionally).value(), 0d); } - assertTrue(quotaRequestedQPSSum >= 0, "Quota request sum: " + quotaRequestedQPSSum); + assertTrue(quotaRequestedQPSSum > 0, "Quota request sum: " + quotaRequestedQPSSum); } @Test(timeOut = TIME_OUT) diff --git a/services/venice-server/src/main/java/com/linkedin/venice/listener/ReadQuotaEnforcementHandler.java b/services/venice-server/src/main/java/com/linkedin/venice/listener/ReadQuotaEnforcementHandler.java index 72dc406434..444041d59c 100644 --- a/services/venice-server/src/main/java/com/linkedin/venice/listener/ReadQuotaEnforcementHandler.java +++ b/services/venice-server/src/main/java/com/linkedin/venice/listener/ReadQuotaEnforcementHandler.java @@ -173,6 +173,8 @@ public final void init() { for (Version version: versions) { customizedViewRepository.subscribeRoutingDataChange(version.kafkaTopicName(), this); } + // also invoke handle store change to ensure corresponding token bucket and stats are initialized. + handleStoreChanged(store); } this.initializedVolatile = true; }