IGNITE-28770 : Introduce a operation context attributes registry v2#13243
Open
Vladsz83 wants to merge 21 commits into
Open
IGNITE-28770 : Introduce a operation context attributes registry v2#13243Vladsz83 wants to merge 21 commits into
Vladsz83 wants to merge 21 commits into
Conversation
…-attributes-registry
…-attributes-registry
…-attributes-registry_v2
petrov-mg
reviewed
Jun 19, 2026
petrov-mg
reviewed
Jun 19, 2026
petrov-mg
reviewed
Jun 19, 2026
petrov-mg
reviewed
Jun 19, 2026
petrov-mg
reviewed
Jun 22, 2026
petrov-mg
reviewed
Jun 22, 2026
…-attributes-registry_v2
Contributor
|
It's also worth adding meaningful comments describing the purpose of DistributedOperationContextManager and its methods. What is DistributedOperationContextMessage and why was it decided to use a bitmap. |
petrov-mg
reviewed
Jun 22, 2026
petrov-mg
reviewed
Jun 22, 2026
petrov-mg
reviewed
Jun 22, 2026
| import org.jetbrains.annotations.Nullable; | ||
|
|
||
| /** | ||
| * A manager of {@link OperationContextAttribute} which are required to be propagated through a cluster. |
Contributor
There was a problem hiding this comment.
/**
* Provides the ability to manage {@link OperationContext} attributes in a distributed manner.
*
* <p>This mechanism is primarily used to propagate {@link OperationContext} state across the cluster by
* capturing it before a message is sent, transferring it together with the message, and restoring it on
* the receiving node before message processing begins.</p>
*
* <p>The implementation relies on a mapping between a distributed identifier and an
* {@link OperationContextAttribute} instance that is consistent across all cluster nodes.</p>
*
* <p>To enable propagation of an {@link OperationContextAttribute} value across cluster nodes, the
* attribute must be created using the {@link #createDistributedAttribute(byte, Message)} method.
*
* <p> Note, that the maximum number of distributed attribute instances that can be created is currently limited to
* {@link #MAX_DISTRIBUTED_ATTR_CNT} for implementation reasons.</p>
*
* @see OperationContext
* @see DistributedOperationContextMessage
*/
petrov-mg
reviewed
Jun 22, 2026
| return INSTANCE; | ||
| } | ||
|
|
||
| /** |
Contributor
There was a problem hiding this comment.
/**
* Creates a new {@link OperationContext} attribute with the specified distributed ID and initial value.
*
* <p>The distributed ID is used to consistently identify the attribute across all nodes in the cluster.
* It must be unique, and its value must be in the range from {@code 0} (inclusive) to {@code Byte.SIZE} (exclusive).</p>
*
* <p>The value of the created attribute is automatically captured and propagated between cluster nodes
* during message transmission.</p>
*
* @see OperationContextAttribute#newInstance(Object)
*/
petrov-mg
reviewed
Jun 22, 2026
| } | ||
|
|
||
| /** | ||
| * Requests current {@link OperationContext} for its effective attributes and collects ones which are also registered |
Contributor
There was a problem hiding this comment.
/**
* Collects the values of all distributed {@link OperationContextAttribute}s registered by this manager
* in a format suitable for transmission between cluster nodes.
*
* @see OperationContext#get(OperationContextAttribute)
*/
petrov-mg
reviewed
Jun 22, 2026
| return res; | ||
| } | ||
|
|
||
| /** Sets the received distributed operation context attributes (if any) into current {@link OperationContext}. */ |
Contributor
There was a problem hiding this comment.
/** Restores distributed {@link OperationContextAttribute} values received from a remote node. */
petrov-mg
reviewed
Jun 22, 2026
| "join request (consider increasing 'joinTimeout' configuration property) " + | ||
| "[joinTimeout=" + spi.joinTimeout + ", sock=" + currSock + ']')); | ||
|
|
||
| if (msg instanceof TcpDiscoveryAbstractMessage msg0 && msg0.opCtxMsg != null) { |
Contributor
There was a problem hiding this comment.
Let's just leave the method as is, but wrap all of its code in a try-with-resource block.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.