-
Notifications
You must be signed in to change notification settings - Fork 23
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
Fix problem where parser errors would result in duplicate calls to the next operator #330
Conversation
Codecov Report
@@ Coverage Diff @@
## master #330 +/- ##
==========================================
+ Coverage 69.97% 70.17% +0.20%
==========================================
Files 121 121
Lines 6371 6370 -1
==========================================
+ Hits 4458 4470 +12
+ Misses 1437 1427 -10
+ Partials 476 473 -3
Continue to review full report at Codecov.
|
|
|
I have tested with two configs: pipeline:
- type: file_input
include: ["./time.json"]
start_at: beginning
- type: json_parser
parse_from: $record
timestamp:
layout: "2006-01-02 15:04:05.999"
layout_type: gotime
location: America/New_York
parse_from: Time
- type: file_output
path: time_duplicate.out pipeline:
- type: file_input
include: ["./sev.json"]
start_at: beginning
- type: json_parser
parse_from: $record
severity:
parse_from: Sev
- type: file_output
path: sev_duplicate.out Both input files contain exactly two lines of json. One is valid for the pipeline, and the other is missing the parse_from field for timestamp and severity respectively. Output from both using master branch (with the bug). The output has an incorrect amount of of output entries.
Output from this branch (no bug). The output has the correct amount of output entries.
Both situations log the same (correct) error. |
|
Description of Changes
Transformer.HandleEntryError
is responsible for the following:In theory, the responsibility of this method to return the error which it was given is a little odd. However, in practice it is a helpful way for callers to bail out. (
return t.HandleEntryError(..., err)
)The method was incorrectly returning
nil
whenon_error=send
, which ultimately allowed some operators to continue execution on the entry and pass it along to the next operator. (even though it had already been passed along byHandleEntryError
.This PR clarifies the expectation that
on_error
does not affect whether or not an error is returned when encountered.on_error
only affects whether or not the entry that caused the error is passed along or not.Aside from preventing this bug, and reworking the associated expectations in test cases, there should be no effect from this change. The error is dropped when returned from
operator.Process
.Please check that the PR fulfills these requirements