Skip to content

Fix the bug that incomplete write batches are not truncated (#1934)#2002

Merged
ti-srebot merged 6 commits intopingcap:release-4.0from
ti-srebot:release-4.0-f9d94d5d56e2
May 27, 2021
Merged

Fix the bug that incomplete write batches are not truncated (#1934)#2002
ti-srebot merged 6 commits intopingcap:release-4.0from
ti-srebot:release-4.0-f9d94d5d56e2

Conversation

@ti-srebot
Copy link
Collaborator

@ti-srebot ti-srebot commented May 26, 2021

cherry-pick #1934 to release-4.0
You can switch your code base to this Pull Request by using git-extras:

# In tics repo:
git pr https://github.com/pingcap/tics/pull/2002

After apply modifications, you can push your change to this PR via:

git push git@github.com:ti-srebot/tics.git pr/2002:release-4.0-f9d94d5d56e2

What problem does this PR solve?

Issue Number: close #1932

Problem Summary: as the issue descript

What is changed and how it works?

If there is any incomplete write batch get ignored, truncate the meta file to throw away broken data

Related changes

  • PR to update pingcap/docs/pingcap/docs-cn:
  • Need to cherry-pick to the release branch:

Check List

Tests

  • Unit test
    • If comment out meta_on_disk.setSize(meta_file_pos); inside PageFile::setFileAppendPos, we can see error while running PageStorage_test.IgnoreIncompleteWriteBatch1
      Code: 49. DB::Exception: PageFile binary version not match {MergingReader of PageFile_1_0, type: Formal, sequence no: 0, meta offset: 217, data offset: 1024} [unknown_version=0] [file=/data1/tics/cmake-build-debug/tmp/data/t1/log/page_1_0/meta]
      
    • Or comment out ::ftruncate(file->getFd(), offset); inside writeFile, we can see error while running PageStorage_test.IgnoreIncompleteWriteBatch2
      Code: 49. DB::Exception: PageFile binary version not match {MergingReader of PageFile_1_0, type: Formal, sequence no: 0, meta offset: 217, data offset: 1024} [unknown_version=0] [file=/data1/tics/cmake-build-debug/tmp/data/t1/log/page_1_0/meta]
      

Side effects

Release note

  • Fix the bug that incomplete data may make TiFlash fail to restart

Signed-off-by: ti-srebot <ti-srebot@pingcap.com>
@ti-srebot ti-srebot added CHERRY-PICK cherry pick status/LGT1 Indicates that a PR has LGTM 1. type/bugfix This PR fixes a bug. labels May 26, 2021
@ti-srebot ti-srebot requested a review from flowbehappy May 26, 2021 16:05
@ti-srebot ti-srebot added this to the v4.0.13 milestone May 26, 2021
JaySon-Huang and others added 3 commits May 27, 2021 00:05
Signed-off-by: JaySon-Huang <jayson.hjs@gmail.com>
Signed-off-by: JaySon-Huang <jayson.hjs@gmail.com>
@JaySon-Huang
Copy link
Contributor

/run-all-tests

Signed-off-by: JaySon-Huang <jayson.hjs@gmail.com>

 Conflicts:
	dbms/src/Functions/tests/gtest_datetime_extract.cpp
	dbms/src/Storages/DeltaMerge/tests/gtest_dm_delta_index_manager.cpp
	dbms/src/TestUtils/TiFlashTestBasic.h
@JaySon-Huang
Copy link
Contributor

/merge

@ti-srebot ti-srebot added the status/can-merge Indicates a PR has been approved by a committer. label May 27, 2021
@ti-srebot
Copy link
Collaborator Author

/run-all-tests

@ti-srebot ti-srebot merged commit ef2d0fb into pingcap:release-4.0 May 27, 2021
@JaySon-Huang JaySon-Huang deleted the release-4.0-f9d94d5d56e2 branch May 27, 2021 05:32
@JaySon-Huang JaySon-Huang modified the milestones: v4.0.13, v4.0.14 May 28, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CHERRY-PICK cherry pick status/can-merge Indicates a PR has been approved by a committer. status/LGT1 Indicates that a PR has LGTM 1. type/bugfix This PR fixes a bug.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants