mirror of
https://github.com/prometheus/prometheus.git
synced 2026-03-04 05:01:04 +01:00
fix: fail early when --enable-feature=use-uncached-io is unsupported
Signed-off-by: machine424 <ayoubmrini424@gmail.com>
This commit is contained in:
parent
1751685dd4
commit
6b4d8fa91e
@ -77,6 +77,7 @@ import (
|
||||
"github.com/prometheus/prometheus/tracing"
|
||||
"github.com/prometheus/prometheus/tsdb"
|
||||
"github.com/prometheus/prometheus/tsdb/agent"
|
||||
"github.com/prometheus/prometheus/tsdb/fileutil"
|
||||
"github.com/prometheus/prometheus/util/compression"
|
||||
"github.com/prometheus/prometheus/util/documentcli"
|
||||
"github.com/prometheus/prometheus/util/features"
|
||||
@ -319,6 +320,9 @@ func (c *flagConfig) setFeatureListOptions(logger *slog.Logger) error {
|
||||
c.web.EnableTypeAndUnitLabels = true
|
||||
logger.Info("Experimental type and unit labels enabled")
|
||||
case "use-uncached-io":
|
||||
if !fileutil.UncachedIOSupported() {
|
||||
return errors.New("experimental Uncached IO is not supported")
|
||||
}
|
||||
c.tsdb.UseUncachedIO = true
|
||||
logger.Info("Experimental Uncached IO is enabled.")
|
||||
default:
|
||||
|
||||
@ -26,3 +26,7 @@ func NewDirectIOWriter(f *os.File, size int) (BufWriter, error) {
|
||||
func NewBufioWriterWithSize(f *os.File, size int) (BufWriter, error) {
|
||||
return NewDirectIOWriter(f, size)
|
||||
}
|
||||
|
||||
func UncachedIOSupported() bool {
|
||||
return true
|
||||
}
|
||||
|
||||
@ -27,3 +27,7 @@ func NewBufioWriterWithSize(f *os.File, size int) (BufWriter, error) {
|
||||
func NewDirectIOWriter(f *os.File, size int) (BufWriter, error) {
|
||||
return newDirectIOWriter(f, size)
|
||||
}
|
||||
|
||||
func UncachedIOSupported() bool {
|
||||
return true
|
||||
}
|
||||
|
||||
@ -27,3 +27,7 @@ func NewBufioWriterWithSize(f *os.File, size int) (BufWriter, error) {
|
||||
func NewDirectIOWriter(*os.File, int) (BufWriter, error) {
|
||||
return nil, errDirectIOUnsupported
|
||||
}
|
||||
|
||||
func UncachedIOSupported() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user