fix: remove panic for message type in recovery storage and marshal log (#43976)

issue: #43897

Signed-off-by: chyezh <chyezh@outlook.com>
This commit is contained in:
Zhen Ye 2025-08-21 14:23:47 +08:00 committed by GitHub
parent 26c5c779bf
commit f5cee0012a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 4 additions and 3 deletions

View File

@ -284,8 +284,6 @@ func (r *recoveryStorageImpl) handleMessage(msg message.ImmutableMessage) {
r.handleSchemaChange(immutableMsg)
case message.MessageTypeTimeTick:
// nothing, the time tick message make no recovery operation.
default:
panic("unreachable: some message type can not be consumed, there's a critical bug.")
}
}

View File

@ -16,7 +16,9 @@ func (m *messageImpl) MarshalLogObject(enc zapcore.ObjectEncoder) error {
return nil
}
enc.AddString("type", m.MessageType().String())
if m.properties.Exist(messageVChannel) {
enc.AddString("vchannel", m.VChannel())
}
if m.properties.Exist(messageTimeTick) {
enc.AddUint64("timetick", m.TimeTick())
}
@ -25,6 +27,7 @@ func (m *messageImpl) MarshalLogObject(enc zapcore.ObjectEncoder) error {
}
if broadcast := m.BroadcastHeader(); broadcast != nil {
enc.AddInt64("broadcastID", int64(broadcast.BroadcastID))
enc.AddString("broadcastVChannels", strings.Join(broadcast.VChannels, ","))
}
enc.AddInt("size", len(m.payload))
marshalSpecializedHeader(m.MessageType(), m.Version(), m.properties[messageHeader], enc)