[-] fix JSON serialization of different error types in task execution logging#744
Open
MaxaiZer wants to merge 2 commits intocybertec-postgresql:masterfrom
Open
[-] fix JSON serialization of different error types in task execution logging#744MaxaiZer wants to merge 2 commits intocybertec-postgresql:masterfrom
MaxaiZer wants to merge 2 commits intocybertec-postgresql:masterfrom
Conversation
fd46ae1 to
e23fc65
Compare
Pull Request Test Coverage Report for Build 21996320244Details
💛 - Coveralls |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Task errors are currently serialized inconsistently. If ExecuteSQLCommand fails during this block:
message_data.errorin the "Task execution failed" log will contain a full pgconn.PgError struct:{"task": 1, "vxid": 1, "chain": 1, "error": {"Code": "42P02", "File": "parse_expr.c", "Hint": "", "Line": 901, "Where": "", "Detail": "", "Message": "there is no parameter $1", "Routine": "transformParamRef", "Position": 175, "Severity": "ERROR", "TableName": "", "ColumnName": "", "SchemaName": "", "DataTypeName": "", "InternalQuery": "", "ConstraintName": "", "InternalPosition": 0, "SeverityUnlocalized": "ERROR"}}If it fails during parameter parsing:
message_data.errorwill contain struct with no actual error message:{"task": 1, "vxid": 1, "chain": 1, "error": {"Type": {}, "Field": "", "Value": "string", "Offset": 9, "Struct": ""}}And if ExecuteSQLCommand returns joined errors,
message_data.errorbecomes empty:{"task": 1, "vxid": 1, "chain": 1, "error": {}}After fix examples:
{"task": 1, "vxid": 1, "chain": 1, "error": "ERROR: there is no parameter $1 (SQLSTATE 42P02)"}{"task": 1, "vxid": 1, "chain": 1, "error": "failed to parse parameter \"1 month\": json: cannot unmarshal string into Go value of type []interface {}"}{"task": 1, "vxid": 1, "chain": 1, "error": "ERROR: procedure F_CreatePartitions(date, date) does not exist (SQLSTATE 42883)\nfailed to parse parameter \"1 month\": json: cannot unmarshal string into Go value of type []interface {}"}