echo
----
----
-- (Issuing 1x1MiB, 3x replicated write that's not admitted.)


-- Flow token metrics from n1 after issuing 1x1MiB regular 3x replicated write
-- that's not admitted. We see 1*1MiB*3=3MiB deductions of regular tokens with
-- no corresponding returns.
SELECT name, crdb_internal.humanize_bytes(value::INT8)
    FROM crdb_internal.node_metrics
   WHERE name LIKE '%kvadmission%regular_tokens%'
ORDER BY name ASC;

  kvadmission.flow_controller.regular_tokens_available   | 45 MiB   
  kvadmission.flow_controller.regular_tokens_deducted    | 3.0 MiB  
  kvadmission.flow_controller.regular_tokens_returned    | 0 B      
  kvadmission.flow_controller.regular_tokens_unaccounted | 0 B      


-- (Transferring range lease to n2 and allowing leadership to follow.)


-- Flow token metrics from n1 having lost the lease and raft leadership. All
-- deducted tokens are returned.
SELECT name, crdb_internal.humanize_bytes(value::INT8)
    FROM crdb_internal.node_metrics
   WHERE name LIKE '%kvadmission%regular_tokens%'
ORDER BY name ASC;

  kvadmission.flow_controller.regular_tokens_available   | 48 MiB   
  kvadmission.flow_controller.regular_tokens_deducted    | 3.0 MiB  
  kvadmission.flow_controller.regular_tokens_returned    | 3.0 MiB  
  kvadmission.flow_controller.regular_tokens_unaccounted | 0 B      
----
----

# vim:ft=sql
