Skip to content

IGNITE-28773 CacheOperationContext refactoring#13242

Open
zstan wants to merge 3 commits into
apache:masterfrom
zstan:ignite-28773
Open

IGNITE-28773 CacheOperationContext refactoring#13242
zstan wants to merge 3 commits into
apache:masterfrom
zstan:ignite-28773

Conversation

@zstan

@zstan zstan commented Jun 15, 2026

Copy link
Copy Markdown
Contributor

No description provided.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Refactors CacheOperationContext construction and usage across internal cache projections to reduce constructor/“setter” sprawl and align flag-setting APIs around withX() methods.

Changes:

  • Replaces direct new CacheOperationContext(...) / mutator-style methods with a CacheOperationContext.builder() + withX() API.
  • Renames skip-store projection from setSkipStore(boolean) to withSkipStore() and updates REST handler code paths accordingly.
  • Adds a new withHandleBinaryInInterceptor() projection API and propagates it through cache proxies.

Reviewed changes

Copilot reviewed 13 out of 13 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/dml/DmlUtils.java Switches keep-binary context creation to the new builder/with-style API.
modules/core/src/test/java/org/apache/ignite/internal/processors/rest/handlers/cache/GridCacheCommandHandlerSelfTest.java Simplifies the local cache proxy used in REST handler tests after projection API changes.
modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/cache/GridCacheCommandHandler.java Updates REST cache-flag application to use withSkipStore() (conditional) and keep-binary projection.
modules/core/src/main/java/org/apache/ignite/internal/processors/datastructures/GridCacheQueueAdapter.java Refactors keep-binary context setup to builder/with-style methods.
modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteInternalCache.java Updates projection API surface (withSkipStore) and introduces withHandleBinaryInInterceptor().
modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteCacheProxyImpl.java Reuses a shared default CacheOperationContext instance instead of allocating new defaults.
modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProxyImpl.java Reworks projection methods to build new immutable contexts via builder/with-style calls; adds interceptor-binary projection plumbing.
modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAdapter.java Updates adapter-level projection creation to use builder/with-style contexts and adds new projection API.
modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GatewayProtectedCacheProxy.java Migrates to new CacheOperationContext “with” methods and extends keep-binary to also set the interceptor-binary flag.
modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxLocal.java Replaces hasDataCenterId() checks with dataCenterId() != null.
modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicAbstractUpdateFuture.java Uses builder-based context creation for application attributes.
modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicCache.java Uses builder-based context creation for application attributes and updates data center ID checks.
modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheOperationContext.java Introduces immutable builder-based CacheOperationContext, shared default instance, and new interceptor-binary flag.
Comments suppressed due to low confidence (1)

modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheOperationContext.java:24

  • Unused imports java.util.Collections and java.util.HashMap will fail the repository's Checkstyle UnusedImports rule; they are no longer referenced after the refactor and should be removed.
import java.io.Serial;
import java.io.Serializable;
import java.util.Collections;
import java.util.HashMap;
import java.util.Map;

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.


/** Read-repair strategy. */
private final ReadRepairStrategy readRepairStrategy;
/** Read-repair strategy.*/

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Space before end of the comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks fixed

keepBinaryInInterceptor);
/** Context with read repair strategy. */
public CacheOperationContext withReadRepairStrategy(ReadRepairStrategy strategy) {
if (readRepairStrategy() != null && readRepairStrategy() == strategy)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Condition readRepairStrategy() != null is redundant

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yep

Comment on lines +260 to +267
if (opCtx != null) {
if (opCtx.skipStore())
return this;
else
newOpCtx = opCtx.withSkipStore();
}
else
newOpCtx = CacheOperationContext.builder().skipStore(true).build();

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

newOpCtx = CacheOperationContext.of(opCtx).withSkipStore();

return newOpCtx == opCtx ? this : new GridCacheProxyImpl<>(ctx, delegate, newOpCtx);

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants