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

fix(query): max_threads can not determined automatically #8707

Merged
merged 2 commits into from
Nov 9, 2022

Conversation

TCeason
Copy link
Collaborator

@TCeason TCeason commented Nov 9, 2022

I hereby agree to the terms of the CLA available at: https://databend.rs/dev/policies/cla/

Summary

Fix max_threads can not determined automatically

The max_threads has default user_settings user_setting: UserSetting::create("max_threads", UserSettingValue::UInt64(16)),

If a connection connect to databend , it will set max_threads = 16, then this if branch will not cover.

// Overwrite settings from conf or global set.
        {
            // Set max threads.
            if ret.get_max_threads()? == 0 {
                let cpus = if conf.query.num_cpus == 0 {
                    num_cpus::get() as u64
                } else {
                    conf.query.num_cpus
                };
                ret.set_max_threads(cpus)?;
            }
        }

Test on local

~ cat /proc/cpuinfo|grep process|wc -l
24
➜  ~ mysql -uroot -P3307 -h127.0.0.1 -e "show settings like 'max_threads'"
+-------------+-------+---------+---------+--------------------------------------------------------------------------------------------------------------------+--------+
| name        | value | default | level   | description                                                                                                        | type   |
+-------------+-------+---------+---------+--------------------------------------------------------------------------------------------------------------------+--------+
| max_threads | 24    | 0       | SESSION | The maximum number of threads to execute the request. By default the value is 0 it means determined automatically. | UInt64 |
+-------------+-------+---------+---------+--------------------------------------------------------------------------------------------------------------------+--------+

Closes #8706

@TCeason TCeason requested a review from sundy-li November 9, 2022 03:40
@vercel
Copy link

vercel bot commented Nov 9, 2022

The latest updates on your projects. Learn more about Vercel for Git ↗︎

1 Ignored Deployment
Name Status Preview Updated
databend ⬜️ Ignored (Inspect) Nov 9, 2022 at 5:48AM (UTC)

@TCeason
Copy link
Collaborator Author

TCeason commented Nov 9, 2022

cc @wubx

@mergify mergify bot added the pr-bugfix this PR patches a bug in codebase label Nov 9, 2022
@TCeason
Copy link
Collaborator Author

TCeason commented Nov 9, 2022

Dev MacOS / test_stateless_cluster_macos(optional) (pull_request) Failing after 14m

Failed. other test is ok.

@BohuTANG BohuTANG merged commit aee9cba into databendlabs:main Nov 9, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pr-bugfix this PR patches a bug in codebase
Projects
None yet
Development

Successfully merging this pull request may close these issues.

bug: max_threads can not determined automatically
3 participants