-
Notifications
You must be signed in to change notification settings - Fork 21
Add support for a per-operation context #1619
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Checklist before you submit for review
|
|
I think that Counter Mutations perform reads from storage but they won't be tracked with this patch. I don't know about LWTs or other statements that require reads |
Good point. It should be easy enough to also set the context on writes to cover all the case of "writes that end up doing reads", so I'll add it. |
|
Actually, looking more closely, the current patch handles every execution of a What is true is that currently there is no good way to look at the context and tell if the read is part of a counter update, or a LWT, or it's a user reads, but:
|
|
I think that we don't care much about the type of query (counters, single read....), the only important thing is that the new mechanism covers all the types (in order to completely cover the CNDB side implementation) I would keep this in the current form, no other changes. Thanks for checking |
The goal of this commit is to allow low-level code, typically at the level of file reads (say, a custom `FileChannel` implementation), to obtain context on which higher level operation they correspond to. A typical use case may for tiered storage where `FileChannel` implementations may forward reads to remote storage, and where having context on the overall operation could help, say, take prior work done to set timeout, or aggregate metrics per "user-level" operations (rather than per `FileChannel` operation). To do this, we reuse the existing `ExecutorLocals` mechanism, and simply have the top-level operation setup the proper context as an `ExecutorLocal`, allowing it to be accessed by any low-level operations operating on behalf of that operation. This is, in many way, similar to tracing, but instead of a `TraceState` that collect what happens during the operation, it is a relatively flexible notion of `OperationContext`. As of this patch, this feature is fairly barebone and mostly exists for extensions in the following sense: 1. only user reads (`ReadCommand` execution) currently sets up such a context. The code is written in such a way that adding support for other operations should be easy, but this is not done. 2. the context set by reads by default has barely any information: it merely has a `toString()` method that can roughly tell what the operation itself is, and so could have use for debugging, but not much more. Further, that context is not read by anything in this patch. However, said context are created through a "factory" and the factory class is configurable through a system property. So extension can override the factory in order to create contexts with more information/state, and they fetch/use those context where they see fit.
|
❌ Build ds-cassandra-pr-gate/PR-1619 rejected by Butler1 new test failure(s) in 2 builds Found 1 new test failures
Found 2 known test failures |
The goal of this commit is to allow low-level code, typically at the level of file reads (say, a custom `FileChannel` implementation), to obtain context on which higher level operation they correspond to. A typical use case may for tiered storage where `FileChannel` implementations may forward reads to remote storage, and where having context on the overall operation could help, say, take prior work done to set timeout, or aggregate metrics per "user-level" operations (rather than per `FileChannel` operation). To do this, we reuse the existing `ExecutorLocals` mechanism, and simply have the top-level operation setup the proper context as an `ExecutorLocal`, allowing it to be accessed by any low-level operations operating on behalf of that operation. This is, in many way, similar to tracing, but instead of a `TraceState` that collect what happens during the operation, it is a relatively flexible notion of `OperationContext`. As of this patch, this feature is fairly barebone and mostly exists for extensions in the following sense: 1. only user reads (`ReadCommand` execution) currently sets up such a context. The code is written in such a way that adding support for other operations should be easy, but this is not done. 2. the context set by reads by default has barely any information: it merely has a `toString()` method that can roughly tell what the operation itself is, and so could have use for debugging, but not much more. Further, that context is not read by anything in this patch. However, said context are created through a "factory" and the factory class is configurable through a system property. So extension can override the factory in order to create contexts with more information/state, and they fetch/use those context where they see fit.
The goal of this commit is to allow low-level code, typically at the level of file reads (say, a custom `FileChannel` implementation), to obtain context on which higher level operation they correspond to. A typical use case may for tiered storage where `FileChannel` implementations may forward reads to remote storage, and where having context on the overall operation could help, say, take prior work done to set timeout, or aggregate metrics per "user-level" operations (rather than per `FileChannel` operation). To do this, we reuse the existing `ExecutorLocals` mechanism, and simply have the top-level operation setup the proper context as an `ExecutorLocal`, allowing it to be accessed by any low-level operations operating on behalf of that operation. This is, in many way, similar to tracing, but instead of a `TraceState` that collect what happens during the operation, it is a relatively flexible notion of `OperationContext`. As of this patch, this feature is fairly barebone and mostly exists for extensions in the following sense: 1. only user reads (`ReadCommand` execution) currently sets up such a context. The code is written in such a way that adding support for other operations should be easy, but this is not done. 2. the context set by reads by default has barely any information: it merely has a `toString()` method that can roughly tell what the operation itself is, and so could have use for debugging, but not much more. Further, that context is not read by anything in this patch. However, said context are created through a "factory" and the factory class is configurable through a system property. So extension can override the factory in order to create contexts with more information/state, and they fetch/use those context where they see fit.



The goal of this commit is to allow low-level code, typically at the
level of file reads (say, a custom
FileChannelimplementation), toobtain context on which higher level operation they correspond to. A
typical use case may for tiered storage where
FileChannelimplementations may forward reads to remote storage, and where having
context on the overall operation could help, say, take prior work done
to set timeout, or aggregate metrics per "user-level" operations (rather
than per
FileChanneloperation).To do this, we reuse the existing
ExecutorLocalsmechanism, and simplyhave the top-level operation setup the proper context as an
ExecutorLocal, allowing it to be accessed by any low-level operationsoperating on behalf of that operation. This is, in many way, similar to
tracing, but instead of a
TraceStatethat collect what happens duringthe operation, it is a relatively flexible notion of
OperationContext.As of this patch, this feature is fairly barebone and mostly exists for
extensions in the following sense:
ReadCommandexecution) currently sets up such acontext. The code is written in such a way that adding support for
other operations should be easy, but this is not done.
merely has a
toString()method that can roughly tell what theoperation itself is, and so could have use for debugging, but not
much more. Further, that context is not read by anything in this
patch. However, said context are created through a "factory" and
the factory class is configurable through a system property. So
extension can override the factory in order to create contexts
with more information/state, and they fetch/use those context where
they see fit.