mirror of
https://gitee.com/milvus-io/milvus.git
synced 2025-12-06 17:18:35 +08:00
fix: interleave the go and cpp log (#46005)
issue: #45640 pr: #46004 Signed-off-by: chyezh <chyezh@outlook.com>
This commit is contained in:
parent
7109b2062a
commit
3439c3eb45
@ -153,7 +153,7 @@ func (cfg *Config) initialize() {
|
|||||||
cfg.AsyncWritePendingLength = 1024
|
cfg.AsyncWritePendingLength = 1024
|
||||||
}
|
}
|
||||||
if cfg.AsyncWriteBufferSize <= 0 {
|
if cfg.AsyncWriteBufferSize <= 0 {
|
||||||
cfg.AsyncWriteBufferSize = 1024 * 1024
|
cfg.AsyncWriteBufferSize = 4 * 1024
|
||||||
}
|
}
|
||||||
if cfg.AsyncWriteMaxBytesPerLog <= 0 {
|
if cfg.AsyncWriteMaxBytesPerLog <= 0 {
|
||||||
cfg.AsyncWriteMaxBytesPerLog = 1024 * 1024
|
cfg.AsyncWriteMaxBytesPerLog = 1024 * 1024
|
||||||
|
|||||||
@ -1666,11 +1666,14 @@ The larger the pending length, the more memory is used, the less logging writes
|
|||||||
|
|
||||||
l.AsyncWriteBufferSize = ParamItem{
|
l.AsyncWriteBufferSize = ParamItem{
|
||||||
Key: "log.asyncWrite.bufferSize",
|
Key: "log.asyncWrite.bufferSize",
|
||||||
DefaultValue: "1m",
|
DefaultValue: "4k",
|
||||||
Version: "2.6.7",
|
Version: "2.6.7",
|
||||||
Doc: `The buffer size of the underlying bufio writer.
|
Doc: `The buffer size of the underlying bufio writer.
|
||||||
The larger the buffer size, the more memory is used,
|
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,
|
Export: false,
|
||||||
}
|
}
|
||||||
l.AsyncWriteBufferSize.Init(base.mgr)
|
l.AsyncWriteBufferSize.Init(base.mgr)
|
||||||
|
|||||||
@ -163,7 +163,7 @@ func TestComponentParam(t *testing.T) {
|
|||||||
assert.Equal(t, "error", Params.AsyncWriteNonDroppableLevel.GetValue())
|
assert.Equal(t, "error", Params.AsyncWriteNonDroppableLevel.GetValue())
|
||||||
assert.Equal(t, 1*time.Second, Params.AsyncWriteStopTimeout.GetAsDurationByParse())
|
assert.Equal(t, 1*time.Second, Params.AsyncWriteStopTimeout.GetAsDurationByParse())
|
||||||
assert.Equal(t, 1024, Params.AsyncWritePendingLength.GetAsInt())
|
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())
|
assert.Equal(t, int64(1024*1024), Params.AsyncWriteMaxBytesPerLog.GetAsSize())
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user