hanahmily opened a new pull request, #1060:
URL: https://github.com/apache/skywalking-banyandb/pull/1060

   ### Fix SIDX streaming sync sending wrong timestamp field
   
   - [x] Add a unit test to verify that the fix works.
   - [x] Explain briefly why the bug exists and how to fix it.
   - [x] Update the [`CHANGES` 
log](https://github.com/apache/skywalking-banyandb/blob/main/CHANGES.md).
   
   ## Bug Description
   
   `StreamingParts` in `banyand/internal/sidx/sync.go` was setting 
`MinTimestamp` from `part.partMetadata.SegmentID` instead of 
`part.partMetadata.MinTimestamp`, and `MaxTimestamp` was never set (defaulting 
to `0`).
   
   ## Why the bug exists
   
   The SIDX `partMetadata` has three time-related fields: `SegmentID` (int64), 
`MinTimestamp` (*int64), and `MaxTimestamp` (*int64). The `StreamingParts` 
function incorrectly used `SegmentID` as a substitute for `MinTimestamp` and 
omitted `MaxTimestamp` entirely.
   
   ## How it manifests
   
   In most cases `SegmentID` is derived from `es.timeRange.Start.UnixNano()` — 
a large non-zero value — so the sync would appear to work. But when `SegmentID` 
was `0`, the receiving node rejected the part with `"invalid MinTimestamp 0 in 
chunk sync context"`. Before validation was added in #1059, zero timestamps 
silently created corrupt `seg-19700101` directories.
   
   ## Fix
   
   Read the correct `*int64` pointer fields (`MinTimestamp`, `MaxTimestamp`) 
with nil-safe dereference.


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