Skip to content
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

PageStorage: Fix some bugs #4212

Merged
merged 12 commits into from
Mar 14, 2022
Merged

PageStorage: Fix some bugs #4212

merged 12 commits into from
Mar 14, 2022

Conversation

JaySon-Huang
Copy link
Contributor

@JaySon-Huang JaySon-Huang commented Mar 9, 2022

What problem does this PR solve?

Issue Number: ref #3594

Problem Summary:

What is changed and how it works?

  • a5991b1 fix that if we start an instance of PageStorage without any write operatorations, calling gc will make it crash
  • c9904eb fix that restoring will read the checkpoint file infinitely; and we should remove the checkpoint file from all_files or we will read the checkpoint file twice

  • aef7c37 fix that if we do sth like this:
    • put 1 -> entry1@BlobFile{id:1, offset=0x00}
    • put 1 -> entry2@BlobFile{id:1, offset=0xFF}
    • in memory gc remove entry1
    • put 3 -> entry3@BlobFile{id:1, offset=0x0} <-- reuse the space @ BlobFile 1

when we restore blobstat, we can not know that entry1 is removed in memory. So we need to restore blob stat this way:

  • Restore the whole MVCCMap
  • Use the latest entry of each page id to restore the blob stats

1479d4a fix the problem for external page

  • DeltaTree may generate a dmf_100 and add external page 100 to PageStorage
  • Add reference 101 -> 100
  • Delete external page 100
  • The external page 100 is logically deleted, but the dmf_100 remains on disk, and we directly add a reference to the file id, so PageStorage see "Add reference 102 -> 100" after 100 get logical deleted.

e19947b
Remove a check that is not necessary, it does not help checking anything. create_ver.sequence does not represent the sequence of being-ref-entry, but the ref-entry itself. So it is allow.

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

None

@ti-chi-bot
Copy link
Member

ti-chi-bot commented Mar 9, 2022

[REVIEW NOTIFICATION]

This pull request has been approved by:

  • jiaqizho
  • lidezhu

To complete the pull request process, please ask the reviewers in the list to review by filling /cc @reviewer in the comment.
After your PR has acquired the required number of LGTMs, you can assign this pull request to the committer in the list by filling /assign @committer in the comment to help you merge this pull request.

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

Reviewer can indicate their review by submitting an approval review.
Reviewer can cancel approval by submitting a request changes review.

@ti-chi-bot ti-chi-bot added do-not-merge/needs-linked-issue release-note-none Denotes a PR that doesn't merit a release note. size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. and removed do-not-merge/needs-linked-issue labels Mar 9, 2022
@JaySon-Huang
Copy link
Contributor Author

/run-all-tests

@sre-bot
Copy link
Collaborator

sre-bot commented Mar 9, 2022

Coverage for changed files

Filename                           Regions    Missed Regions     Cover   Functions  Missed Functions  Executed       Lines      Missed Lines     Cover    Branches   Missed Branches     Cover
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
PageDirectory.cpp                      437                66    84.90%          30                 3    90.00%         981               191    80.53%         362                83    77.07%
PageDirectory.h                         20                 4    80.00%          20                 4    80.00%          89                15    83.15%           0                 0         -
PageDirectoryFactory.cpp                36                 8    77.78%           4                 0   100.00%         104                20    80.77%          42                 9    78.57%
PageEntriesEdit.h                       44                 6    86.36%          29                 4    86.21%         147                38    74.15%          14                 6    57.14%
WAL/WALReader.cpp                       71                 9    87.32%           9                 0   100.00%         173                13    92.49%          54                12    77.78%
WAL/serialize.cpp                       47                11    76.60%          15                 1    93.33%         190                41    78.42%          52                16    69.23%
WALStore.cpp                            80                50    37.50%           8                 1    87.50%         126                49    61.11%          38                25    34.21%
tests/gtest_page_directory.cpp        8494              1499    82.35%          46                 0   100.00%        1549                 7    99.55%        2672              1352    49.40%
tests/gtest_page_storage.cpp          2599               952    63.37%          31                 7    77.42%         701               154    78.03%         832               498    40.14%
tests/gtest_wal_store.cpp             1941               260    86.60%          11                 0   100.00%         450                12    97.33%         642               314    51.09%
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
TOTAL                                13769              2865    79.19%         203                20    90.15%        4510               540    88.03%        4708              2315    50.83%

Coverage summary

Functions  MissedFunctions  Executed  Lines   MissedLines  Cover
16784      9448             43.71%    189173  95719        49.40%

full coverage report (for internal network access only)

@JaySon-Huang JaySon-Huang requested review from jiaqizho and lidezhu March 9, 2022 13:31
@jiaqizho
Copy link
Contributor

@JaySon-Huang could you add some description(about the bug) in this PR? I got a little confused.

@JaySon-Huang
Copy link
Contributor Author

