Skip to content

IGNITE-28277 Append additional tests for CacheInterceptor#onBeforePut#12911

Open
zstan wants to merge 1 commit intoapache:masterfrom
zstan:ignite-28277
Open

IGNITE-28277 Append additional tests for CacheInterceptor#onBeforePut#12911
zstan wants to merge 1 commit intoapache:masterfrom
zstan:ignite-28277

Conversation

@zstan
Copy link
Copy Markdown
Contributor

@zstan zstan commented Mar 18, 2026

I make a fix only for calcite related part, honestly - i afraid to make an equal changes on h2 related part and prefer to store it - as is. If approach is ok - i fill follow up issue for related documentation change.

@zstan zstan force-pushed the ignite-28277 branch 2 times, most recently from 8be5c14 to 84d439a Compare March 30, 2026 10:44
@zstan zstan requested a review from Copilot March 30, 2026 10:45
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR extends Calcite integration coverage around CacheInterceptor#onBeforePut behavior (particularly keep-binary vs unwrapped values) and adjusts Calcite DML execution to respect query keep-binary settings, while also applying several small cleanup/typo fixes across tests and core code.

Changes:

  • Add a new Calcite integration test covering interceptor value wrapping/unwrapping with/without keep-binary mode and include it in the Calcite integration suite.
  • Update Calcite ModifyNode to choose keepBinary() based on QueryProperties.keepBinary() and propagate session/application attributes to DML cache operations.
  • Introduce IgniteInternalCache#withApplicationAttributes(...) and wire it through cache proxies/contexts; plus assorted small cleanups (double semicolons, typo fixes, unused constant removal).

Reviewed changes

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

Show a summary per file
File Description
modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/stat/PSUStatisticsTypesTest.java Removes an extra semicolon in test SQL string construction.
modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/SqlSystemViewsSelfTest.java Removes an extra semicolon in test setup.
modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/SqlFieldsQuerySelfTest.java Removes an unused INSERT constant.
modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/standbycluster/IgniteStandByClusterTest.java Fixes typo in nested plugin provider name (StanByStandBy).
modules/core/src/test/java/org/apache/ignite/internal/processors/cache/binary/CacheKeepBinaryWithInterceptorTest.java Renames test interceptor classes for clarity; makes a test field final and suppresses unused warning.
modules/core/src/test/java/META-INF/services/org.apache.ignite.plugin.PluginProvider Updates service registration entry to match renamed provider class.
modules/core/src/main/java/org/apache/ignite/internal/util/BasicRateLimiter.java Removes an extra semicolon in rate limiter resync logic.
modules/core/src/main/java/org/apache/ignite/internal/processors/job/GridJobWorker.java Removes an extra semicolon in logging statement.
modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousQueryPartitionRecovery.java Removes an extra semicolon in boolean expression.
modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicCache.java Removes an extra semicolon after lock acquisition.
modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteInternalCache.java Adds withApplicationAttributes(Map<String,String>) projection API.
modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProxyImpl.java Implements withApplicationAttributes on the internal cache proxy (but see review comments).
modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAdapter.java Implements withApplicationAttributes for adapter-based projections (but see review comments).
modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheOperationContext.java Adds withApplicationAttributes(...) to propagate app/session attributes through operation context.
modules/core/src/main/java/org/apache/ignite/internal/managers/discovery/GridDiscoveryManager.java Removes an extra semicolon in an assertion.
modules/calcite/src/test/java/org/apache/ignite/testsuites/IntegrationTestSuite.java Registers the new Calcite interceptor integration test in the suite.
modules/calcite/src/test/java/org/apache/ignite/internal/processors/tx/TxWithExceptionalInterceptorTest.java Ensures grids are stopped in afterTest() to avoid leakage across parameter runs.
modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/integration/CacheWithInterceptorIntegrationTest.java New integration test validating interceptor onBeforePut value wrapping/unwrapping with keep-binary mode.
modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/CancelTest.java Removes an extra semicolon in query entity builder.
modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/exec/rel/ModifyNode.java Uses QueryProperties.keepBinary() to decide whether to apply keepBinary() for DML; propagates session attributes via withApplicationAttributes.
modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/exec/rel/HashJoinNode.java Removes an extra semicolon in downstream push.
Comments suppressed due to low confidence (1)

modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProxyImpl.java:321

  • In withApplicationAttributes, the opCtx == null branch constructs a CacheOperationContext with skipReadThrough set to true (see the second boolean argument). That changes cache behavior (read-through) just by setting application attributes, which is very likely unintended and inconsistent with GridCacheAdapter.withApplicationAttributes (which keeps it false). Please preserve the existing flags (i.e., do not enable skipReadThrough here).
    @Override public GridCacheProxyImpl<K, V> withApplicationAttributes(Map<String, String> attrs) {
        CacheOperationContext prev = gate.enter(opCtx);

        try {
            return new GridCacheProxyImpl<>(ctx, delegate,
                opCtx != null ? opCtx.setApplicationAttributes(attrs) :
                    new CacheOperationContext(
                        false,
                        true,
                        false,
                        null,
                        false,
                        null,
                        false,
                        null,
                        attrs));

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

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 21 out of 21 changed files in this pull request and generated 2 comments.


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

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 21 out of 21 changed files in this pull request and generated no new comments.

Comments suppressed due to low confidence (1)

modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProxyImpl.java:321

  • When opCtx is null, withApplicationAttributes stores the caller-provided attrs map directly in the new CacheOperationContext. This differs from the opCtx != null path (which copies via setApplicationAttributes) and can leak later mutations or preserve a non-serializable map implementation. Consider always storing a defensive copy (and optionally rejecting null like the public IgniteCache#withApplicationAttributes implementations do).
    @Override public GridCacheProxyImpl<K, V> withApplicationAttributes(Map<String, String> attrs) {
        CacheOperationContext prev = gate.enter(opCtx);

        try {
            return new GridCacheProxyImpl<>(ctx, delegate,
                opCtx != null ? opCtx.setApplicationAttributes(attrs) :
                    new CacheOperationContext(
                        false,
                        false,
                        false,
                        null,
                        false,
                        null,
                        false,
                        null,
                        attrs));

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

@sonarqubecloud
Copy link
Copy Markdown

Quality Gate Failed Quality Gate failed

Failed conditions
3 New Code Smells (required ≤ 1)

See analysis details on SonarQube Cloud

Catch issues before they fail your Quality Gate with our IDE extension SonarQube for IDE

@zstan zstan requested a review from alex-plekhanov March 30, 2026 13:49
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.

2 participants