


VIP免费下载
版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
1、ClickHouse和他的朋友们(2)MySQL Protocol和Read调用栈作汨个OLAP的DBMS来说有2个端非常重要:用尸钾1何方便的钓殡来,这是入口端-ClickHouse除了自己的client外,还提供了 MySQL/PG/GRPC/ 等接入方式数据如何方便的挂上去,这是数据源端 ClickHouse除了自己的引擎外,还可以挂载MySQL/Kafka等外部数据源这不油外互通,多条朋友多条路,以以改据”级的编排能力今天送的是入口端的MySQL十舜N也是本系列ClickHouse的第一个好朋友,用尸可通过 MySQL客万中或相关Driver直接钓接至U ClickHouse,进行数据
2、谆等操作.本文通过MySQL的QueryiW,借用渔杉g了解下ClickHouse的数据全过程如何实班L入口文件在:MySQLHandler.cpp握手协议MySQLCIientGreeting 数据中良到 MySQLHandlerMySQLHandler 回复一个 Greeting-Response 丰度MySQLCIient 合MySQLHandler又蒙疝琅进行茎霞,并返回皿结果MySQL Protocol Core/MySQLProtocol.hQuery iW当为西过后,就可以进行正常的数据交互了当 MySQLCIientmysql SELECT * FROM system.numb
3、ers LIMIT 5;MySQLHandler 的调木其-MySQLHAndler:comQuery - executeQuery - pipeline-execute - MySQLOutputFormAt:coMySQLCIient接收至I结果在步马executeQuery(executeQuery.cpp)非常重要它是所有前端Server和 ClickHouse内核的接入口,第一个参数是SQL文本(selectl),第二个参数是结果集要芨 到哪里去(socket net)调用栈分析SELECT * FROM system.numbers LIMIT 5I.获取数据源StorageSys
4、temNumbers 数据源:DB:StorAgeSystemNumbers:reAd(std:_1:vectorstd:_1:bAsic_stringchArz std:_1:DB:ReAdFromStorAgeStep:ReAdFromStorAgeStep(std:1:shAred_ptrDB:RWLocklmpl:Lock DB:InterpreterSelectQuery:executeFetchColumns(DB:QueryProcessingStAge:Enum, DB:Qu DB:InterpreterSelectQuery:executeFetchColumns(DB:Qu
5、eryProcessingStAge:Enumz DB : : Qu DB:InterpreterSelectQuery:executelmpl(DB:QueryPlAn&, std:_1:shAred_ptrreAd(required_columns, metAdAtA_snApshot, query_info, *context,Pipeline构造unsigned long, unsigned long, unsDB:LimitTrAnsform:LimitTrAnsform(DB:Block const&zDB:Limitstep:trAnsformPipeline(DB:QueryP
6、ipelines) memory:2214DB:Limitstep:trAnsformPipeline(DB:QueryPipelines) memory:2299DB:Limitstep:trAnsformPipeline(DB:QueryPipeline&) memory:3570DB:LimitStep:trAnsformPipeline(DB:QueryPipelines) memory:4400Limitstep.cpp:33DB:Limitstep:trAnsformPipeline(DB:QueryPipe1ine&)DB:ITrAnsformingStep:updatePipe
7、line(std:1:vectorstd:1:unique_ptrDB:QueryPDB:QueryPlAn:buildQueryPipeline() QueryPlAn.cpp:154DB:InterpreterSelectWithUnionQuery:execute() InterpreterSelectWithUnionQuery.cpp:200 DB:executeQueryImpl(const chAr *, const chAr *, DB:Context &, bool, DB:QueryProcessDB:executeQuery(DB:ReAdBuffer&, DB:Writ
8、eBuffer&z bool, DB:Context&, std:1:funcDB:MySQLHAndler:comQuery(DB:ReAdBuffer&) MySQLHAndler.cpp:307DB:MySQLHAndler:run() MySQLHAndler.cpp:141Pipeline主施DB:LimitTrAnsform:prepAre(std:1:vectorunsigned long, std:1:AllocAtorunsignDB:PipelineExecutor:prepAreProcessor(unsigned long, unsigned long, std:1:q
9、ueueD DB:PipelineExecutor:tryAddProcessorToStAcklfUpdAted(DB:PipelineExecutor:Edges, std DB:PipelineExecutor:prepAreProcessor(unsigned long, unsigned long, std:1:queueD DB:PipelineExecutor:tryAddProcessorToStAckIfUpdated(DB:PipelineExecutor:Edges, std DB:PipelineExecutor:prepAreProcessor(unsigned lo
10、ng, unsigned long, std:1:queueDDB:PipelineExecutor:tryAddProcessorToStAckIfUpdAted(DB:PipelineExecutor:Edges, std DB:PipelineExecutor:prepAreProcessor(unsigned long, unsigned long, std:1:queueD DB:PipelineExecutor:tryAddProcessorToStAckIfUpdAted(DB:PipelineExecutor:Edges, std DB:PipelineExecutor:pre
11、pAreProcessor(unsigned long, unsigned long, std:1:queueDDB:PipelineExecutor:tryAddProcessorToStAckIfUpdAted(DB:PipelineExecutor:Edge&, std DB:PipelineExecutor:prepAreProcessor(unsigned long, unsigned long, std:1:queueDDB:PipelineExecutor:initiAlizeExecution(unsigned long) PipelineExecutor.cpp:747 DB
12、:PipelineExecutor:executelmpl(unsigned long) PipelineExecutor.cpp:764DB:PipelineExecutor:execute(unsigned long) PipelineExecutor.cpp:479DB:executeQuery(DB:ReAdBuffer&, DB:WriteBuffer&z bool, DB:Contexts, std:1:funcDB:MySQLHAndler:comQuery(DB:ReAdBuf fer&) MySQLHAndler.cpp:3 07DB:MySQLHAndler:run() M
13、ySQLHAndler.cpp:141Output打比发送DB : :MySQLOutputForinAt: : consume (DB : :Chunk) MySQLOutputFormAt. cpp : 53DB:lOutputFormAt:work() lOutputFormAt.cpp:62DB:executeJob(DB:IProcessor *) PipelineExecutor.cpp:155operAtor() PipelineExecutor.cpp:172DB:PipelineExecutor:executeStepImpl(unsigned long, unsigned
14、long, std:1:AtomicbDB:PipelineExecutor:executeSingleThreAd(unsigned long, unsigned long) PipelineExecutDB:PipelineExecutor:executelmpl(unsigned long) PipelineExecutor.cpp:812DB:PipelineExecutor: :execute(unsigned long) PipelineExecutor.cpp:4 7 9DB:executeQuery(DB:ReAdBuffer&, DB:WriteBuffer&z bool,
15、DB:Context&, std:1:funcDB:MySQLHAndler:comQuery(DB:ReAdBuf fer&) MySQLHAndler.cpp:311DB: :MySQLHAndler: :run () MySQLHAndler.cpp:141总结ClickHouse的模块化比拟清晰,像弟积木一木革以组合拼装,当我。拌t:SELECT * FROM system.numbers LIMIT 5首先内核解析SQL用生成AST,然后根据AST获取数据源Source, pipeline.Add(Source)其次根据AST信息生成QueryPlan,根据QueryPlan再生成相应 的Transform, pipeline.Add(LimitTransform)然后添加 Ou卬ut Sink 作7数据名又续, pi pel ine.Add (OutputSink) pipeline,各个 Transformer 开女台工作ClickHouse的Transformer y用系统叫做Processor,也是决定性能的重要模块,诅# 口 Pipeline处
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 2025年河北省定州市辅警招聘考试试题题库含答案详解(a卷)
- 2025年K2学校STEM课程实施与科学教育改革研究报告
- 初中美术九年级上册统编教案
- 偏头痛诊治攻略2025
- 世界人口日人口发展现状老龄化探讨提升出生人口素质课件
- 初中数学九年级下册统编教案 7.6用锐角三角函数解决问题(第1课时)
- 2025届高考物理大一轮复习课件 第六章 第31课时 专题强化:动力学和能量观点的综合应用
- DeepSeek大模型教育领域解决方案
- 江苏省苏州市2024-2025学年七年级下学期生物期末模拟试卷 (含解析)
- 相似三角形测试题及答案
- 服务质量评价体系构建
- ISO 15609-1 2019 金属材料焊接工艺规程和评定-焊接工艺规程-电弧焊(中文版)
- 医疗器械销售授权证书审批指南
- 陪诊公司推广方案
- 麻醉过程中的意外与并发症处理规范与流程样本
- 猫传染性腹膜炎课件
- 老年人中医养生知识健康讲座内容
- 动物的营养需求与摄取
- 绿色环保 低碳生活主题班会
- 隐孢子虫病健康宣教
- 车站调车作业-驼峰调车作业
评论
0/150
提交评论