anton-vinogradov opened a new pull request, #13437:
URL: https://github.com/apache/ignite/pull/13437
Step 1 of IGNITE-26630. No wire change: only method names move, no message
field is touched.
### Why
`GridCacheMessage#partition()` sounds like a data partition, but it is the
key that picks a stripe. The name has already misled: the ticket asked to
remove the method, and removing it would send every cache message from the
striped pool to the plain system pool, because the base class returns `-1`
while "do not stripe" is `Integer.MIN_VALUE`. No functional test would notice.
### What changed
A new `StripedMessage` interface, next to `ExecutorAwareMessage` and shaped
like it:
```java
public interface StripedMessage extends Message {
public static final int ANY_STRIPE = -1;
public static final int NO_STRIPE = Integer.MIN_VALUE;
public int stripeIdx();
}
```
`GridIoMessage` loses its chain:
```java
- public int partition() {
- if (msg instanceof GridCacheMessage)
- return ((GridCacheMessage)msg).partition();
- if (msg instanceof DataStreamerRequest)
- return ((DataStreamerRequest)msg).partition();
- else
- return STRIPE_DISABLED_PART;
- }
+ @Override public int stripeIdx() {
+ return msg instanceof StripedMessage ?
((StripedMessage)msg).stripeIdx() : NO_STRIPE;
+ }
```
`STRIPE_DISABLED_PART` moves into the interface as `NO_STRIPE` and stops
being a boxed `Integer`, and the bare `-1` literals become `ANY_STRIPE`.
Two classes where the name and the meaning did not match are now explicit:
* `GridCacheQueryRequest` keeps `partition()` — that one really is the
partition to scan, read in `GridCacheDistributedQueryManager` — and gets
`stripeIdx()` alongside it.
* `GridNearAtomicCheckUpdateRequest` loses `partition()`. The value it
carries is the stripe of the update request, which the primary copies into the
stripe of the response; the handler says so itself: "Message is processed in
the same stripe".
### What is deliberately left alone
The fields are still named `part` and `partId`, and so are the constructor
parameters they feed. Step 2 of the ticket deletes those fields — six of them
travel the wire only to pick a stripe and nothing reads them — so renaming them
now would churn the generated serializers and their reference files for nothing.
### Checks
* the set of striped messages is unchanged: `StripedMessage` is implemented
by `GridCacheMessage` and `DataStreamerRequest`, exactly the two arms of the
old chain;
* no message class was left with an orphaned `partition()` that silently
stopped overriding anything — the only such method left is the intentional one
in `GridCacheQueryRequest`;
* `IgniteCacheAtomicProtocolTest` 26/26 with assertions enabled — this is
the stripe-sensitive path, where the deferred response buffer is a
`ThreadLocal` flushed back into its own stripe;
* `DataStreamerImplSelfTest`, `CacheScanQueryFailoverTest`,
`GridCacheQueryTransformerSelfTest`: 61 run, 0 failed;
* full `test-compile` of all modules, and checkstyle under `-Pcheckstyle`.
--
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.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]