RajaVinoth96 commented on PR #20263:
URL: https://github.com/apache/pinot/pull/20263#issuecomment-7321797569

   Thanks for digging into the root cause. The buffered vs `O_DIRECT` 
comparison and the separate `MAP_SHARED` mapping make it pretty conclusive.
   
   **Merging:** sure, feel free to pull the commits from 
`durable-flush-review-fixes` into your branch, whichever way is easiest for 
you. I'll keep this branch up to date and fix review comments here too, so it 
doesn't matter which PR ends up merged.
   
   **Correction:** in my reply to @xiangfu0 I agreed this looked like a fault 
below the page cache. Your update shows the opposite: the disk was fine and the 
cache was bad. So, as you said, this PR is crash-safety hardening and doesn't 
fix #19576. I've updated the description to say that.
   
   **Fault-injection tests:** added in 1754f93 for the sync failure paths: 
build, download, predownload, tier move and reprocess (reload already had one). 
Writing them turned up a gap: when a sync failed, the copy was left in place, 
and since its `creation.meta` CRC still matches ZK, a later attempt (reset, 
retry or restart) would load it as an existing copy without syncing it. It's 
now deleted when the sync fails, so the segment gets downloaded again.
   
   I didn't add tests for the cleanup in the writers' `close()`. The writers 
open their own files, so making those calls fail would need test-only hooks in 
production code. Happy to add them if you think they're worth it.
   
   **CRC follow-up and the cache case:** I had built the `O_DIRECT` CRC check 
at commit and download time, but as you pointed out it wouldn't catch this, 
since the cache went bad later. I'm holding it, and would like your thoughts on 
what's worth exploring. A few ideas:
   
   - **Check when a query hits a corruption-style error** (like `Unknown type 
N`): compare a buffered read of that segment with an `O_DIRECT` read, and 
reload if they differ. Reloading drops the mapping, so it would fix this case. 
Cheap, but it misses silent wrong values in forward indexes.
   - **A throttled background scrub:** recompute a CRC per (column, index) 
buffer through the existing mapping, compare it with a stored value, and on a 
mismatch use an `O_DIRECT` read to tell a bad cache page from a bad disk 
(reload vs re-download). This would need per-buffer CRCs stored at build time.
   - **Per-chunk checksums checked on decompression** for chunk-compressed 
forward indexes, similar to ClickHouse. It checks the bytes a query actually 
reads, but it's a format change and doesn't help raw fixed-bit indexes.
   - **`ReadMode.heap` for critical tables** with a CRC check at load, so 
queries never read from the page cache. Costs memory.
   
   Since you have the affected hosts: do you know roughly how many segments 
were hit, and whether all of them were on kernels in the affected range? That 
would help decide whether this is worth building into Pinot, or whether a 
kernel upgrade plus some lightweight detection (like the first idea) is enough.
   


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


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to