@jiaqizho Updated. This PR combines several bug fixes from different aspects. You may want to check them by the commit instead of the whole changes of this PR.

@JaySon-Huang
Copy link
Contributor Author

/run-integration-test

1 similar comment
@JaySon-Huang
Copy link
Contributor Author

/run-integration-test

@ti-chi-bot ti-chi-bot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Mar 12, 2022
@ti-chi-bot ti-chi-bot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Mar 14, 2022
@JaySon-Huang
Copy link
Contributor Author

/run-all-tests

Copy link
Contributor

@jiaqizho jiaqizho left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LTGM

@ti-chi-bot ti-chi-bot added status/LGT1 Indicates that a PR has LGTM 1. and removed do-not-merge/needs-linked-issue labels Mar 14, 2022
@JaySon-Huang
Copy link
Contributor Author

/run-all-tests

@sre-bot
Copy link
Collaborator

sre-bot commented Mar 14, 2022

Coverage for changed files

Filename                                            Regions    Missed Regions     Cover   Functions  Missed Functions  Executed       Lines      Missed Lines     Cover    Branches   Missed Branches     Cover
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Flash/Mpp/MPPTunnel.h                                     8                 8     0.00%           8                 8     0.00%          14                14     0.00%           0                 0         -
Storages/Page/V3/PageDirectory.cpp                      441                68    84.58%          30                 3    90.00%         986               195    80.22%         364                84    76.92%
Storages/Page/V3/PageDirectory.h                         24                 6    75.00%          24                 6    75.00%         101                21    79.21%           0                 0         -
Storages/Page/V3/PageDirectoryFactory.cpp                36                 8    77.78%           4                 0   100.00%         104                20    80.77%          42                 9    78.57%
Storages/Page/V3/PageEntriesEdit.h                       54                10    81.48%          39                 8    79.49%         157                42    73.25%          14                 6    57.14%
Storages/Page/V3/WAL/WALReader.cpp                       71                 9    87.32%           9                 0   100.00%         173                13    92.49%          54                12    77.78%
Storages/Page/V3/WAL/serialize.cpp                       47                11    76.60%          15                 1    93.33%         190                41    78.42%          52                16    69.23%
Storages/Page/V3/WALStore.cpp                            80                50    37.50%           8                 1    87.50%         126                49    61.11%          38                25    34.21%
Storages/Page/V3/tests/gtest_page_directory.cpp        8494              1499    82.35%          46                 0   100.00%        1549                 7    99.55%        2672              1352    49.40%
Storages/Page/V3/tests/gtest_page_storage.cpp          2599               952    63.37%          31                 7    77.42%         704               154    78.12%         832               498    40.14%
Storages/Page/V3/tests/gtest_wal_store.cpp             1941               260    86.60%          11                 0   100.00%         450                12    97.33%         642               314    51.09%
Storages/Transaction/SchemaBuilder.cpp                  835               794     4.91%          46                42     8.70%        1030               958     6.99%         488               468     4.10%
Storages/Transaction/SchemaGetter.h                       1                 1     0.00%           1                 1     0.00%           1                 1     0.00%           0                 0         -
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
TOTAL                                                 14631              3676    74.88%         272                77    71.69%        5585              1527    72.66%        5198              2784    46.44%

Coverage summary

Functions  MissedFunctions  Executed  Lines   MissedLines  Cover
16861      9457             43.91%    189873  95858        49.51%

full coverage report (for internal network access only)

@jiaqizho
Copy link
Contributor

@JaySon-Huang

dbms/src/Storages/Page/V3/PageDirectoryFactory.cpp:42:22: error: unused variable ‘reader’ [-Werror=unused-variable]
     auto [wal, reader] = WALStore::create(file_provider, delegator);
                      ^

please add

(void)reader;

@ti-chi-bot ti-chi-bot added status/LGT2 Indicates that a PR has LGTM 2. and removed status/LGT1 Indicates that a PR has LGTM 1. labels Mar 14, 2022
@JaySon-Huang
Copy link
Contributor Author

@JaySon-Huang

dbms/src/Storages/Page/V3/PageDirectoryFactory.cpp:42:22: error: unused variable ‘reader’ [-Werror=unused-variable]
     auto [wal, reader] = WALStore::create(file_provider, delegator);
                      ^

please add

(void)reader;

Done

@JaySon-Huang
Copy link
Contributor Author

/merge

@ti-chi-bot
Copy link
Member

@JaySon-Huang: It seems you want to merge this PR, I will help you trigger all the tests:

/run-all-tests

You only need to trigger /merge once, and if the CI test fails, you just re-trigger the test that failed and the bot will merge the PR for you after the CI passes.

If you have any questions about the PR merge process, please refer to pr process.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the ti-community-infra/tichi repository.

@ti-chi-bot
Copy link
Member

This pull request has been accepted and is ready to merge.

Commit hash: e014bc2

