mirror of
https://gitee.com/milvus-io/milvus.git
synced 2025-12-07 01:28:27 +08:00
fix: interleave the go and cpp log (#46004)
issue: #45640 Signed-off-by: chyezh <chyezh@outlook.com>
This commit is contained in:
parent
3fc309bdfc
commit
73fdaafb2d
@ -153,7 +153,7 @@ func (cfg *Config) initialize() {
|
||||
cfg.AsyncWritePendingLength = 1024
|
||||
}
|
||||
if cfg.AsyncWriteBufferSize <= 0 {
|
||||
cfg.AsyncWriteBufferSize = 1024 * 1024
|
||||
cfg.AsyncWriteBufferSize = 4 * 1024
|
||||
}
|
||||
if cfg.AsyncWriteMaxBytesPerLog <= 0 {
|
||||
cfg.AsyncWriteMaxBytesPerLog = 1024 * 1024
|
||||
|
||||
@ -1675,11 +1675,14 @@ The larger the pending length, the more memory is used, the less logging writes
|
||||
|
||||
l.AsyncWriteBufferSize = ParamItem{
|
||||
Key: "log.asyncWrite.bufferSize",
|
||||
DefaultValue: "1m",
|
||||
DefaultValue: "4k",
|
||||
Version: "2.6.7",
|
||||
Doc: `The buffer size of the underlying bufio writer.
|
||||
The larger the buffer size, the more memory is used,
|
||||
but the less the number of writes to the underlying file system.`,
|
||||
but the less the number of writes to the underlying file system.
|
||||
Because the cpp will print the log message into stdout,
|
||||
when the logging is woring with pipe like tty/docker log driver/k8s,
|
||||
PIPE_BUF=4096 may interleave the go log and cpp log together, so 4kb is set as default value to avoid this.`,
|
||||
Export: false,
|
||||
}
|
||||
l.AsyncWriteBufferSize.Init(base.mgr)
|
||||
|
||||
@ -163,7 +163,7 @@ func TestComponentParam(t *testing.T) {
|
||||
assert.Equal(t, "error", Params.AsyncWriteNonDroppableLevel.GetValue())
|
||||
assert.Equal(t, 1*time.Second, Params.AsyncWriteStopTimeout.GetAsDurationByParse())
|
||||
assert.Equal(t, 1024, Params.AsyncWritePendingLength.GetAsInt())
|
||||
assert.Equal(t, int64(1024*1024), Params.AsyncWriteBufferSize.GetAsSize())
|
||||
assert.Equal(t, int64(4*1024), Params.AsyncWriteBufferSize.GetAsSize())
|
||||
assert.Equal(t, int64(1024*1024), Params.AsyncWriteMaxBytesPerLog.GetAsSize())
|
||||
})
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user