-
Notifications
You must be signed in to change notification settings - Fork 4.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Set log.offset
to the start of the reported line in filestream
#30445
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -41,10 +41,9 @@ func NewFilemeta(r reader.Reader, path string, offset int64) reader.Reader { | |
func (r *FileMetaReader) Next() (reader.Message, error) { | ||
message, err := r.reader.Next() | ||
|
||
r.offset += int64(message.Bytes) | ||
|
||
// if the message is empty, there is no need to enrich it with file metadata | ||
if message.IsEmpty() { | ||
r.offset += int64(message.Bytes) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't understand the difference in this change. There are only 2 returns in this function and having There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ah, I think I get it now, that's because the value is used in There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Exactly. |
||
return message, err | ||
} | ||
|
||
|
@@ -56,6 +55,9 @@ func (r *FileMetaReader) Next() (reader.Message, error) { | |
}, | ||
}, | ||
}) | ||
|
||
r.offset += int64(message.Bytes) | ||
|
||
return message, err | ||
} | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you add a comment in here noting that
log.offset
should be the start of the reported line, and not the end? Let's document what the behaviour needs to be and why in the code itself.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like I was too late :) The commit message will explain it at least.