Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

investigate the necessity of copying a mmap-ed chunk in ChunkDiskMapper #13915

Open
machine424 opened this issue Apr 10, 2024 · 0 comments
Open
Assignees

Comments

@machine424
Copy link
Collaborator

machine424 commented Apr 10, 2024

Proposal

// Make a copy of the chunk data to prevent a panic occurring because the returned
// chunk data slice references an mmap-ed file which could be closed after the
// function returns but while the chunk is still in use.
chkDataCopy := make([]byte, len(chkData))
copy(chkDataCopy, chkData)
was added here #8723 to prevent a panic.

  • The test no longer runs on CI: fix it and see if the panic still occurs.
  • Maybe

    prometheus/tsdb/head.go

    Lines 1145 to 1148 in 594b317

    // WaitForPendingReadersInTimeRange waits for queries overlapping with given range to finish querying.
    // The query timeout limits the max wait time of this function implicitly.
    // The mint is inclusive and maxt is the truncation time hence exclusive.
    func (h *Head) WaitForPendingReadersInTimeRange(mint, maxt int64) {
    can help.

slack discussion: https://cloud-native.slack.com/archives/C01AUBA4PFE/p1709929295106999

@machine424 machine424 self-assigned this Apr 10, 2024
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

No branches or pull requests

1 participant