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

Auto generate Global Server Settings markdown from source #2732

Open
Blargian opened this issue Oct 26, 2024 · 2 comments
Open

Auto generate Global Server Settings markdown from source #2732

Blargian opened this issue Oct 26, 2024 · 2 comments

Comments

@Blargian
Copy link
Collaborator

Child of #2730. Auto generate Global Server Settings markdown from source.

@Blargian
Copy link
Collaborator Author

Using this SQL query to generate a list of server settings documented in the markdown but which are not found in ServerSettings.cpp

WITH
    'docs/en/operations/server-configuration-parameters/settings.md' AS doc_file,
    'src/Core/ServerSettings.cpp' AS cpp_file,
    settings_from_docs AS
    (
        WITH
            arrayJoin(extractAllGroups(raw_blob, '## (\\w+)(?:\\s[^\n]+)?\n\\s+((?:[^#]|#[^#]|##[^ ])+)')) AS g,
            g[1] AS name,
            replaceRegexpAll(replaceRegexpAll(g[2], '\n(Type|Default( value)?): [^\n]+\n', ''), '^\n+|\n+$', '') AS doc
        SELECT
            name,
            doc
        FROM file(doc_file, RawBLOB)
    ),
    settings_from_cpp AS
    (
        WITH
            extractGroups(line, 'DECLARE\\((\\w+), (\\w+), ([^,]+|\',\'), "(.+?)"') AS g,
            g[1] AS type,
            g[2] AS name,
            g[3] AS default,
            g[4] AS doc,
            g[5] AS important,
            g[6] AS suffix
        SELECT
            name,
            type,
            default,
            doc,
            important,
            suffix
        FROM file(cpp_file, LineAsString)
        WHERE match(line, '^\\s*DECLARE\\(')
    )
SELECT name
FROM settings_from_docs
WHERE name NOT IN (
    SELECT name
    FROM settings_from_cpp
) AS settings_not_from_server_settings_cpp

We get the following list:

    ┌─name──────────────────────────────────────┐
 1. │ auth_use_forwarded_address                │
 2. │ builtin_dictionaries_reload_interval      │
 3. │ compression                               │
 4. │ encryption                                │
 5. │ error_log                                 │
 6. │ custom_settings_prefixes                  │
 7. │ core_dump                                 │
 8. │ default_profile                           │
 9. │ dictionaries_config                       │
10. │ user_defined_executable_functions_config  │
11. │ dictionaries_lazy_load                    │
12. │ format_schema_path                        │
13. │ graphite                                  │
14. │ graphite_rollup                           │
15. │ http_server_default_response              │
16. │ hsts_max_age                              │
17. │ mlock_executable                          │
18. │ include_from                              │
19. │ interserver_listen_host                   │
20. │ interserver_http_port                     │
21. │ interserver_http_host                     │
22. │ interserver_https_port                    │
23. │ interserver_https_host                    │
24. │ interserver_http_credentials              │
25. │ listen_host                               │
26. │ listen_try                                │
27. │ listen_reuse_port                         │
28. │ listen_backlog                            │
29. │ logger                                    │
30. │ send_crash_reports                        │
31. │ macros                                    │
32. │ replica_group_name                        │
33. │ max_open_files                            │
34. │ merge_tree                                │
35. │ metric_log                                │
36. │ replicated_merge_tree                     │
37. │ openSSL                                   │
38. │ part_log                                  │
39. │ path                                      │
40. │ query_log                                 │
41. │ query_cache                               │
42. │ query_thread_log                          │
43. │ query_views_log                           │
44. │ text_log                                  │
45. │ trace_log                                 │
46. │ asynchronous_insert_log                   │
47. │ crash_log                                 │
48. │ backup_log                                │
49. │ query_masking_rules                       │
50. │ remote_servers                            │
51. │ timezone                                  │
52. │ tcp_port                                  │
53. │ tcp_port_secure                           │
54. │ mysql_port                                │
55. │ postgresql_port                           │
56. │ tmp_path                                  │
57. │ user_files_path                           │
58. │ user_scripts_path                         │
59. │ user_defined_path                         │
60. │ users_config                              │
61. │ wait_dictionaries_load_at_startup         │
62. │ zookeeper                                 │
63. │ use_minimalistic_part_header_in_zookeeper │
64. │ distributed_ddl                           │
65. │ access_control_path                       │
66. │ user_directories                          │
67. │ proxy                                     │
    └─name──────────────────────────────────────┘

@gingerwizard
Copy link
Contributor

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants