Skip to content

Commit

Permalink
Merge pull request #4895 from weaviate/lre/improve-apply-log-messages
Browse files Browse the repository at this point in the history
improve log messages to apply to also dump cmd related output
  • Loading branch information
reyreaud-l committed May 10, 2024
2 parents 4ca4c0f + 597a606 commit 44d6749
Showing 1 changed file with 17 additions and 4 deletions.
21 changes: 17 additions & 4 deletions cluster/store/store.go
Original file line number Diff line number Diff line change
Expand Up @@ -621,8 +621,9 @@ func (st *Store) Execute(req *api.ApplyRequest) (uint64, error) {
func (st *Store) Apply(l *raft.Log) interface{} {
ret := Response{Version: l.Index}
st.log.WithFields(logrus.Fields{
"type": l.Type,
"index": l.Index,
"log_type": l.Type,
"log_name": l.Type.String(),
"log_index": l.Index,
}).Debug("apply fsm store command")
if l.Type != raft.LogCommand {
st.log.WithFields(logrus.Fields{
Expand All @@ -641,13 +642,25 @@ func (st *Store) Apply(l *raft.Log) interface{} {
st.lastAppliedIndex.Store(l.Index)
if ret.Error != nil {
st.log.WithFields(logrus.Fields{
"type": l.Type,
"index": l.Index,
"log_type": l.Type,
"log_name": l.Type.String(),
"log_index": l.Index,
"cmd_type": cmd.Type,
"cmd_type_name": cmd.Type.String(),
"cmd_class": cmd.Class,
}).WithError(ret.Error).Error("apply command")
}
}()

cmd.Version = l.Index
st.log.WithFields(logrus.Fields{
"log_type": l.Type,
"log_name": l.Type.String(),
"log_index": l.Index,
"cmd_type": cmd.Type,
"cmd_type_name": cmd.Type.String(),
"cmd_class": cmd.Class,
}).Debug("server.apply")
switch cmd.Type {

case api.ApplyRequest_TYPE_ADD_CLASS:
Expand Down

0 comments on commit 44d6749

Please sign in to comment.