Skip to content

Commit 38abe79

Browse files
committed
address review comments
1 parent 76fe392 commit 38abe79

3 files changed

Lines changed: 34 additions & 29 deletions

File tree

clients/da-vinci-client/src/test/java/com/linkedin/davinci/kafka/consumer/ActiveKeyCountScenarioTest.java

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -348,8 +348,10 @@ public void testInvalidationParityRecordsToBothTehutiAndOtel() {
348348
.build());
349349
AsyncGauge.AsyncGaugeExecutor asyncGaugeExecutor = new AsyncGauge.AsyncGaugeExecutor.Builder().build();
350350
TestMockTime mockTime = new TestMockTime();
351-
// 3-arg ctor wires mockTime into MetricsRepository.measure(now); the 1-arg MetricConfig form
352-
// silently uses SystemTime, which would defeat the time-advance below.
351+
/*
352+
* 3-arg ctor wires mockTime into MetricsRepository.measure(now); the 1-arg MetricConfig form
353+
* silently uses SystemTime, which would defeat the time-advance below.
354+
*/
353355
MetricsRepository tehutiRepo =
354356
new MetricsRepository(new MetricConfig(asyncGaugeExecutor), Collections.emptyList(), mockTime);
355357

@@ -386,8 +388,10 @@ public void testInvalidationParityRecordsToBothTehutiAndOtel() {
386388
ACTIVE_KEY_COUNT_INVALIDATION.getMetricEntity().getMetricName(),
387389
TEST_PREFIX);
388390

