cassandra icon indicating copy to clipboard operation
cassandra copied to clipboard

CNDB-9192 Track Sensor WRITE_BYTES for Counter Mutation on leader replica

Open aymkhalil opened this issue 1 year ago • 1 comments

Addresses: https://github.com/riptano/cndb/issues/9192

Implementation notes:

  • The counter mutation on non-leader replica will be accommodated for out of the box because they translated into regular mutations (accounted for in WRITE_BYTES sensors)
  • The response from leader replica -> coordinator will only encode the leader measured sensors values (that is WRITE_BYTES_REQUEST.<counter>" & WRITE_BYTES_TABLE.<counter> in the custom headers. Please note the the leader replica (not the coordinator) is responsible for forwarding the counter mutation to other replicas and today, we don;t have a mechanism to rollup replica responses on the leader replica
  • Counter cache bytes are not accommodated for - cache is limited to counter_cache_size_in_mb

aymkhalil avatar Mar 20 '24 16:03 aymkhalil

I switched to a simpler impl that relies on replica counts instead of parsing the actual headers from non-leader replicas to send sensor values back to coordinator https://github.com/datastax/cassandra/pull/1056/commits/e68e732886fc3a613ee5d2cd3e835b9ec6a8fb6f (doesn't require wrapping response handler in CounterWriteReponseHandler anymore.

The reason I switch from passing the handler (could be the vanilla WriteResponseHandler now) is to simplify testing. Mocking replica plans inside handlers with the static assureSufficientLiveReplicasForWrite method at play was not possible.

@sbtourist PTAL

aymkhalil avatar Mar 25 '24 23:03 aymkhalil

Resolved conflicts https://github.com/datastax/cassandra/pull/1056/commits/358441b215627f651a243410cc67c84afe2096c3, merging.

aymkhalil avatar May 10 '24 22:05 aymkhalil