What's the difference between Atomic and Ordinary database engine
問題: ClickHouse 數據庫引擎,默認的到底是 Atomic 還是 Ordinary?
I found this comment in source file: src/Databases/DatabaseAtomic.h
/// All tables in DatabaseAtomic have persistent UUID and store data in /// /clickhouse_path/store/xxx/xxxyyyyy-yyyy-yyyy-yyyy-yyyyyyyyyyyy/ /// where xxxyyyyy-yyyy-yyyy-yyyy-yyyyyyyyyyyy is UUID of the table. /// RENAMEs are performed without changing UUID and moving table data. /// Tables in Atomic databases can be accessed by UUID through DatabaseCatalog. /// On DROP TABLE no data is removed, DatabaseAtomic just marks table as dropped /// by moving metadata to /clickhouse_path/metadata_dropped/ and notifies DatabaseCatalog. /// Running queries still may use dropped table. Table will be actually removed when it's not in use. /// Allows to execute RENAME and DROP without IStorage-level RWLocks class DatabaseAtomic : public DatabaseOrdinary { public:DatabaseAtomic(String name_, String metadata_path_, UUID uuid, const String & logger_name, ContextPtr context_);DatabaseAtomic(String name_, String metadata_path_, UUID uuid, ContextPtr context_);String getEngineName() const override { return "Atomic"; }UUID getUUID() const override { return db_uuid; }ClickHouse 官網文檔說:
默認情況下,ClickHouse使用Atomic數據庫引擎。
源代碼中說:
/** Default engine of databases.* It stores tables list in filesystem using list of .sql files,* that contain declaration of table represented by SQL ATTACH TABLE query.*/ class DatabaseOrdinary : public DatabaseOnDisk { public:DatabaseOrdinary(const String & name_, const String & metadata_path_, ContextPtr context);DatabaseOrdinary(const String & name_, const String & metadata_path_, const String & data_path_,const String & logger, ContextPtr context_);String getEngineName() const override { return "Ordinary"; }Answer
Atomic Database Engine
In version 20.5 ClickHouse first introduced database engine=Atomic.
Since version 20.10 it is a default database engine (before engine=Ordinary was used).
Those 2 database engine differs in a way how they store data on a filesystem, and engine Atomic allows to resolve some of the issues existed in engine=Ordinary.
engine=Atomic supports
non-blocking drop table / rename table
tables delete (&detach) async (wait for selects finish but invisible for new selects)
atomic drop table (all files / folders removed)
atomic table swap (table swap by “EXCHANGE TABLES t1 AND t2;”)
rename dictionary / rename database
unique automatic UUID paths in FS and ZK for Replicated
https://kb.altinity.com/engines/altinity-kb-atomic-database-engine/
總結
以上是生活随笔為你收集整理的What's the difference between Atomic and Ordinary database engine的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: NodeJS 爬取lol英雄数据信息
- 下一篇: OpenVINO使用OpenCL内存执行