Skip to content

Commit 43d930f

Browse files
committed
CNDB-15946: Remove IndexContext.shadowedPrimaryKeyCount metric
1 parent a128df1 commit 43d930f

File tree

5 files changed

+3
-38
lines changed

5 files changed

+3
-38
lines changed

src/java/org/apache/cassandra/index/sai/QueryContext.java

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -83,8 +83,6 @@ public class QueryContext
8383

8484
private float annRerankFloor = 0.0f; // only called from single-threaded setup code
8585

86-
private final LongAdder shadowedPrimaryKeyCount = new LongAdder();
87-
8886
// Determines the order of using indexes for filtering and sorting.
8987
// Null means the query execution order hasn't been decided yet.
9088
private FilterSortOrder filterSortOrder = null;
@@ -296,19 +294,6 @@ public void checkpoint()
296294
}
297295
}
298296

299-
public void addShadowed(long count)
300-
{
301-
shadowedPrimaryKeyCount.add(count);
302-
}
303-
304-
/**
305-
* @return shadowed primary keys, in ascending order
306-
*/
307-
public long getShadowedPrimaryKeyCount()
308-
{
309-
return shadowedPrimaryKeyCount.longValue();
310-
}
311-
312297
public float getAnnRerankFloor()
313298
{
314299
return annRerankFloor;
@@ -366,7 +351,6 @@ public static class Snapshot
366351
public final long triePostingsDecodes;
367352
public final long queryTimeouts;
368353
public final long annGraphSearchLatency;
369-
public final long shadowedPrimaryKeyCount;
370354
public final FilterSortOrder filterSortOrder;
371355

372356
/**
@@ -394,7 +378,6 @@ private Snapshot(QueryContext context)
394378
triePostingsDecodes = context.triePostingsDecodes();
395379
queryTimeouts = context.queryTimeouts();
396380
annGraphSearchLatency = context.annGraphSearchLatency();
397-
shadowedPrimaryKeyCount = context.getShadowedPrimaryKeyCount();
398381
filterSortOrder = context.filterSortOrder();
399382
}
400383
}

src/java/org/apache/cassandra/index/sai/metrics/TableQueryMetrics.java

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -278,9 +278,6 @@ public static class PerQuery extends AbstractQueryMetrics
278278
public final Histogram kdTreePostingsSkips;
279279
public final Histogram kdTreePostingsDecodes;
280280

281-
/** Shadowed keys scan metrics **/
282-
public final Histogram shadowedKeysScannedHistogram;
283-
284281
/**
285282
* Trie index posting lists metrics.
286283
*/
@@ -319,8 +316,6 @@ public PerQuery(TableMetadata table, QueryKind queryKind, Predicate<ReadCommand>
319316
postingsSkips = Metrics.histogram(createMetricName("PostingsSkips"), true);
320317
postingsDecodes = Metrics.histogram(createMetricName("PostingsDecodes"), false);
321318

322-
shadowedKeysScannedHistogram = Metrics.histogram(createMetricName("ShadowedKeysScannedHistogram"), false);
323-
324319
// Key vector metrics that translate to performance
325320
annGraphSearchLatency = Metrics.timer(createMetricName("ANNGraphSearchLatency"));
326321
}
@@ -361,8 +356,6 @@ public void record(QueryContext.Snapshot snapshot)
361356
{
362357
annGraphSearchLatency.update(snapshot.annGraphSearchLatency, TimeUnit.NANOSECONDS);
363358
}
364-
365-
shadowedKeysScannedHistogram.update(snapshot.shadowedPrimaryKeyCount);
366359
}
367360
}
368361
}

src/java/org/apache/cassandra/index/sai/plan/QueryMonitorableExecutionInfo.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,6 @@ public String toLogString(boolean unique)
8686
appendMetric(sb, "triePostingsSkips", metrics.triePostingsSkips);
8787
appendMetric(sb, "triePostingsDecodes", metrics.triePostingsDecodes);
8888
appendMetric(sb, "annGraphSearchLatencyNanos", metrics.annGraphSearchLatency);
89-
appendMetric(sb, "shadowedPrimaryKeyCount", metrics.shadowedPrimaryKeyCount);
9089

9190
// append the plan
9291
sb.append(sectionNamePrefix).append("plan:\n").append(plan);

src/java/org/apache/cassandra/index/sai/plan/StorageAttachedIndexSearcher.java

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -526,7 +526,7 @@ public UnfilteredRowIterator apply(List<PrimaryKey> keys)
526526
UnfilteredRowIterator counted = fetchedRowsCounter.apply(partition);
527527
queryContext.addKeysFetched(keys.size());
528528
queryContext.checkpoint();
529-
return applyIndexFilter(counted, filterTree, queryContext);
529+
return applyIndexFilter(counted, filterTree);
530530
}
531531

532532
@Override
@@ -740,7 +740,7 @@ public UnfilteredRowIterator readAndValidatePartition(PrimaryKey pk, List<Primar
740740
queryContext.checkpoint();
741741

742742
UnfilteredRowIterator counted = fetchedRowsCounter.apply(partition);
743-
UnfilteredRowIterator clusters = applyIndexFilter(counted, filterTree, queryContext);
743+
UnfilteredRowIterator clusters = applyIndexFilter(counted, filterTree);
744744

745745
if (clusters == null)
746746
return null;
@@ -864,13 +864,12 @@ protected Unfiltered computeNext()
864864
}
865865
}
866866

867-
private static UnfilteredRowIterator applyIndexFilter(UnfilteredRowIterator partition, FilterTree tree, QueryContext queryContext)
867+
private static UnfilteredRowIterator applyIndexFilter(UnfilteredRowIterator partition, FilterTree tree)
868868
{
869869
FilteringPartitionIterator filtered = new FilteringPartitionIterator(partition, tree);
870870
if (!filtered.hasNext() && !filtered.matchesStaticRow())
871871
{
872872
// shadowed by expired TTL or row tombstone or range tombstone
873-
queryContext.addShadowed(1);
874873
filtered.close();
875874
return null;
876875
}

test/distributed/org/apache/cassandra/distributed/test/sai/SlowSAIQueryLoggerTest.java

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,6 @@ public void testSlowSAIQueryLogger() throws Throwable
107107
"triePostingsSkips: 0",
108108
"triePostingsDecodes: 0",
109109
"annGraphSearchLatencyNanos: 0",
110-
"shadowedPrimaryKeyCount",
111110
"SAI slow query plan:",
112111
"NumericIndexScan");
113112

@@ -133,7 +132,6 @@ public void testSlowSAIQueryLogger() throws Throwable
133132
"triePostingsSkips: 0",
134133
"triePostingsDecodes: 0",
135134
"annGraphSearchLatencyNanos: 0",
136-
"shadowedPrimaryKeyCount",
137135
"SAI slowest query plan:",
138136
"NumericIndexScan");
139137

@@ -159,7 +157,6 @@ public void testSlowSAIQueryLogger() throws Throwable
159157
"triePostingsSkips: 0",
160158
"triePostingsDecodes: 2",
161159
"annGraphSearchLatencyNanos: 0",
162-
"shadowedPrimaryKeyCount: 0",
163160
"SAI slow query plan:",
164161
"LiteralIndexScan");
165162

@@ -185,7 +182,6 @@ public void testSlowSAIQueryLogger() throws Throwable
185182
"triePostingsSkips: 0",
186183
"triePostingsDecodes: 2",
187184
"annGraphSearchLatencyNanos: 0",
188-
"shadowedPrimaryKeyCount: 0",
189185
"SAI slowest query plan:",
190186
"LiteralIndexScan");
191187

@@ -211,7 +207,6 @@ public void testSlowSAIQueryLogger() throws Throwable
211207
"triePostingsSkips: 0",
212208
"triePostingsDecodes: 0",
213209
"annGraphSearchLatencyNanos: [1-9][0-9]*", // unknown, but greater than zero
214-
"shadowedPrimaryKeyCount: 0",
215210
"SAI slow query plan:",
216211
"AnnIndexScan");
217212

@@ -237,7 +232,6 @@ public void testSlowSAIQueryLogger() throws Throwable
237232
"triePostingsSkips: 0",
238233
"triePostingsDecodes: 0",
239234
"annGraphSearchLatencyNanos: [1-9][0-9]*", // unknown, but greater than zero
240-
"shadowedPrimaryKeyCount: 0",
241235
"SAI slowest query plan:",
242236
"AnnIndexScan");
243237

@@ -263,7 +257,6 @@ public void testSlowSAIQueryLogger() throws Throwable
263257
"triePostingsSkips: 0",
264258
"triePostingsDecodes: 0",
265259
"annGraphSearchLatencyNanos: 0",
266-
"shadowedPrimaryKeyCount: 1",
267260
"SAI slow query plan:",
268261
"LiteralIndexScan");
269262

@@ -289,7 +282,6 @@ public void testSlowSAIQueryLogger() throws Throwable
289282
"triePostingsSkips: 0",
290283
"triePostingsDecodes: 0",
291284
"annGraphSearchLatencyNanos: 0",
292-
"shadowedPrimaryKeyCount: 1",
293285
"SAI slowest query plan:",
294286
"LiteralIndexScan");
295287

@@ -315,7 +307,6 @@ public void testSlowSAIQueryLogger() throws Throwable
315307
"triePostingsSkips: 0",
316308
"triePostingsDecodes: 0",
317309
"annGraphSearchLatencyNanos: 0",
318-
"shadowedPrimaryKeyCount: 0",
319310
"SAI slow query plan:",
320311
"KeysSort",
321312
"NumericIndexScan");

0 commit comments

Comments
 (0)