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

session: fix upgrade process for bootstrap v90 #34862

Merged
merged 2 commits into from May 22, 2022

Conversation

morgo
Copy link
Contributor

@morgo morgo commented May 20, 2022

What problem does this PR solve?

Issue Number: close #34847

Problem Summary:

The bootstrap upgrade process did not work when there was no config file present. It has been fixed to handle this case correctly.

What is changed and how it works?

Check List

Tests

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

My upgrade script:

#!/bin/bash

killall -9 tidb-server tikv-server pd-server my-tidb-server
rm -rf /tmp/tidb*
rm -rf /tmp/100*_tidb/
/tmp/my-tidb-server -L warn &

cd ~/go/src/github.com/morgo/tidb
make

sleep 5 

killall -9 tidb-server tikv-server pd-server my-tidb-server
./bin/tidb-server -L warn # -config ~/.tidb.toml

Previous output (trimmed for readability):

["enable-batch-dml is now configured by the system variable tidb_enable_batch_dml. One-time importing the value specified in tidb.toml file"] [value=OFF]
["mem-quota-query is now configured by the system variable tidb_mem_quota_query. One-time importing the value specified in tidb.toml file"] [value=0]
["query-log-max-len is now configured by the system variable tidb_query_log_max_len. One-time importing the value specified in tidb.toml file"] [value="0 10"]
["committer-concurrency is now configured by the system variable tidb_committer_concurrency. One-time importing the value specified in tidb.toml file"] [value=0]
["run-auto-analyze is now configured by the system variable tidb_enable_auto_analyze. One-time importing the value specified in tidb.toml file"] [value=OFF]
["oom-action is now configured by the system variable tidb_mem_oom_action. One-time importing the value specified in tidb.toml file"] [value=]
["prepared-plan-cache.enable is now configured by the system variable tidb_enable_prepared_plan_cache. One-time importing the value specified in tidb.toml file"] [value=OFF]
["prepared-plan-cache.capacity is now configured by the system variable tidb_prepared_plan_cache_size. One-time importing the value specified in tidb.toml file"] [value=1000]
["prepared-plan-cache.memory-guard-ratio is now configured by the system variable tidb_prepared_plan_cache_memory_guard_ratio. One-time importing the value specified in tidb.toml file"] [value=0.1]

New output:

["enable-batch-dml is now configured by the system variable tidb_enable_batch_dml. One-time importing the value specified in tidb.toml file"] [value=OFF]
["run-auto-analyze is now configured by the system variable tidb_enable_auto_analyze. One-time importing the value specified in tidb.toml file"] [value=OFF]
["prepared-plan-cache.enable is now configured by the system variable tidb_enable_prepared_plan_cache. One-time importing the value specified in tidb.toml file"] [value=OFF]
["prepared-plan-cache.capacity is now configured by the system variable tidb_prepared_plan_cache_size. One-time importing the value specified in tidb.toml file"] [value=1000]
["prepared-plan-cache.memory-guard-ratio is now configured by the system variable tidb_prepared_plan_cache_memory_guard_ratio. One-time importing the value specified in tidb.toml file"] [value=0.1]

Confirming that it still works when a config file is present:

["enable-batch-dml is now configured by the system variable tidb_enable_batch_dml. One-time importing the value specified in tidb.toml file"] [value=ON]
["mem-quota-query is now configured by the system variable tidb_mem_quota_query. One-time importing the value specified in tidb.toml file"] [value=1073741824]
["query-log-max-len is now configured by the system variable tidb_query_log_max_len. One-time importing the value specified in tidb.toml file"] [value=4096]
["committer-concurrency is now configured by the system variable tidb_committer_concurrency. One-time importing the value specified in tidb.toml file"] [value=128]
["run-auto-analyze is now configured by the system variable tidb_enable_auto_analyze. One-time importing the value specified in tidb.toml file"] [value=ON]
["oom-action is now configured by the system variable tidb_mem_oom_action. One-time importing the value specified in tidb.toml file"] [value=cancel]
["prepared-plan-cache.enable is now configured by the system variable tidb_enable_prepared_plan_cache. One-time importing the value specified in tidb.toml file"] [value=OFF]
["prepared-plan-cache.capacity is now configured by the system variable tidb_prepared_plan_cache_size. One-time importing the value specified in tidb.toml file"] [value=1000]
["prepared-plan-cache.memory-guard-ratio is now configured by the system variable tidb_prepared_plan_cache_memory_guard_ratio. One-time importing the value specified in tidb.toml file"] [value=0.1]

  • 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.

