horaedb icon indicating copy to clipboard operation
horaedb copied to clipboard

Improve log readability for horaemeta

Open jiacai2050 opened this issue 2 years ago • 1 comments

Describe This Problem

This is what we get when meta log err message:

2024-03-15T10:16:16.439+0800 error procedure/util.go:35 open shard {"shardID": 231, "newLeaderNode": "11.69.60.125:8831", "error": "(#500)event dispatch failed, cause:open shard, addr:11.69.60.125:8831, request:{{231 1 10 0}}, err:fail to open shard, id:231. Caused by: Fail to open shard, msg:Shard is already in opening.\ngithub.com/apache/incubator-horaedb-meta/pkg/coderr.(*codeError).WithCausef\n\t/horaedb/horaemeta/pkg/coderr/error.go:91\ngithub.com/apache/incubator-horaedb-meta/server/coordinator/eventdispatch.(*DispatchImpl).OpenShard\n\t/horaedb/horaemeta/server/coordinator/eventdispatch/dispatch_impl.go:58\ngithub.com/apache/incubator-horaedb-meta/server/coordinator/procedure/operation/transferleader.openNewShardCallback\n\t/horaedb/horaemeta/server/coordinator/procedure/operation/transferleader/transfer_leader.go:272\ngithub.com/looplab/fsm.(*FSM).afterEventCallbacks\n\t/root/go/pkg/mod/github.com/looplab/[email protected]/fsm.go:435\ngithub.com/looplab/fsm.(*FSM).Event.func1\n\t/root/go/pkg/mod/github.com/looplab/[email protected]/fsm.go:330\ngithub.com/looplab/fsm.transitionerStruct.transition\n\t/root/go/pkg/mod/github.com/looplab/[email protected]/fsm.go:375\ngithub.com/looplab/fsm.(*FSM).doTransition\n\t/root/go/pkg/mod/github.com/looplab/[email protected]/fsm.go:360\ngithub.com/looplab/fsm.(*FSM).Event\n\t/root/go/pkg/mod/github.com/looplab/[email protected]/fsm.go:343\ngithub.com/apache/incubator-horaedb-meta/server/coordinator/procedure/operation/transferleader.(*Procedure).Start\n\t/horaedb/horaemeta/server/coordinator/procedure/operation/transferleader/transfer_leader.go:194\ngithub.com/apache/incubator-horaedb-meta/server/coordinator/procedure/operation/transferleader.(*BatchTransferLeaderProcedure).Start.func1\n\t/horaedb/horaemeta/server/coordinator/procedure/operation/transferleader/batch_transfer_leader.go:115\ngolang.org/x/sync/errgroup.(*Group).Go.func1\n\t/root/go/pkg/mod/golang.org/x/[email protected]/errgroup/errgroup.go:57\nruntime.goexit\n\t/usr/local/go/src/runtime/asm_amd64.s:1650\ngithub.com/apache/incubator-horaedb-meta/pkg/coderr.(*codeError).WithCausef\n\t/horaedb/horaemeta/pkg/coderr/error.go:91\ngithub.com/apache/incubator-horaedb-meta/server/coordinator/eventdispatch.(*DispatchImpl).OpenShard\n\t/horaedb/horaemeta/server/coordinator/eventdispatch/dispatch_impl.go:58\ngithub.com/apache/incubator-horaedb-meta/server/coordinator/procedure/operation/transferleader.openNewShardCallback\n\t/horaedb/horaemeta/server/coordinator/procedure/operation/transferleader/transfer_leader.go:272\ngithub.com/looplab/fsm.(*FSM).afterEventCallbacks\n\t/root/go/pkg/mod/github.com/looplab/[email protected]/fsm.go:435\ngithub.com/looplab/fsm.(*FSM).Event.func1\n\t/root/go/pkg/mod/github.com/looplab/[email protected]/fsm.go:330\ngithub.com/looplab/fsm.transitionerStruct.transition\n\t/root/go/pkg/mod/github.com/looplab/[email protected]/fsm.go:375\ngithub.com/looplab/fsm.(*FSM).doTransition\n\t/root/go/pkg/mod/github.com/looplab/[email protected]/fsm.go:360\ngithub.com/looplab/fsm.(*FSM).Event\n\t/root/go/pkg/mod/github.com/looplab/[email protected]/fsm.go:343\ngithub.com/apache/incubator-horaedb-meta/server/coordinator/procedure/operation/transferleader.(*Procedure).Start\n\t/horaedb/horaemeta/server/coordinator/procedure/operation/transferleader/transfer_leader.go:194\ngithub.com/apache/incubator-horaedb-meta/server/coordinator/procedure/operation/transferleader.(*BatchTransferLeaderProcedure).Start.func1\n\t/horaedb/horaemeta/server/coordinator/procedure/operation/transferleader/batch_transfer_leader.go:115\ngolang.org/x/sync/errgroup.(*Group).Go.func1\n\t/root/go/pkg/mod/golang.org/x/[email protected]/errgroup/errgroup.go:57\nruntime.goexit\n\t/usr/local/go/src/runtime/asm_amd64.s:1650"} github.com/apache/incubator-horaedb-meta/server/coordinator/procedure.CancelEventWithLog /horaedb/horaemeta/server/coordinator/procedure/util.go:35 github.com/apache/incubator-horaedb-meta/server/coordinator/procedure/operation/transferleader.openNewShardCallback /horaedb/horaemeta/server/coordinator/procedure/operation/transferleader/transfer_leader.go:273 github.com/looplab/fsm.(*FSM).afterEventCallbacks /root/go/pkg/mod/github.com/looplab/[email protected]/fsm.go:435 github.com/looplab/fsm.(*FSM).Event.func1 /root/go/pkg/mod/github.com/looplab/[email protected]/fsm.go:330 github.com/looplab/fsm.transitionerStruct.transition /root/go/pkg/mod/github.com/looplab/[email protected]/fsm.go:375 github.com/looplab/fsm.(*FSM).doTransition /root/go/pkg/mod/github.com/looplab/[email protected]/fsm.go:360 github.com/looplab/fsm.(*FSM).Event /root/go/pkg/mod/github.com/looplab/[email protected]/fsm.go:343

Proposal

Break new line at \n

Additional Context

No response

jiacai2050 avatar Mar 15 '24 02:03 jiacai2050

Here are my some ideas about this issue:

  • There is no need to include the call stack information in the error message
  • Format the call stack when logging

ShiKaiWi avatar Mar 15 '24 03:03 ShiKaiWi