cassandra-pr mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From GitBox <>
Subject [GitHub] [cassandra] yifan-c commented on a change in pull request #404: New/fql
Date Fri, 31 Jan 2020 00:40:34 GMT
yifan-c commented on a change in pull request #404: New/fql

 File path: doc/source/new/fqllogging.rst
 @@ -0,0 +1,705 @@
+.. Licensed to the Apache Software Foundation (ASF) under one
+.. or more contributor license agreements.  See the NOTICE file
+.. distributed with this work for additional information
+.. regarding copyright ownership.  The ASF licenses this file
+.. to you under the Apache License, Version 2.0 (the
+.. "License"); you may not use this file except in compliance
+.. with the License.  You may obtain a copy of the License at
+.. Unless required by applicable law or agreed to in writing, software
+.. distributed under the License is distributed on an "AS IS" BASIS,
+.. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+.. See the License for the specific language governing permissions and
+.. limitations under the License.
+Full Query Logging
+Apache Cassandra 4.0 adds a new feature to support a means of logging all queries as they
were invoked (`CASSANDRA-13983
+<>`_). For correctness testing
it's useful to be able to capture production traffic so that it can be replayed against both
the old and new versions of Cassandra while comparing the results.
+Cassandra 4.0 includes an implementation of a full query logging (FQL) that uses chronicle-queue
to implement a rotating log of queries. Some of the features of FQL are:
+- Single thread asynchronously writes log entries to disk to reduce impact on query latency
+- Heap memory usage bounded by a weighted queue with configurable maximum weight sitting
in front of logging thread
+- If the weighted queue is full producers can be blocked or samples can be dropped
+- Disk utilization is bounded by deleting old log segments once a configurable size is reached
+- The on disk serialization uses a flexible schema binary format (chronicle-wire) making
it easy to skip unrecognized fields, add new ones, and omit old ones.
+- Can be enabled and configured via JMX, disabled, and reset (delete on disk data), logging
path is configurable via both JMX and YAML
+- Introduce new ``fqltool`` in ``/bin`` that currently implements ``Dump`` which can dump
in a readable format full query logs as well as follow active full query logs. FQL ``Replay``
and ``Compare`` are also available.
+Cassandra 4.0 has a binary full query log based on Chronicle Queue that can be controlled
using ``nodetool enablefullquerylog``, ``disablefullquerylog``, and ``resetfullquerylog``.
The log contains all queries invoked, approximate time they were invoked, any parameters necessary
to bind wildcard values, and all query options. A readable version of the log can be dumped
or tailed using the new ``bin/fqltool`` utility. The full query log is designed to be safe
to use in production and limits utilization of heap memory and disk space with limits you
can specify when enabling the log.
+Full Query Logging logs all requests to the CQL interface. The full query logs could be used
for debugging, performance benchmarking, testing and auditing CQL queries. The audit logs
also include CQL requests but full query logging is dedicated to CQL requests only with features
such as FQL Replay and FQL Compare that are not available in audit logging.  
+Full Query Logger
+The Full Query Logger is a logger that logs entire query contents after the query finishes.
FQL only logs the queries that successfully complete. The other queries (e.g. timed out, failed)
are not to be logged. Queries are logged in one of two modes: single query or batch of queries.
The log for an invocation of a batch of queries includes the following attributes:
+ type - The type of the batch
+ queries - CQL text of the queries
+ values - Values to bind to as parameters for the queries
+ queryOptions - Options associated with the query invocation
+ queryState - Timestamp state associated with the query invocation
+ batchTimeMillis - Approximate time in milliseconds since the epoch since the batch was invoked
+ The log for single CQL query includes the following attributes:
+ query - CQL query text
+ queryOptions - Options associated with the query invocation
+ queryState - Timestamp state associated with the query invocation
+ queryTimeMillis - Approximate time in milliseconds since the epoch since the batch was invoked
+Full query logging is backed up by ``BinLog``. BinLog is a quick and dirty binary log. Its
goal is good enough performance, predictable footprint, simplicity in terms of implementation
and configuration and most importantly minimal impact on producers of log records. Performance
safety is accomplished by feeding items to the binary log using a weighted queue and dropping
records if the binary log falls sufficiently far behind. Simplicity and good enough performance
is achieved by using a single log writing thread as well as Chronicle Queue to handle writing
the log, making it available for readers, as well as log rolling.
+Weighted queue is a wrapper around any blocking queue that turns it into a blocking weighted
queue. The queue will weigh each element being added and removed. Adding to the queue is blocked
if adding would violate the weight bound. If an element weighs in at larger than the capacity
of the queue then exactly one such element will be allowed into the queue at a time. If the
weight of an object changes after it is added it could create issues. Checking weight should
be cheap so memorize expensive to compute weights. If weight throws that can also result in
leaked permits so it's always a good idea to memorize weight so it doesn't throw. In the interests
of not writing unit tests for methods no one uses there is a lot of ``UnsupportedOperationException``.
If you need them then add them and add proper unit tests to ``WeightedQueueTest``. "Good"
tests. 100% coverage including exception paths and resource leaks.
+The FQL tracks information about store files:
+- Store files as they are added and their storage impact. Delete them if over storage limit.
+- The files in the chronicle queue that have already rolled
+- The number of bytes in store files that have already rolled
+FQL logger sequence is as follows;
 Review comment:
   `follows;` -> `follows:`

This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:

With regards,
Apache Git Services

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message