Bug: system keyspace accesses are counted towards ClientRequestMetrics
Status: Triage Needed
Priority: Low
Created: 15/Feb/24 14:06

Mutating system keyspaces by the internal processes bumps ClientRequestMetrics.

For example, creating a MV makes updates to `system_distributed.view_build_status`.
Changing status of MV building will be counted towards client writeMetrics.

Example stacktrace of MV build status update, which triggers StorageProxy.mutate which unconditionally bumps (client) `writeMetrics`:
{{        at org.apache.cassandra.service.StorageProxy.mutate(StorageProxy.java:1095)}}
{{        at org.apache.cassandra.service.StorageProxy.mutateWithTriggers(StorageProxy.java:1290)}}
{{        at org.apache.cassandra.cql3.statements.ModificationStatement.executeWithoutCondition(ModificationStatement.java:503)}}
{{        at org.apache.cassandra.cql3.statements.ModificationStatement.execute(ModificationStatement.java:483)}}
{{        at org.apache.cassandra.cql3.QueryProcessor.processStatement(QueryProcessor.java:290)}}
{{        at org.apache.cassandra.cql3.QueryProcessor.process(QueryProcessor.java:400)}}
{{        at org.apache.cassandra.cql3.QueryProcessor.process(QueryProcessor.java:406)}}
{{        at org.apache.cassandra.cql3.QueryProcessor.process(QueryProcessor.java:424)}}
{{        at org.apache.cassandra.repair.SystemDistributedKeyspace.successfulViewBuild(SystemDistributedKeyspace.java:322)}}
{{        at org.apache.cassandra.db.view.ViewBuilder.updateDistributed(ViewBuilder.java:219)}}
{{        at org.apache.cassandra.db.view.ViewBuilder.finish(ViewBuilder.java:212)}}
{{        at org.apache.cassandra.db.view.ViewBuilder.build(ViewBuilder.java:153)}}
{{        at org.apache.cassandra.db.view.ViewBuilder$1.onSuccess(ViewBuilder.java:187)}}
{{        at org.apache.cassandra.db.view.ViewBuilder$1.onSuccess(ViewBuilder.java:181)}}
{{        at com.google.common.util.concurrent.Futures$CallbackListener.run(Futures.java:1062)}}
{{        at com.google.common.util.concurrent.DirectExecutor.execute(DirectExecutor.java:30)}}
{{        at com.google.common.util.concurrent.AbstractFuture.executeListener(AbstractFuture.java:1138)}}
{{        at com.google.common.util.concurrent.AbstractFuture.complete(AbstractFuture.java:958)}}
{{        at com.google.common.util.concurrent.AbstractFuture.set(AbstractFuture.java:726)}}
{{        at com.google.common.util.concurrent.CollectionFuture$CollectionFutureRunningState.handleAllCompleted(CollectionFuture.java:71)}}
{{        at com.google.common.util.concurrent.AggregateFuture$RunningState.processCompleted(AggregateFuture.java:257)}}
{{        at com.google.common.util.concurrent.AggregateFuture$RunningState.decrementCountAndMaybeComplete(AggregateFuture.java:244)}}
{{        at com.google.common.util.concurrent.AggregateFuture$RunningState.access$300(AggregateFuture.java:92)}}
{{        at com.google.common.util.concurrent.AggregateFuture$RunningState$1.run(AggregateFuture.java:149)}}
{{        at com.google.common.util.concurrent.DirectExecutor.execute(DirectExecutor.java:30)}}
{{        at com.google.common.util.concurrent.ExecutionList.executeListener(ExecutionList.java:141)}}
{{        at com.google.common.util.concurrent.ExecutionList.execute(ExecutionList.java:130)}}
{{        at com.google.common.util.concurrent.ListenableFutureTask.done(ListenableFutureTask.java:86)}}
{{        at java.base/java.util.concurrent.FutureTask.finishCompletion(FutureTask.java:381)}}
{{        at java.base/java.util.concurrent.FutureTask.set(FutureTask.java:232)}}
{{        at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:272)}}
{{        at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)}}
{{        at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)}}
{{        at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)}}
{{        at java.base/java.lang.Thread.run(Thread.java:829)}}