XianReallyHot-ZZH opened a new pull request, #13834:
URL: https://github.com/apache/ignite/pull/13834

   Thank you for submitting the pull request to the Apache Ignite.
   
   In order to streamline the review of the contribution 
   we ask you to ensure the following steps have been taken:
   
   ### The Contribution Checklist
   - [x] There is a single JIRA ticket related to the pull request. 
   - [ ] The web-link to the pull request is attached to the JIRA ticket.
   - [ ] The JIRA ticket has the _Patch Available_ state. 
   - [x] The pull request body describes changes that have been made. 
   The description explains _WHAT_ and _WHY_ was made instead of _HOW_.
   - [x] The pull request title is treated as the final commit message. 
   The following pattern must be used: `IGNITE-XXXX Change summary` where 
`XXXX` - number of JIRA issue.
   - [ ] A reviewer has been mentioned through the JIRA comments 
   (see [the Maintainers 
list](https://cwiki.apache.org/confluence/display/IGNITE/How+to+Contribute#HowtoContribute-ReviewProcessandMaintainers))
 
   - [ ] The pull request has been checked by the Teamcity Bot and 
   the `green visa` attached to the JIRA ticket (see tab `PR Check` at [TC.Bot 
- Instance 1](https://tcbot2.sbt-ignite-dev.ru/prs.html) or [TC.Bot - Instance 
2](https://mtcga.gridgain.com/prs.html))
   
   ### Description
   
   Ticket: [IGNITE-29297](https://issues.apache.org/jira/browse/IGNITE-29297)
   
   The group-level SQL onheap index row cache (`IndexRowCache`) is keyed by a 
bare data row link, but a link is an address, not an identity: after a bulk 
free that bypasses per-row row-cache cleanup (a partition destroy on 
rebalancing) and a subsequent link reuse by a row of another table of the same 
cache group, a stale cached entry of the old owner was served to index 
operations of the new owner — `InlineIndexTree#createIndexRow` re-wrapped it 
with the current index's row handler without any ownership validation. Up to 
2.17 this fails with `BinaryObjectException` wrapped into 
`CorruptedTreeException` (node restarts, false "corrupted index" maintenance 
rebuilds); since 2.18 (IGNITE-26261) the failure is silent: one table's index 
is maintained with another table's field values, and range scans return foreign 
rows (reproduced on master: a scan of one table returned 50 rows of another 
table out of 51).
   
   **What**: every cached row is stamped with the cache ID of the index tree 
that cached it. On lookup, an entry stamped for another cache of the group is 
evicted and the row is re-read from the link, so a stale entry can no longer be 
served across caches — regardless of which bulk-free path left it behind. 
`IndexRowCache#clearForCache` compares the same stamp, which also makes it 
effective for groups without page eviction (cache IDs are stored in data pages 
only when page eviction is enabled, so the previously compared 
`CacheDataRow#cacheId` was always 0 in the default configuration).
   
   **Why this scope**: consumer-side validation makes the row cache correct 
against any staleness source, so a producer-side sweep of the partition destroy 
path is a possible follow-up, not a correctness requirement; cache destruction 
is already covered by the per-row cleaner in `RowStore#removeRow` (see 
`H2RowCacheSelfTest#checkDestroyCacheWithOtherCacheInGroup`).
   
   **Testing**: the new `IndexRowCacheCrossTablePoisonTest` injects the exact 
post-bulk-free state (entries of cache B under links of cache A, the state the 
node ends up in after link reuse) and verifies that both index operation paths 
of cache A — range scan (find) and insert (put) — observe only rows of cache A: 
before the fix the scan returned 50 rows of cache B, after the fix 0. 
`H2RowCacheSelfTest` (16 tests) and `H2RowCachePageEvictionTest` (4 tests) pass 
unchanged.
   


-- 
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]

Reply via email to