None

@morgo morgo requested a review from a team as a code owner May 20, 2022 15:06
@ti-chi-bot
Copy link
Member

ti-chi-bot commented May 20, 2022

[REVIEW NOTIFICATION]

This pull request has been approved by:

  • bb7133
  • ngaut

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 release-note-none size/S Denotes a PR that changes 10-29 lines, ignoring generated files. labels May 20, 2022
@sre-bot
Copy link
Contributor

sre-bot commented May 20, 2022

Copy link
Member

@bb7133 bb7133 left a comment

Choose a reason for hiding this comment

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

LGTM

@@ -1835,6 +1835,15 @@ func upgradeToVer89(s Session, ver int64) {
// to the error log. The message is important since the behavior is weird
// (changes to the config file will no longer take effect past this point).
func importConfigOption(s Session, configName, svName, valStr string) {
if valStr == "" || valStr == "0" {
Copy link
Member

Choose a reason for hiding this comment

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

There will be a little chance that '0' is explicitly specified in the configuration file, but IMHO it's fine to skip it here.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That's right. It will need to be fixed if we import a possible 0-value config item in future.

i.e. For most cache-settings we usually have a flag for enabled, and another flag for capacity. But it's common (outside of tidb) that you just have one flag for capacity, and 0 means not enabled. If this case existed it might not be handled correctly.

@ti-chi-bot ti-chi-bot added the status/LGT1 Indicates that a PR has LGTM 1. label May 20, 2022
@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 May 22, 2022
@bb7133
Copy link
Member

bb7133 commented May 22, 2022

/merge

@ti-chi-bot
Copy link
Member

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

Commit hash: 422d086

@ti-chi-bot ti-chi-bot added the status/can-merge Indicates a PR has been approved by a committer. label May 22, 2022
@ti-chi-bot ti-chi-bot merged commit 388b3c7 into pingcap:master May 22, 2022
ti-srebot pushed a commit to ti-srebot/tidb that referenced this pull request May 22, 2022
Signed-off-by: ti-srebot <ti-srebot@pingcap.com>
@ti-srebot
Copy link
Contributor

cherry pick to release-6.1 in PR #34870

@sre-bot
Copy link
Contributor

sre-bot commented May 22, 2022

TiDB MergeCI notify

CI Name Result Duration Compare with Parent commit
idc-jenkins-ci/integration-cdc-test 🟢 all 34 tests passed 24 min Existing passed
idc-jenkins-ci-tidb/integration-common-test 🟢 all 11 tests passed 20 min Existing passed
idc-jenkins-ci-tidb/common-test 🟢 all 12 tests passed 5 min 30 sec Existing passed
idc-jenkins-ci-tidb/integration-ddl-test 🟢 all 6 tests passed 5 min 16 sec Existing passed
idc-jenkins-ci-tidb/sqllogic-test-2 🟢 all 28 tests passed 5 min 10 sec Existing passed
idc-jenkins-ci-tidb/tics-test 🟢 all 1 tests passed 4 min 49 sec Existing passed
idc-jenkins-ci-tidb/sqllogic-test-1 🟢 all 26 tests passed 4 min 21 sec Existing passed
idc-jenkins-ci-tidb/mybatis-test 🟢 all 1 tests passed 3 min 10 sec Existing passed
idc-jenkins-ci-tidb/integration-compatibility-test 🟢 all 1 tests passed 2 min 59 sec Existing passed
idc-jenkins-ci-tidb/plugin-test 🟢 build success, plugin test success 4min Existing passed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs-cherry-pick-release-6.1 release-note-none size/S Denotes a PR that changes 10-29 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.

some system variable default value are different after upgrade
6 participants