| 1 | #include <Databases/IDatabase.h> |
| 2 | #include <Storages/System/attachSystemTables.h> |
| 3 | |
| 4 | #include <Storages/System/StorageSystemAggregateFunctionCombinators.h> |
| 5 | #include <Storages/System/StorageSystemAsynchronousMetrics.h> |
| 6 | #include <Storages/System/StorageSystemBuildOptions.h> |
| 7 | #include <Storages/System/StorageSystemCollations.h> |
| 8 | #include <Storages/System/StorageSystemClusters.h> |
| 9 | #include <Storages/System/StorageSystemColumns.h> |
| 10 | #include <Storages/System/StorageSystemDatabases.h> |
| 11 | #include <Storages/System/StorageSystemDataTypeFamilies.h> |
| 12 | #include <Storages/System/StorageSystemDetachedParts.h> |
| 13 | #include <Storages/System/StorageSystemDictionaries.h> |
| 14 | #include <Storages/System/StorageSystemEvents.h> |
| 15 | #include <Storages/System/StorageSystemFormats.h> |
| 16 | #include <Storages/System/StorageSystemFunctions.h> |
| 17 | #include <Storages/System/StorageSystemGraphite.h> |
| 18 | #include <Storages/System/StorageSystemMacros.h> |
| 19 | #include <Storages/System/StorageSystemMerges.h> |
| 20 | #include <Storages/System/StorageSystemMetrics.h> |
| 21 | #include <Storages/System/StorageSystemModels.h> |
| 22 | #include <Storages/System/StorageSystemMutations.h> |
| 23 | #include <Storages/System/StorageSystemNumbers.h> |
| 24 | #include <Storages/System/StorageSystemOne.h> |
| 25 | #include <Storages/System/StorageSystemParts.h> |
| 26 | #include <Storages/System/StorageSystemPartsColumns.h> |
| 27 | #include <Storages/System/StorageSystemProcesses.h> |
| 28 | #include <Storages/System/StorageSystemQuotas.h> |
| 29 | #include <Storages/System/StorageSystemQuotaUsage.h> |
| 30 | #include <Storages/System/StorageSystemReplicas.h> |
| 31 | #include <Storages/System/StorageSystemReplicationQueue.h> |
| 32 | #include <Storages/System/StorageSystemRowPolicies.h> |
| 33 | #include <Storages/System/StorageSystemSettings.h> |
| 34 | #include <Storages/System/StorageSystemMergeTreeSettings.h> |
| 35 | #include <Storages/System/StorageSystemTableEngines.h> |
| 36 | #include <Storages/System/StorageSystemTableFunctions.h> |
| 37 | #include <Storages/System/StorageSystemTables.h> |
| 38 | #include <Storages/System/StorageSystemZooKeeper.h> |
| 39 | #include <Storages/System/StorageSystemContributors.h> |
| 40 | #include <Storages/System/StorageSystemDisks.h> |
| 41 | #include <Storages/System/StorageSystemStoragePolicies.h> |
| 42 | |
| 43 | #ifdef OS_LINUX |
| 44 | #include <Storages/System/StorageSystemStackTrace.h> |
| 45 | #endif |
| 46 | |
| 47 | |
| 48 | namespace DB |
| 49 | { |
| 50 | |
| 51 | void attachSystemTablesLocal(IDatabase & system_database) |
| 52 | { |
| 53 | system_database.attachTable("one" , StorageSystemOne::create("one" )); |
| 54 | system_database.attachTable("numbers" , StorageSystemNumbers::create("numbers" , false)); |
| 55 | system_database.attachTable("numbers_mt" , StorageSystemNumbers::create("numbers_mt" , true)); |
| 56 | system_database.attachTable("databases" , StorageSystemDatabases::create("databases" )); |
| 57 | system_database.attachTable("tables" , StorageSystemTables::create("tables" )); |
| 58 | system_database.attachTable("columns" , StorageSystemColumns::create("columns" )); |
| 59 | system_database.attachTable("functions" , StorageSystemFunctions::create("functions" )); |
| 60 | system_database.attachTable("events" , StorageSystemEvents::create("events" )); |
| 61 | system_database.attachTable("settings" , StorageSystemSettings::create("settings" )); |
| 62 | system_database.attachTable("quotas" , StorageSystemQuotas::create("quotas" )); |
| 63 | system_database.attachTable("quota_usage" , StorageSystemQuotaUsage::create("quota_usage" )); |
| 64 | system_database.attachTable("row_policies" , StorageSystemRowPolicies::create("row_policies" )); |
| 65 | system_database.attachTable("merge_tree_settings" , SystemMergeTreeSettings::create("merge_tree_settings" )); |
| 66 | system_database.attachTable("build_options" , StorageSystemBuildOptions::create("build_options" )); |
| 67 | system_database.attachTable("formats" , StorageSystemFormats::create("formats" )); |
| 68 | system_database.attachTable("table_functions" , StorageSystemTableFunctions::create("table_functions" )); |
| 69 | system_database.attachTable("aggregate_function_combinators" , StorageSystemAggregateFunctionCombinators::create("aggregate_function_combinators" )); |
| 70 | system_database.attachTable("data_type_families" , StorageSystemDataTypeFamilies::create("data_type_families" )); |
| 71 | system_database.attachTable("collations" , StorageSystemCollations::create("collations" )); |
| 72 | system_database.attachTable("table_engines" , StorageSystemTableEngines::create("table_engines" )); |
| 73 | system_database.attachTable("contributors" , StorageSystemContributors::create("contributors" )); |
| 74 | #ifdef OS_LINUX |
| 75 | system_database.attachTable("stack_trace" , StorageSystemStackTrace::create("stack_trace" )); |
| 76 | #endif |
| 77 | } |
| 78 | |
| 79 | void attachSystemTablesServer(IDatabase & system_database, bool has_zookeeper) |
| 80 | { |
| 81 | attachSystemTablesLocal(system_database); |
| 82 | system_database.attachTable("parts" , StorageSystemParts::create("parts" )); |
| 83 | system_database.attachTable("detached_parts" , createDetachedPartsTable()); |
| 84 | system_database.attachTable("parts_columns" , StorageSystemPartsColumns::create("parts_columns" )); |
| 85 | system_database.attachTable("disks" , StorageSystemDisks::create("disks" )); |
| 86 | system_database.attachTable("storage_policies" , StorageSystemStoragePolicies::create("storage_policies" )); |
| 87 | system_database.attachTable("processes" , StorageSystemProcesses::create("processes" )); |
| 88 | system_database.attachTable("metrics" , StorageSystemMetrics::create("metrics" )); |
| 89 | system_database.attachTable("merges" , StorageSystemMerges::create("merges" )); |
| 90 | system_database.attachTable("mutations" , StorageSystemMutations::create("mutations" )); |
| 91 | system_database.attachTable("replicas" , StorageSystemReplicas::create("replicas" )); |
| 92 | system_database.attachTable("replication_queue" , StorageSystemReplicationQueue::create("replication_queue" )); |
| 93 | system_database.attachTable("dictionaries" , StorageSystemDictionaries::create("dictionaries" )); |
| 94 | system_database.attachTable("models" , StorageSystemModels::create("models" )); |
| 95 | system_database.attachTable("clusters" , StorageSystemClusters::create("clusters" )); |
| 96 | system_database.attachTable("graphite_retentions" , StorageSystemGraphite::create("graphite_retentions" )); |
| 97 | system_database.attachTable("macros" , StorageSystemMacros::create("macros" )); |
| 98 | |
| 99 | if (has_zookeeper) |
| 100 | system_database.attachTable("zookeeper" , StorageSystemZooKeeper::create("zookeeper" )); |
| 101 | } |
| 102 | |
| 103 | void attachSystemTablesAsync(IDatabase & system_database, AsynchronousMetrics & async_metrics) |
| 104 | { |
| 105 | system_database.attachTable("asynchronous_metrics" , StorageSystemAsynchronousMetrics::create("asynchronous_metrics" , async_metrics)); |
| 106 | } |
| 107 | |
| 108 | } |
| 109 | |