@ti-chi-bot ti-chi-bot added the status/can-merge Indicates a PR has been approved by a committer. label Mar 14, 2022
@sre-bot
Copy link
Collaborator

sre-bot commented Mar 14, 2022

Coverage for changed files

Filename                                            Regions    Missed Regions     Cover   Functions  Missed Functions  Executed       Lines      Missed Lines     Cover    Branches   Missed Branches     Cover
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Flash/Mpp/MPPTunnel.h                                     8                 8     0.00%           8                 8     0.00%          14                14     0.00%           0                 0         -
Interpreters/Settings.h                                   1                 0   100.00%           1                 0   100.00%           1                 0   100.00%           0                 0         -
Storages/Page/V3/PageDirectory.cpp                      441                68    84.58%          30                 3    90.00%         986               195    80.22%         364                84    76.92%
Storages/Page/V3/PageDirectory.h                         24                 6    75.00%          24                 6    75.00%         101                21    79.21%           0                 0         -
Storages/Page/V3/PageDirectoryFactory.cpp                36                 8    77.78%           4                 0   100.00%         105                20    80.95%          42                 9    78.57%
Storages/Page/V3/PageEntriesEdit.h                       54                10    81.48%          39                 8    79.49%         157                42    73.25%          14                 6    57.14%
Storages/Page/V3/WAL/WALReader.cpp                       71                 9    87.32%           9                 0   100.00%         173                13    92.49%          54                12    77.78%
Storages/Page/V3/WAL/serialize.cpp                       47                11    76.60%          15                 1    93.33%         190                41    78.42%          52                16    69.23%
Storages/Page/V3/WALStore.cpp                            69                39    43.48%           8                 1    87.50%         119                42    64.71%          32                19    40.62%
Storages/Page/V3/tests/entries_helper.h                  65                36    44.62%          10                 3    70.00%         238               111    53.36%          32                21    34.38%
Storages/Page/V3/tests/gtest_page_directory.cpp        8494              1499    82.35%          46                 0   100.00%        1549                 7    99.55%        2672              1352    49.40%
Storages/Page/V3/tests/gtest_page_storage.cpp          2599               952    63.37%          31                 7    77.42%         704               154    78.12%         832               498    40.14%
Storages/Page/V3/tests/gtest_wal_store.cpp             1941               260    86.60%          11                 0   100.00%         451                13    97.12%         642               314    51.09%
Storages/Transaction/SchemaBuilder.cpp                  835               794     4.91%          46                42     8.70%        1030               958     6.99%         488               468     4.10%
Storages/Transaction/SchemaGetter.h                       1                 1     0.00%           1                 1     0.00%           1                 1     0.00%           0                 0         -
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
TOTAL                                                 14686              3701    74.80%         283                80    71.73%        5819              1632    71.95%        5224              2799    46.42%

Coverage summary

Functions  MissedFunctions  Executed  Lines   MissedLines  Cover
16861      9457             43.91%    189868  95840        49.52%

full coverage report (for internal network access only)

@ti-chi-bot ti-chi-bot merged commit 3d75154 into pingcap:master Mar 14, 2022
@JaySon-Huang JaySon-Huang deleted the fix_ps_v3 branch March 14, 2022 09:43
ywqzzy pushed a commit to ywqzzy/tiflash_1 that referenced this pull request Mar 14, 2022
ywqzzy added a commit to ywqzzy/tiflash_1 that referenced this pull request Mar 14, 2022
Signed-off-by: ywqzzy <[email protected]>

update.

Signed-off-by: ywqzzy <[email protected]>

update.

Signed-off-by: ywqzzy <[email protected]>

Split write and ingest throughput (pingcap#4245)

close pingcap#4243

Signed-off-by: ywqzzy <[email protected]>

fix the problem that expired data was not recycled timely due to slow gc speed (pingcap#4224)

close pingcap#4146

Signed-off-by: ywqzzy <[email protected]>

PageStorage: Fix some bugs (pingcap#4212)

ref pingcap#3594

Signed-off-by: ywqzzy <[email protected]>

Make test of CreateTables using affected opts (pingcap#4239)

close pingcap#4235

Signed-off-by: ywqzzy <[email protected]>

BlobStore: remove the old_ids, not need recycle the blob id. (pingcap#4247)

ref pingcap#3594

Signed-off-by: ywqzzy <[email protected]>

support `PartitionTableScan` in TiFlash (pingcap#3876)

close pingcap#3873

Signed-off-by: ywqzzy <[email protected]>

update.

Signed-off-by: ywqzzy <[email protected]>

update.

Signed-off-by: ywqzzy <[email protected]>

support last_day and dayofmonth pushdown to tiflash (pingcap#4183)

close pingcap#4149

Signed-off-by: ywqzzy <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
release-note-none Denotes a PR that doesn't merit a release note. size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. status/can-merge Indicates a PR has been approved by a committer. status/LGT2 Indicates that a PR has LGTM 2.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants