diff --git a/CHANGELOG.md b/CHANGELOG.md index 94b86133191..fd59fabaac0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -26,7 +26,7 @@ * [ENHANCEMENT] Memberlist KV: incoming messages are now processed on per-key goroutine. This may reduce loss of "maintanance" packets in busy memberlist installations, but use more CPU. New `memberlist_client_received_broadcasts_dropped_total` counter tracks number of dropped per-key messages. #1912 * [ENHANCEMENT] Blocks Storage, Alertmanager, Ruler: add support a prefix to the bucket store (`*_storage.storage_prefix`). This enables using the same bucket for the three components. #1686 #1951 * [ENHANCEMENT] Upgrade Docker base images to `alpine:3.16.0`. #2028 -* [ENHANCEMENT] Store-gateway: Add experimental configuration option for the store-gateway to attempt to pre-populate the file system cache when memory-mapping index-header files. Enabled with `-blocks-storage.bucket-store.index-header.map-populate-enabled=true`. #2019 +* [ENHANCEMENT] Store-gateway: Add experimental configuration option for the store-gateway to attempt to pre-populate the file system cache when memory-mapping index-header files. Enabled with `-blocks-storage.bucket-store.index-header.map-populate-enabled=true`. Note this flag only has an effect when running on Linux. #2019 #2054 * [ENHANCEMENT] Chunk Mapper: reduce memory usage of async chunk mapper. #2043 * [BUGFIX] Fix regexp parsing panic for regexp label matchers with start/end quantifiers. #1883 * [BUGFIX] Ingester: fixed deceiving error log "failed to update cached shipped blocks after shipper initialisation", occurring for each new tenant in the ingester. #1893 diff --git a/pkg/storegateway/indexheader/fileutil/mmap_generic.go b/pkg/storegateway/indexheader/fileutil/mmap_generic.go new file mode 100644 index 00000000000..b0247c39982 --- /dev/null +++ b/pkg/storegateway/indexheader/fileutil/mmap_generic.go @@ -0,0 +1,23 @@ +// SPDX-License-Identifier: AGPL-3.0-only +// Provenance-includes-location: https://github.com/prometheus/prometheus/blob/main/tsdb/fileutil/mmap_unix.go +// Provenance-includes-license: Apache-2.0 +// Provenance-includes-copyright: The Prometheus Authors. + +//go:build darwin +// +build darwin + +package fileutil + +import ( + "os" + + "golang.org/x/sys/unix" +) + +func mmap(f *os.File, length int, populate bool) ([]byte, error) { + return unix.Mmap(int(f.Fd()), 0, length, unix.PROT_READ, unix.MAP_SHARED) +} + +func munmap(b []byte) (err error) { + return unix.Munmap(b) +} diff --git a/pkg/storegateway/indexheader/fileutil/mmap_unix.go b/pkg/storegateway/indexheader/fileutil/mmap_unix.go index 74894e9da75..4cf9c1974cb 100644 --- a/pkg/storegateway/indexheader/fileutil/mmap_unix.go +++ b/pkg/storegateway/indexheader/fileutil/mmap_unix.go @@ -3,8 +3,8 @@ // Provenance-includes-license: Apache-2.0 // Provenance-includes-copyright: The Prometheus Authors. -//go:build !windows && !plan9 -// +build !windows,!plan9 +//go:build !darwin && !windows && !plan9 +// +build !darwin,!windows,!plan9 package fileutil