2017-06-18 05:43:29 +00:00
|
|
|
#include <Databases/IDatabase.h>
|
2017-04-01 09:19:00 +00:00
|
|
|
#include <Storages/System/attachSystemTables.h>
|
2017-03-14 18:39:06 +00:00
|
|
|
|
2018-07-20 10:00:56 +00:00
|
|
|
#include <Storages/System/StorageSystemAggregateFunctionCombinators.h>
|
2017-04-01 09:19:00 +00:00
|
|
|
#include <Storages/System/StorageSystemAsynchronousMetrics.h>
|
|
|
|
#include <Storages/System/StorageSystemBuildOptions.h>
|
2018-07-20 13:17:16 +00:00
|
|
|
#include <Storages/System/StorageSystemCollations.h>
|
2017-04-01 09:19:00 +00:00
|
|
|
#include <Storages/System/StorageSystemClusters.h>
|
|
|
|
#include <Storages/System/StorageSystemColumns.h>
|
|
|
|
#include <Storages/System/StorageSystemDatabases.h>
|
2018-07-20 10:00:56 +00:00
|
|
|
#include <Storages/System/StorageSystemDataTypeFamilies.h>
|
2019-05-20 16:24:36 +00:00
|
|
|
#include <Storages/System/StorageSystemDetachedParts.h>
|
2017-04-01 09:19:00 +00:00
|
|
|
#include <Storages/System/StorageSystemDictionaries.h>
|
|
|
|
#include <Storages/System/StorageSystemEvents.h>
|
2018-07-20 10:00:56 +00:00
|
|
|
#include <Storages/System/StorageSystemFormats.h>
|
2017-04-01 09:19:00 +00:00
|
|
|
#include <Storages/System/StorageSystemFunctions.h>
|
|
|
|
#include <Storages/System/StorageSystemGraphite.h>
|
2020-05-12 20:31:30 +00:00
|
|
|
|
2018-03-12 18:38:00 +00:00
|
|
|
#include <Storages/System/StorageSystemMacros.h>
|
2017-04-01 09:19:00 +00:00
|
|
|
#include <Storages/System/StorageSystemMerges.h>
|
|
|
|
#include <Storages/System/StorageSystemMetrics.h>
|
2017-12-04 12:15:21 +00:00
|
|
|
#include <Storages/System/StorageSystemModels.h>
|
2018-06-07 13:28:39 +00:00
|
|
|
#include <Storages/System/StorageSystemMutations.h>
|
2017-04-01 09:19:00 +00:00
|
|
|
#include <Storages/System/StorageSystemNumbers.h>
|
|
|
|
#include <Storages/System/StorageSystemOne.h>
|
|
|
|
#include <Storages/System/StorageSystemParts.h>
|
2017-12-04 15:44:31 +00:00
|
|
|
#include <Storages/System/StorageSystemPartsColumns.h>
|
2017-04-01 09:19:00 +00:00
|
|
|
#include <Storages/System/StorageSystemProcesses.h>
|
|
|
|
#include <Storages/System/StorageSystemReplicas.h>
|
|
|
|
#include <Storages/System/StorageSystemReplicationQueue.h>
|
|
|
|
#include <Storages/System/StorageSystemSettings.h>
|
2018-08-10 17:42:12 +00:00
|
|
|
#include <Storages/System/StorageSystemMergeTreeSettings.h>
|
2018-07-25 16:08:23 +00:00
|
|
|
#include <Storages/System/StorageSystemTableEngines.h>
|
2018-07-20 10:00:56 +00:00
|
|
|
#include <Storages/System/StorageSystemTableFunctions.h>
|
2017-04-01 09:19:00 +00:00
|
|
|
#include <Storages/System/StorageSystemTables.h>
|
|
|
|
#include <Storages/System/StorageSystemZooKeeper.h>
|
2018-11-01 18:01:10 +00:00
|
|
|
#include <Storages/System/StorageSystemContributors.h>
|
2020-05-11 04:36:32 +00:00
|
|
|
#if !defined(ARCADIA_BUILD)
|
|
|
|
#include <Storages/System/StorageSystemLicenses.h>
|
|
|
|
#endif
|
2019-05-24 19:03:07 +00:00
|
|
|
#include <Storages/System/StorageSystemDisks.h>
|
|
|
|
#include <Storages/System/StorageSystemStoragePolicies.h>
|
2020-03-10 13:01:29 +00:00
|
|
|
#include <Storages/System/StorageSystemZeros.h>
|
2017-03-14 18:39:06 +00:00
|
|
|
|
2020-05-12 20:31:30 +00:00
|
|
|
#include <Storages/System/StorageSystemSettingsProfiles.h>
|
|
|
|
#include <Storages/System/StorageSystemSettingsProfileElements.h>
|
|
|
|
#include <Storages/System/StorageSystemRowPolicies.h>
|
|
|
|
#include <Storages/System/StorageSystemQuotas.h>
|
|
|
|
#include <Storages/System/StorageSystemQuotaLimits.h>
|
|
|
|
#include <Storages/System/StorageSystemQuotaUsage.h>
|
|
|
|
#include <Storages/System/StorageSystemQuotasUsage.h>
|
2020-05-12 21:46:14 +00:00
|
|
|
#include <Storages/System/StorageSystemPrivileges.h>
|
2020-05-12 20:31:30 +00:00
|
|
|
|
2019-12-23 18:56:57 +00:00
|
|
|
#ifdef OS_LINUX
|
2019-12-22 17:20:33 +00:00
|
|
|
#include <Storages/System/StorageSystemStackTrace.h>
|
2019-12-23 18:56:57 +00:00
|
|
|
#endif
|
2017-03-14 18:39:06 +00:00
|
|
|
|
2017-06-18 05:43:29 +00:00
|
|
|
|
2017-03-14 18:39:06 +00:00
|
|
|
namespace DB
|
|
|
|
{
|
2017-06-18 05:43:29 +00:00
|
|
|
|
2020-04-06 23:22:44 +00:00
|
|
|
///TODO allow store system tables in DatabaseAtomic
|
2017-06-18 05:43:29 +00:00
|
|
|
void attachSystemTablesLocal(IDatabase & system_database)
|
2017-03-14 18:39:06 +00:00
|
|
|
{
|
2017-06-18 05:43:29 +00:00
|
|
|
system_database.attachTable("one", StorageSystemOne::create("one"));
|
2020-03-10 19:36:17 +00:00
|
|
|
system_database.attachTable("numbers", StorageSystemNumbers::create(StorageID("system", "numbers"), false));
|
|
|
|
system_database.attachTable("numbers_mt", StorageSystemNumbers::create(StorageID("system", "numbers_mt"), true));
|
2020-03-12 12:09:41 +00:00
|
|
|
system_database.attachTable("zeros", StorageSystemZeros::create(StorageID("system", "zeros"), false));
|
|
|
|
system_database.attachTable("zeros_mt", StorageSystemZeros::create(StorageID("system", "zeros_mt"), true));
|
2017-06-18 05:43:29 +00:00
|
|
|
system_database.attachTable("databases", StorageSystemDatabases::create("databases"));
|
|
|
|
system_database.attachTable("tables", StorageSystemTables::create("tables"));
|
|
|
|
system_database.attachTable("columns", StorageSystemColumns::create("columns"));
|
|
|
|
system_database.attachTable("functions", StorageSystemFunctions::create("functions"));
|
|
|
|
system_database.attachTable("events", StorageSystemEvents::create("events"));
|
|
|
|
system_database.attachTable("settings", StorageSystemSettings::create("settings"));
|
2018-08-10 17:42:12 +00:00
|
|
|
system_database.attachTable("merge_tree_settings", SystemMergeTreeSettings::create("merge_tree_settings"));
|
2017-06-18 05:43:29 +00:00
|
|
|
system_database.attachTable("build_options", StorageSystemBuildOptions::create("build_options"));
|
2018-07-20 10:00:56 +00:00
|
|
|
system_database.attachTable("formats", StorageSystemFormats::create("formats"));
|
|
|
|
system_database.attachTable("table_functions", StorageSystemTableFunctions::create("table_functions"));
|
|
|
|
system_database.attachTable("aggregate_function_combinators", StorageSystemAggregateFunctionCombinators::create("aggregate_function_combinators"));
|
|
|
|
system_database.attachTable("data_type_families", StorageSystemDataTypeFamilies::create("data_type_families"));
|
2018-07-20 13:17:16 +00:00
|
|
|
system_database.attachTable("collations", StorageSystemCollations::create("collations"));
|
2018-07-25 16:08:23 +00:00
|
|
|
system_database.attachTable("table_engines", StorageSystemTableEngines::create("table_engines"));
|
2018-10-26 17:43:50 +00:00
|
|
|
system_database.attachTable("contributors", StorageSystemContributors::create("contributors"));
|
2020-05-12 20:31:30 +00:00
|
|
|
system_database.attachTable("settings_profiles", StorageSystemSettingsProfiles::create("settings_profiles"));
|
|
|
|
system_database.attachTable("settings_profile_elements", StorageSystemSettingsProfileElements::create("settings_profile_elements"));
|
|
|
|
system_database.attachTable("row_policies", StorageSystemRowPolicies::create("row_policies"));
|
|
|
|
system_database.attachTable("quotas", StorageSystemQuotas::create("quotas"));
|
|
|
|
system_database.attachTable("quota_limits", StorageSystemQuotaLimits::create("quota_limits"));
|
|
|
|
system_database.attachTable("quota_usage", StorageSystemQuotaUsage::create("quota_usage"));
|
|
|
|
system_database.attachTable("quotas_usage", StorageSystemQuotasUsage::create("all_quotas_usage"));
|
2020-05-12 21:46:14 +00:00
|
|
|
system_database.attachTable("privileges", StorageSystemPrivileges::create("privileges"));
|
2020-05-11 04:36:32 +00:00
|
|
|
#if !defined(ARCADIA_BUILD)
|
2020-05-11 02:39:01 +00:00
|
|
|
system_database.attachTable("licenses", StorageSystemLicenses::create("licenses"));
|
2020-05-11 04:36:32 +00:00
|
|
|
#endif
|
2019-12-23 18:56:57 +00:00
|
|
|
#ifdef OS_LINUX
|
2019-12-22 17:20:33 +00:00
|
|
|
system_database.attachTable("stack_trace", StorageSystemStackTrace::create("stack_trace"));
|
2019-12-23 18:56:57 +00:00
|
|
|
#endif
|
2017-03-14 18:39:06 +00:00
|
|
|
}
|
|
|
|
|
2017-06-18 05:43:29 +00:00
|
|
|
void attachSystemTablesServer(IDatabase & system_database, bool has_zookeeper)
|
2017-03-14 18:39:06 +00:00
|
|
|
{
|
2017-04-01 07:20:54 +00:00
|
|
|
attachSystemTablesLocal(system_database);
|
2017-06-18 05:43:29 +00:00
|
|
|
system_database.attachTable("parts", StorageSystemParts::create("parts"));
|
2019-05-20 16:24:36 +00:00
|
|
|
system_database.attachTable("detached_parts", createDetachedPartsTable());
|
2017-12-04 15:44:31 +00:00
|
|
|
system_database.attachTable("parts_columns", StorageSystemPartsColumns::create("parts_columns"));
|
2019-05-24 19:03:07 +00:00
|
|
|
system_database.attachTable("disks", StorageSystemDisks::create("disks"));
|
|
|
|
system_database.attachTable("storage_policies", StorageSystemStoragePolicies::create("storage_policies"));
|
2017-06-18 05:43:29 +00:00
|
|
|
system_database.attachTable("processes", StorageSystemProcesses::create("processes"));
|
|
|
|
system_database.attachTable("metrics", StorageSystemMetrics::create("metrics"));
|
|
|
|
system_database.attachTable("merges", StorageSystemMerges::create("merges"));
|
2018-06-07 13:28:39 +00:00
|
|
|
system_database.attachTable("mutations", StorageSystemMutations::create("mutations"));
|
2017-06-18 05:43:29 +00:00
|
|
|
system_database.attachTable("replicas", StorageSystemReplicas::create("replicas"));
|
|
|
|
system_database.attachTable("replication_queue", StorageSystemReplicationQueue::create("replication_queue"));
|
|
|
|
system_database.attachTable("dictionaries", StorageSystemDictionaries::create("dictionaries"));
|
2017-12-04 12:15:21 +00:00
|
|
|
system_database.attachTable("models", StorageSystemModels::create("models"));
|
2017-06-18 05:43:29 +00:00
|
|
|
system_database.attachTable("clusters", StorageSystemClusters::create("clusters"));
|
|
|
|
system_database.attachTable("graphite_retentions", StorageSystemGraphite::create("graphite_retentions"));
|
2018-03-12 18:38:00 +00:00
|
|
|
system_database.attachTable("macros", StorageSystemMacros::create("macros"));
|
2017-03-14 18:39:06 +00:00
|
|
|
|
2017-04-01 07:20:54 +00:00
|
|
|
if (has_zookeeper)
|
2017-06-18 05:43:29 +00:00
|
|
|
system_database.attachTable("zookeeper", StorageSystemZooKeeper::create("zookeeper"));
|
2017-03-14 18:39:06 +00:00
|
|
|
}
|
|
|
|
|
2017-06-18 05:43:29 +00:00
|
|
|
void attachSystemTablesAsync(IDatabase & system_database, AsynchronousMetrics & async_metrics)
|
2017-03-14 18:39:06 +00:00
|
|
|
{
|
2017-06-18 05:43:29 +00:00
|
|
|
system_database.attachTable("asynchronous_metrics", StorageSystemAsynchronousMetrics::create("asynchronous_metrics", async_metrics));
|
2017-03-14 18:39:06 +00:00
|
|
|
}
|
2017-06-18 05:43:29 +00:00
|
|
|
|
2017-03-14 18:39:06 +00:00
|
|
|
}
|