389-
// LongAdderRateGauge caches its value for RATE_GAUGE_CACHE_DURATION_IN_SECONDS; advance past
390-
// the window to force a fresh measurement.
391+
/*
392+
* LongAdderRateGauge caches its value for RATE_GAUGE_CACHE_DURATION_IN_SECONDS; advance past
393+
* the window to force a fresh measurement.
394+
*/
391395
mockTime.addMilliseconds(LongAdderRateGauge.RATE_GAUGE_CACHE_DURATION_IN_SECONDS * Time.MS_PER_SECOND);
392396
assertEquals(
393397
tehutiRepo.getMetric(".total--active_key_count_invalidation.Rate").value(),

clients/da-vinci-client/src/test/java/com/linkedin/davinci/kafka/consumer/ActiveKeyCountTest.java

Lines changed: 22 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -476,7 +476,7 @@ public void testBatchPutReturnsValueOperationType(int schemaId, String desc) {
476476
}
477477

478478
@Test(dataProvider = "putRmdWithSchemaIds")
479-
public void testPutInStorageEngine_batchRmdEnabled_writesRmd(int schemaId, String desc) throws Exception {
479+
public void testPutInStorageEngineBatchRmdEnabledWritesRmd(int schemaId, String desc) throws Exception {
480480
setupForStorageEngineTests(true);
481481
ingestionTask.putInStorageEngine(PARTITION, KEY_BYTES, createBatchPut(schemaId));
482482
verify(storageEngine)
@@ -485,7 +485,7 @@ public void testPutInStorageEngine_batchRmdEnabled_writesRmd(int schemaId, Strin
485485
}
486486

487487
@Test
488-
public void testPutInStorageEngine_batchRmdEnabled_chunkFragment_fallsThrough() throws Exception {
488+
public void testPutInStorageEngineBatchRmdEnabledChunkFragmentFallsThrough() throws Exception {
489489
setupForStorageEngineTests(true);
490490
ingestionTask.putInStorageEngine(PARTITION, KEY_BYTES, createBatchPut(CHUNK_SCHEMA_ID));
491491
verify(storageEngine).put(anyInt(), any(byte[].class), any(ByteBuffer.class));
@@ -494,8 +494,7 @@ public void testPutInStorageEngine_batchRmdEnabled_chunkFragment_fallsThrough()
494494
}
495495

496496
@Test(dataProvider = "putFallThroughCases")
497-
public void testPutInStorageEngine_fallsThrough(boolean addRmdEnabled, boolean postEop, String desc)
498-
throws Exception {
497+
public void testPutInStorageEngineFallsThrough(boolean addRmdEnabled, boolean postEop, String desc) throws Exception {
499498
setupForStorageEngineTests(addRmdEnabled);
500499
doReturn(postEop).when(pcs).isEndOfPushReceived();
501500
ingestionTask.putInStorageEngine(PARTITION, KEY_BYTES, createBatchPut(USER_SCHEMA_ID));
@@ -505,7 +504,7 @@ public void testPutInStorageEngine_fallsThrough(boolean addRmdEnabled, boolean p
505504
}
506505

507506
@Test
508-
public void testPutInStorageEngine_batchRmdEnabled_pcsNull_fallsThrough() throws Exception {
507+
public void testPutInStorageEngineBatchRmdEnabledPcsNullFallsThrough() throws Exception {
509508
setupPcsNullFallThrough();
510509
doCallRealMethod().when(ingestionTask).putInStorageEngine(anyInt(), any(), any(Put.class));
511510
doReturn(ActiveActiveStoreIngestionTask.StorageOperationType.VALUE).when(ingestionTask)
@@ -520,15 +519,15 @@ public void testPutInStorageEngine_batchRmdEnabled_pcsNull_fallsThrough() throws
520519
// regardless of addRmdToBatchPushForHybridStores, so the ts=0 sentinel only applies to PUTs.
521520

522521
@Test
523-
public void testRemoveFromStorageEngine_batchDeleteAlwaysUsesPlainDelete() throws Exception {
522+
public void testRemoveFromStorageEngineBatchDeleteAlwaysUsesPlainDelete() throws Exception {
524523
setupForStorageEngineTests(true); // addRmdEnabled=true, but DELETE should still use plain delete
525524
ingestionTask.removeFromStorageEngine(PARTITION, KEY_BYTES, createBatchDelete());
526525
verify(storageEngine).delete(anyInt(), any(byte[].class));
527526
verify(storageEngine, never()).deleteWithReplicationMetadata(anyInt(), any(byte[].class), any(byte[].class));
528527
}
529528

530529
@Test
531-
public void testRemoveFromStorageEngine_postEop_goesToValueAndRmd() throws Exception {
530+
public void testRemoveFromStorageEnginePostEopGoesToValueAndRmd() throws Exception {
532531
setupForStorageEngineTests(true);
533532
doReturn(true).when(pcs).isEndOfPushReceived();
534533
ingestionTask.removeFromStorageEngine(PARTITION, KEY_BYTES, createBatchDelete());
@@ -540,7 +539,7 @@ public void testRemoveFromStorageEngine_postEop_goesToValueAndRmd() throws Excep
540539
// trackActiveKeyCount
541540

542541
@Test
543-
public void testTrackActiveKeyCount_batchCounting_schemaFiltering() throws Exception {
542+
public void testTrackActiveKeyCountBatchCountingSchemaFiltering() throws Exception {
544543
setupForTrackActiveKeyCount(true, false, false);
545544
// Non-chunked PUT and manifest: counted
546545
for (int schemaId: new int[] { USER_SCHEMA_ID, CHUNK_MANIFEST_SCHEMA_ID }) {
@@ -565,7 +564,7 @@ public void testTrackActiveKeyCount_batchCounting_schemaFiltering() throws Excep
565564
}
566565

567566
@Test(dataProvider = "batchCountingSkippedCases")
568-
public void testTrackActiveKeyCount_batchCounting_skipped(
567+
public void testTrackActiveKeyCountBatchCountingSkipped(
569568
boolean batchEnabled,
570569
boolean postEop,
571570
MessageType messageType,
@@ -583,7 +582,7 @@ public void testTrackActiveKeyCount_batchCounting_skipped(
583582
}
584583

585584
@Test
586-
public void testTrackActiveKeyCount_batchAndFollower_bothEnabled() throws Exception {
585+
public void testTrackActiveKeyCountBatchAndFollowerBothEnabled() throws Exception {
587586
setupForTrackActiveKeyCount(true, true, true);
588587
PartitionConsumptionState mockPcs = createMockPcsForTrack(false, -1L);
589588
invokeTrackActiveKeyCount(
@@ -597,7 +596,7 @@ public void testTrackActiveKeyCount_batchAndFollower_bothEnabled() throws Except
597596
}
598597

599598
@Test
600-
public void testTrackActiveKeyCount_followerSignal_createdAndDeleted() throws Exception {
599+
public void testTrackActiveKeyCountFollowerSignalCreatedAndDeleted() throws Exception {
601600
setupForTrackActiveKeyCount(false, true, true);
602601
// Created signal
603602
PartitionConsumptionState mockPcs1 = createMockPcsForTrack(true, 5L);
@@ -671,7 +670,7 @@ public void testFollowerSignalInvalidatesCount(
671670
}
672671

673672
@Test(dataProvider = "followerSignalSkippedCases")
674-
public void testTrackActiveKeyCount_followerSignal_skipped(
673+
public void testTrackActiveKeyCountFollowerSignalSkipped(
675674
boolean hybridEnabled,
676675
boolean isAA,
677676
boolean postEop,
@@ -693,7 +692,7 @@ public void testTrackActiveKeyCount_followerSignal_skipped(
693692
}
694693

695694
@Test
696-
public void testTrackActiveKeyCount_followerSignal_chunkFiltering() throws Exception {
695+
public void testTrackActiveKeyCountFollowerSignalChunkFiltering() throws Exception {
697696
setupForTrackActiveKeyCount(false, true, true);
698697
// Manifest: signal applied
699698
PartitionConsumptionState manifestPcs = createMockPcsForTrack(true, 5L);
@@ -716,7 +715,7 @@ public void testTrackActiveKeyCount_followerSignal_chunkFiltering() throws Excep
716715
}
717716

718717
@Test
719-
public void testTrackActiveKeyCount_followerSignal_headerAbsentOrInvalid() throws Exception {
718+
public void testTrackActiveKeyCountFollowerSignalHeaderAbsentOrInvalid() throws Exception {
720719
setupForTrackActiveKeyCount(false, true, true);
721720
// Test missing header, null value header, and empty byte array header
722721
PubSubMessageHeaders[] headerCases =
@@ -739,7 +738,7 @@ public void testTrackActiveKeyCount_followerSignal_headerAbsentOrInvalid() throw
739738
// processMessageAndMaybeProduceToKafka
740739

741740
@Test
742-
public void testProcessMessage_signalIncrementAndDecrement() throws Exception {
741+
public void testProcessMessageSignalIncrementAndDecrement() throws Exception {
743742
setupForProcessMessageTests(true);
744743
doReturn(true).when(pcs).isEndOfPushReceived();
745744
doReturn(5L).when(pcs).getActiveKeyCount();
@@ -775,7 +774,7 @@ public void testProcessMessage_signalIncrementAndDecrement() throws Exception {
775774
}
776775

777776
@Test
778-
public void testProcessMessage_noCountChange() throws Exception {
777+
public void testProcessMessageNoCountChange() throws Exception {
779778
setupForProcessMessageTests(true);
780779
doReturn(true).when(pcs).isEndOfPushReceived();
781780
doReturn(5L).when(pcs).getActiveKeyCount();
@@ -801,7 +800,7 @@ public void testProcessMessage_noCountChange() throws Exception {
801800
}
802801

803802
@Test
804-
public void testProcessMessage_signalSkipped_featureDisabled() throws Exception {
803+
public void testProcessMessageSignalSkippedFeatureDisabled() throws Exception {
805804
setupForProcessMessageTests(false);
806805
doReturn(true).when(pcs).isEndOfPushReceived();
807806
doReturn(5L).when(pcs).getActiveKeyCount();
@@ -908,7 +907,7 @@ public void testInvalidateActiveKeyCountLogsEvenWhenInternalsThrow() throws Exce
908907
}
909908

910909
@Test
911-
public void testProcessMessage_midRecordInvalidation_propagatesInvalidateSignal() throws Exception {
910+
public void testMidRecordInvalidationPropagatesInvalidateSignal() throws Exception {
912911
setupForProcessMessageTests(true);
913912
doReturn(true).when(pcs).isEndOfPushReceived();
914913
// PCS count is -1 (invalidated mid-record by keyExists failure), but the wrapper
@@ -993,7 +992,7 @@ private void setupForValueLookup(boolean keyExists) throws Exception {
993992
}
994993

995994
@Test
996-
public void testWasOldValueAlive_allBranches() throws Exception {
995+
public void testWasOldValueAliveAllBranches() throws Exception {
997996
// Feature disabled → always false
998997
setField(ingestionTask, "activeKeyCountForHybridStoreEnabled", false);
999998
Assert
@@ -1048,7 +1047,7 @@ public void testWasOldValueAlive_allBranches() throws Exception {
10481047
}
10491048

10501049
@Test
1051-
public void testIsValuePresentForKey_allTiers() throws Exception {
1050+
public void testIsValuePresentForKeyAllTiers() throws Exception {
10521051
setField(ingestionTask, "storageEngine", storageEngine);
10531052

10541053
// Tier 1: Lazy already resolved by DCR → returns cached result
@@ -1077,7 +1076,7 @@ public void testIsValuePresentForKey_allTiers() throws Exception {
10771076
}
10781077

10791078
@Test
1080-
public void testIsValuePresentForKey_tier3_chunkedStore_usesChunkingSuffix() throws Exception {
1079+
public void testIsValuePresentForKeyTier3ChunkedStoreUsesChunkingSuffix() throws Exception {
10811080
setField(ingestionTask, "storageEngine", storageEngine);
10821081
// Enable chunking on the ingestion task
10831082
setField(ingestionTask, "isChunked", true);
@@ -1103,7 +1102,7 @@ public void testIsValuePresentForKey_tier3_chunkedStore_usesChunkingSuffix() thr
11031102
}
11041103

11051104
@Test
1106-
public void testIsValuePresentForKey_tier3_nonChunkedStore_usesRawKey() throws Exception {
1105+
public void testIsValuePresentForKeyTier3NonChunkedStoreUsesRawKey() throws Exception {
11071106
setField(ingestionTask, "storageEngine", storageEngine);
11081107
// Chunking disabled
11091108
setField(ingestionTask, "isChunked", false);
@@ -1119,7 +1118,7 @@ public void testIsValuePresentForKey_tier3_nonChunkedStore_usesRawKey() throws E
11191118
}
11201119

11211120
@Test
1122-
public void testIsValuePresentForKey_tier3_keyExistsThrows_invalidatesAndReturnsFalse() throws Exception {
1121+
public void testIsValuePresentForKeyTier3KeyExistsThrowsInvalidatesAndReturnsFalse() throws Exception {
11231122
setField(ingestionTask, "storageEngine", storageEngine);
11241123
setField(ingestionTask, "isChunked", false);
11251124
doReturn(false).when(ingestionTask).isChunked();

clients/da-vinci-client/src/test/java/com/linkedin/davinci/stats/AggHostLevelIngestionStatsTest.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -290,8 +290,10 @@ public void testActiveKeyCountMetricsAbsentWhenDisabled() {
290290

291291
@Test
292292
public void testActiveKeyCountMetricsRegisteredWhenEnabled() {
293-
// Do NOT close localRepo: closing shuts down the JVM-static DEFAULT_ASYNC_GAUGE_EXECUTOR and
294-
// breaks every subsequent AsyncGauge in this JVM.
293+
/*
294+
* Do NOT close localRepo: closing shuts down the JVM-static DEFAULT_ASYNC_GAUGE_EXECUTOR and
295+
* breaks every subsequent AsyncGauge in this JVM.
296+
*/
295297
TestMockTime time = new TestMockTime();
296298
MetricsRepository localRepo = new MetricsRepository(time);
297299
VeniceServerConfig enabledConfig = mock(VeniceServerConfig.class);

0 commit comments

Comments
 (0)