Skip to content

lightning: fix lightning failed to log encoding error (#45241)#45364

Merged
ti-chi-bot[bot] merged 5 commits intopingcap:release-6.5from
ti-chi-bot:cherry-pick-45241-to-release-6.5
Jul 24, 2023
Merged

lightning: fix lightning failed to log encoding error (#45241)#45364
ti-chi-bot[bot] merged 5 commits intopingcap:release-6.5from
ti-chi-bot:cherry-pick-45241-to-release-6.5

Conversation

@ti-chi-bot
Copy link
Member

This is an automated cherry-pick of #45241

What problem does this PR solve?

Issue Number: close #44321

Problem Summary:

When the source file has ill-formated row, the row is very large so it can't be logged. We can't locate the bad row;

2023-06-01 10:55:27.887067902 +0800 CST m=+35.508861459 write error: write length 20297970322 exceeds maximum file size 536870912

What is changed and how it works?

When we encounter ill-formatted row, we take out the ill-formatted row and only log the first 1024 characters of the row, so that it would not report error that write length exceeds maximum file size.

Before fixing the issue, the log looks like this when encountering ill-formatted row:

[2023/07/06 22:23:38.812 +08:00] [INFO] [base_test.go:40] ["logger is initialized"]
2023-07-06 22:23:39.344279 +0800 CST m=+0.575101501 write error: write length 1050272 exceeds maximum file size 1048576
2023-07-06 22:23:39.353842 +0800 CST m=+0.584668709 write error: write length 1050249 exceeds maximum file size 1048576

The length of the row is 324.

After fixing the issue, the log looks like this when encountering ill-formatted row:

[2023/07/07 21:08:03.211 +08:00] [INFO] [base_test.go:41] ["logger is initialized"]
[2023/07/07 21:08:03.737 +08:00] [ERROR] [base.go:308] ["kv convert failed"] [original=test_test_test_test_test_test_test_test_test_test_test_test_test_test_test_test_test_test_test_test_test_test_test_test_test_test_test_test_test_test_test_test_test_test_test_test_test_test_test_test_test_test_test_test_test_test_test_test_test_test_test_test_test_test_test_test_test_test_test_test_test_test_test_test_test_test_test_test_test_test_test_test_test_test_test_test_test_test_test_test_test_test_test_test_test_test_test_test_test_test_test_test_test_test_test_test_test_test_test_test_test_test_test_test_test_test_test_test_test_test_test_test_test_test_test_test_test_test_test_test_test_test_test_test_test_test_test_test_test_test_test_test_test_test_test_test_test_test_test_test_test_test_test_test_test_test_test_test_test_test_test_test_test_test_test_test_test_test_test_test_test_test_test_test_test_test_test_test_test_test_test_test_test_test_test_test_test_test_test_test_test_test_test_test_test_test_test_test_test_test_test_test_test_test_test_test_test_test_test_test_test_test_test_test_test] [originalCol=6] [colName=c1] [colType=tinyint(4)] []
[2023/07/07 21:08:03.737 +08:00] [ERROR] [base.go:315] ["failed to convert kv value"] [origVal=test_test_test_test_test_test_test_test_test_test_test_test_test_test_test_test_test_test_test_test_test_test_test_test_test_test_test_test_test_test_test_test_test_test_test_test_test_test_test_test_test_test_test_test_test_test_test_test_test_test_test_test_test_test_test_test_test_test_test_test_test_test_test_test_test_test_test_test_test_test_test_test_test_test_test_test_test_test_test_test_test_test_test_test_test_test_test_test_test_test_test_test_test_test_test_test_test_test_test_test_test_test_test_test_test_test_test_test_test_test_test_test_test_test_test_test_test_test_test_test_test_test_test_test_test_test_test_test_test_test_test_test_test_test_test_test_test_test_test_test_test_test_test_test_test_test_test_test_test_test_test_test_test_test_test_test_test_test_test_test_test_test_test_test_test_test_test_test_test_test_test_test_test_test_test_test_test_test_test_test_test_test_test_test_test_test_test_test_test_test_test_test_test_test_test_test_test_test_test_test_test_test_test_test_test] [fieldType=tinyint(4)] [column=c1] [columnID=7]

The length of the row is 2419.

So to check whether the "exceeds maximum file size" issue has been fixed, we could check whether the length of the row is larger than 500, which can make sure the log shows the first 1024 characters of the ill-formatted row instead of saying "write error: write length xxx exceeds maximum file size xxx".

Check List

Tests

  • Unit test
  • Integration test
  • Manual test (add detailed scripts or steps below)
  • No code

Side effects

  • Performance regression: Consumes more CPU
  • Performance regression: Consumes more Memory
  • Breaking backward compatibility

Documentation

  • Affects user behaviors
  • Contains syntax changes
  • Contains variable changes
  • Contains experimental features
  • Changes MySQL compatibility

Release note

Please refer to Release Notes Language Style Guide to write a quality release note.

When lightning encounters ill-formatted row, it can log the encoding error within which shows the first 1024 characters of the row content, instead of logging the write error that write length exceeds maximum file size.

Signed-off-by: ti-chi-bot <ti-community-prow-bot@tidb.io>
@ti-chi-bot ti-chi-bot added release-note Denotes a PR that will be considered when it comes time to generate release notes. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. type/cherry-pick-for-release-6.5 This PR is cherry-picked to release-6.5 from a source PR. labels Jul 14, 2023
@ti-chi-bot ti-chi-bot bot added do-not-merge/cherry-pick-not-approved release-note Denotes a PR that will be considered when it comes time to generate release notes. labels Jul 14, 2023
@ti-chi-bot ti-chi-bot bot added size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. and removed size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Jul 14, 2023
@ti-chi-bot ti-chi-bot bot added size/M Denotes a PR that changes 30-99 lines, ignoring generated files. and removed size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. labels Jul 18, 2023
@lyzx2001
Copy link
Contributor

/cc @lance6716

@ti-chi-bot ti-chi-bot bot requested a review from lance6716 July 18, 2023 16:36
@ti-chi-bot ti-chi-bot bot added needs-1-more-lgtm Indicates a PR needs 1 more LGTM. approved labels Jul 20, 2023
@lyzx2001
Copy link
Contributor

/cc @D3Hunter

@ti-chi-bot ti-chi-bot bot requested a review from D3Hunter July 20, 2023 07:52
@D3Hunter
Copy link
Contributor

/lgtm

@ti-chi-bot ti-chi-bot bot added lgtm and removed needs-1-more-lgtm Indicates a PR needs 1 more LGTM. labels Jul 24, 2023
@ti-chi-bot
Copy link

ti-chi-bot bot commented Jul 24, 2023

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: D3Hunter, lance6716

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@ti-chi-bot
Copy link

ti-chi-bot bot commented Jul 24, 2023

[LGTM Timeline notifier]

Timeline:

  • 2023-07-20 07:02:17.939416303 +0000 UTC m=+1179429.709755016: ☑️ agreed by lance6716.
  • 2023-07-24 05:47:22.508553365 +0000 UTC m=+160585.103084353: ☑️ agreed by D3Hunter.

@ti-chi-bot ti-chi-bot added the cherry-pick-approved Cherry pick PR approved by release team. label Jul 24, 2023
@codecov
Copy link

codecov bot commented Jul 24, 2023

Codecov Report

❗ No coverage uploaded for pull request base (release-6.5@905a155). Click here to learn what that means.
The diff coverage is n/a.

Additional details and impacted files
@@               Coverage Diff                @@
##             release-6.5     #45364   +/-   ##
================================================
  Coverage               ?   73.4470%           
================================================
  Files                  ?       1080           
  Lines                  ?     347039           
  Branches               ?          0           
================================================
  Hits                   ?     254890           
  Misses                 ?      75686           
  Partials               ?      16463           

@ti-chi-bot ti-chi-bot bot merged commit cf5b115 into pingcap:release-6.5 Jul 24, 2023
@ti-chi-bot ti-chi-bot deleted the cherry-pick-45241-to-release-6.5 branch April 15, 2025 08:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved cherry-pick-approved Cherry pick PR approved by release team. lgtm release-note Denotes a PR that will be considered when it comes time to generate release notes. size/M Denotes a PR that changes 30-99 lines, ignoring generated files. type/cherry-pick-for-release-6.5 This PR is cherry-picked to release-6.5 from a source PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants