2021-10-27 23:10:39 +00:00
|
|
|
#include "config_core.h"
|
2021-07-26 18:17:39 +00:00
|
|
|
|
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>
|
2020-08-14 13:51:32 +00:00
|
|
|
#include <Storages/System/attachSystemTablesImpl.h>
|
2017-03-14 18:39:06 +00:00
|
|
|
|
2021-11-10 13:13:27 +00:00
|
|
|
#include <Interpreters/Context.h>
|
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>
|
2021-06-24 23:05:45 +00:00
|
|
|
#include <Storages/System/StorageSystemDataSkippingIndices.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>
|
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>
|
2020-10-27 13:07:50 +00:00
|
|
|
#include <Storages/System/StorageSystemReplicatedFetches.h>
|
2017-04-01 09:19:00 +00:00
|
|
|
#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>
|
2020-11-24 14:24:48 +00:00
|
|
|
#include <Storages/System/StorageSystemPartMovesBetweenShards.h>
|
2017-04-01 09:19:00 +00:00
|
|
|
#include <Storages/System/StorageSystemParts.h>
|
2021-02-10 14:12:49 +00:00
|
|
|
#include <Storages/System/StorageSystemProjectionParts.h>
|
2017-12-04 15:44:31 +00:00
|
|
|
#include <Storages/System/StorageSystemPartsColumns.h>
|
2021-02-10 14:12:49 +00:00
|
|
|
#include <Storages/System/StorageSystemProjectionPartsColumns.h>
|
2017-04-01 09:19:00 +00:00
|
|
|
#include <Storages/System/StorageSystemProcesses.h>
|
|
|
|
#include <Storages/System/StorageSystemReplicas.h>
|
|
|
|
#include <Storages/System/StorageSystemReplicationQueue.h>
|
2020-06-02 23:47:32 +00:00
|
|
|
#include <Storages/System/StorageSystemDistributionQueue.h>
|
2017-04-01 09:19:00 +00:00
|
|
|
#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-10-30 05:55:40 +00:00
|
|
|
#include <Storages/System/StorageSystemErrors.h>
|
2021-07-09 09:27:51 +00:00
|
|
|
#include <Storages/System/StorageSystemWarnings.h>
|
2020-11-24 07:58:21 +00:00
|
|
|
#include <Storages/System/StorageSystemDDLWorkerQueue.h>
|
2021-10-27 23:10:39 +00:00
|
|
|
#include <Storages/System/StorageSystemLicenses.h>
|
|
|
|
#include <Storages/System/StorageSystemTimeZones.h>
|
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>
|
2020-05-12 23:36:39 +00:00
|
|
|
#include <Storages/System/StorageSystemUsers.h>
|
|
|
|
#include <Storages/System/StorageSystemRoles.h>
|
|
|
|
#include <Storages/System/StorageSystemGrants.h>
|
|
|
|
#include <Storages/System/StorageSystemRoleGrants.h>
|
|
|
|
#include <Storages/System/StorageSystemCurrentRoles.h>
|
|
|
|
#include <Storages/System/StorageSystemEnabledRoles.h>
|
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-08-12 14:22:37 +00:00
|
|
|
#include <Storages/System/StorageSystemUserDirectories.h>
|
2020-05-12 21:46:14 +00:00
|
|
|
#include <Storages/System/StorageSystemPrivileges.h>
|
2021-09-03 16:46:09 +00:00
|
|
|
#include <Storages/System/StorageSystemAsynchronousInserts.h>
|
2022-03-10 21:29:58 +00:00
|
|
|
#include <Storages/System/StorageSystemTransactions.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
|
|
|
|
2021-07-26 18:17:39 +00:00
|
|
|
#if USE_ROCKSDB
|
|
|
|
#include <Storages/RocksDB/StorageSystemRocksDB.h>
|
|
|
|
#endif
|
|
|
|
|
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
|
|
|
|
2021-11-10 13:13:27 +00:00
|
|
|
void attachSystemTablesLocal(ContextPtr context, IDatabase & system_database)
|
2017-03-14 18:39:06 +00:00
|
|
|
{
|
2021-11-10 13:13:27 +00:00
|
|
|
attach<StorageSystemOne>(context, system_database, "one");
|
|
|
|
attach<StorageSystemNumbers>(context, system_database, "numbers", false);
|
|
|
|
attach<StorageSystemNumbers>(context, system_database, "numbers_mt", true);
|
|
|
|
attach<StorageSystemZeros>(context, system_database, "zeros", false);
|
|
|
|
attach<StorageSystemZeros>(context, system_database, "zeros_mt", true);
|
|
|
|
attach<StorageSystemDatabases>(context, system_database, "databases");
|
|
|
|
attach<StorageSystemTables>(context, system_database, "tables");
|
|
|
|
attach<StorageSystemColumns>(context, system_database, "columns");
|
|
|
|
attach<StorageSystemFunctions>(context, system_database, "functions");
|
|
|
|
attach<StorageSystemEvents>(context, system_database, "events");
|
|
|
|
attach<StorageSystemSettings>(context, system_database, "settings");
|
|
|
|
attach<SystemMergeTreeSettings<false>>(context, system_database, "merge_tree_settings");
|
|
|
|
attach<SystemMergeTreeSettings<true>>(context, system_database, "replicated_merge_tree_settings");
|
|
|
|
attach<StorageSystemBuildOptions>(context, system_database, "build_options");
|
|
|
|
attach<StorageSystemFormats>(context, system_database, "formats");
|
|
|
|
attach<StorageSystemTableFunctions>(context, system_database, "table_functions");
|
|
|
|
attach<StorageSystemAggregateFunctionCombinators>(context, system_database, "aggregate_function_combinators");
|
|
|
|
attach<StorageSystemDataTypeFamilies>(context, system_database, "data_type_families");
|
|
|
|
attach<StorageSystemCollations>(context, system_database, "collations");
|
|
|
|
attach<StorageSystemTableEngines>(context, system_database, "table_engines");
|
|
|
|
attach<StorageSystemContributors>(context, system_database, "contributors");
|
|
|
|
attach<StorageSystemUsers>(context, system_database, "users");
|
|
|
|
attach<StorageSystemRoles>(context, system_database, "roles");
|
|
|
|
attach<StorageSystemGrants>(context, system_database, "grants");
|
|
|
|
attach<StorageSystemRoleGrants>(context, system_database, "role_grants");
|
|
|
|
attach<StorageSystemCurrentRoles>(context, system_database, "current_roles");
|
|
|
|
attach<StorageSystemEnabledRoles>(context, system_database, "enabled_roles");
|
|
|
|
attach<StorageSystemSettingsProfiles>(context, system_database, "settings_profiles");
|
|
|
|
attach<StorageSystemSettingsProfileElements>(context, system_database, "settings_profile_elements");
|
|
|
|
attach<StorageSystemRowPolicies>(context, system_database, "row_policies");
|
|
|
|
attach<StorageSystemQuotas>(context, system_database, "quotas");
|
|
|
|
attach<StorageSystemQuotaLimits>(context, system_database, "quota_limits");
|
|
|
|
attach<StorageSystemQuotaUsage>(context, system_database, "quota_usage");
|
|
|
|
attach<StorageSystemQuotasUsage>(context, system_database, "quotas_usage");
|
|
|
|
attach<StorageSystemUserDirectories>(context, system_database, "user_directories");
|
|
|
|
attach<StorageSystemPrivileges>(context, system_database, "privileges");
|
|
|
|
attach<StorageSystemErrors>(context, system_database, "errors");
|
|
|
|
attach<StorageSystemWarnings>(context, system_database, "warnings");
|
|
|
|
attach<StorageSystemDataSkippingIndices>(context, system_database, "data_skipping_indices");
|
|
|
|
attach<StorageSystemLicenses>(context, system_database, "licenses");
|
|
|
|
attach<StorageSystemTimeZones>(context, system_database, "time_zones");
|
2019-12-23 18:56:57 +00:00
|
|
|
#ifdef OS_LINUX
|
2021-11-10 13:13:27 +00:00
|
|
|
attach<StorageSystemStackTrace>(context, system_database, "stack_trace");
|
2019-12-23 18:56:57 +00:00
|
|
|
#endif
|
2021-07-26 18:17:39 +00:00
|
|
|
#if USE_ROCKSDB
|
2021-11-10 13:13:27 +00:00
|
|
|
attach<StorageSystemRocksDB>(context, system_database, "rocksdb");
|
2021-07-26 18:17:39 +00:00
|
|
|
#endif
|
2017-03-14 18:39:06 +00:00
|
|
|
}
|
|
|
|
|
2021-11-10 13:13:27 +00:00
|
|
|
void attachSystemTablesServer(ContextPtr context, IDatabase & system_database, bool has_zookeeper)
|
2017-03-14 18:39:06 +00:00
|
|
|
{
|
2021-11-10 13:13:27 +00:00
|
|
|
attachSystemTablesLocal(context, system_database);
|
2020-08-12 20:40:13 +00:00
|
|
|
|
2021-11-10 13:13:27 +00:00
|
|
|
attach<StorageSystemParts>(context, system_database, "parts");
|
|
|
|
attach<StorageSystemProjectionParts>(context, system_database, "projection_parts");
|
|
|
|
attach<StorageSystemDetachedParts>(context, system_database, "detached_parts");
|
|
|
|
attach<StorageSystemPartsColumns>(context, system_database, "parts_columns");
|
|
|
|
attach<StorageSystemProjectionPartsColumns>(context, system_database, "projection_parts_columns");
|
|
|
|
attach<StorageSystemDisks>(context, system_database, "disks");
|
|
|
|
attach<StorageSystemStoragePolicies>(context, system_database, "storage_policies");
|
|
|
|
attach<StorageSystemProcesses>(context, system_database, "processes");
|
|
|
|
attach<StorageSystemMetrics>(context, system_database, "metrics");
|
|
|
|
attach<StorageSystemMerges>(context, system_database, "merges");
|
|
|
|
attach<StorageSystemMutations>(context, system_database, "mutations");
|
|
|
|
attach<StorageSystemReplicas>(context, system_database, "replicas");
|
|
|
|
attach<StorageSystemReplicationQueue>(context, system_database, "replication_queue");
|
|
|
|
attach<StorageSystemDDLWorkerQueue>(context, system_database, "distributed_ddl_queue");
|
|
|
|
attach<StorageSystemDistributionQueue>(context, system_database, "distribution_queue");
|
|
|
|
attach<StorageSystemDictionaries>(context, system_database, "dictionaries");
|
|
|
|
attach<StorageSystemModels>(context, system_database, "models");
|
|
|
|
attach<StorageSystemClusters>(context, system_database, "clusters");
|
|
|
|
attach<StorageSystemGraphite>(context, system_database, "graphite_retentions");
|
|
|
|
attach<StorageSystemMacros>(context, system_database, "macros");
|
|
|
|
attach<StorageSystemReplicatedFetches>(context, system_database, "replicated_fetches");
|
|
|
|
attach<StorageSystemPartMovesBetweenShards>(context, system_database, "part_moves_between_shards");
|
|
|
|
attach<StorageSystemAsynchronousInserts>(context, system_database, "asynchronous_inserts");
|
2017-03-14 18:39:06 +00:00
|
|
|
|
2017-04-01 07:20:54 +00:00
|
|
|
if (has_zookeeper)
|
2021-11-10 13:13:27 +00:00
|
|
|
attach<StorageSystemZooKeeper>(context, system_database, "zookeeper");
|
2022-03-10 21:29:58 +00:00
|
|
|
|
|
|
|
if (context->getConfigRef().getInt("_enable_experimental_mvcc_prototype_test_helper_dev", 0) == 42)
|
|
|
|
attach<StorageSystemTransactions>(context, system_database, "transactions");
|
2017-03-14 18:39:06 +00:00
|
|
|
}
|
|
|
|
|
2021-11-10 13:13:27 +00:00
|
|
|
void attachSystemTablesAsync(ContextPtr context, IDatabase & system_database, AsynchronousMetrics & async_metrics)
|
2017-03-14 18:39:06 +00:00
|
|
|
{
|
2021-11-10 13:13:27 +00:00
|
|
|
attach<StorageSystemAsynchronousMetrics>(context, system_database, "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
|
|
|
}
|