0%

What good can using exceptions do for me? The basic answer is: Using exceptions for error handling makes your code simpler, cleaner, and less likely to miss errors. But what’s wrong with “good old errno and if-statements”? The basic answer is: Using those, your error handling and your normal code are closely intertwined. That way, your code gets messy and it becomes hard to ensure that you have dealt with all errors.

由于 C++ 异常机制复杂的特性,编写异常安全的代码不是件轻松的事情。异常增强了语言的表达能力,但也带来了不可避免的开销。本文简单分析了 C++ 异常机制的实现原理,并总结相关注意事项。

Read more »

Ref What is a materialized view?: A materialized view is a pre-computed data set derived from a query specification (the SELECT in the view definition) and stored for later use. Because the data is pre-computed, querying a materialized view is faster than executing a query against the base table of the view. This performance difference can be significant when a query is run frequently or is sufficiently complex. As a result, materialized views can speed up expensive aggregation, projection, and selection operations, especially those that run frequently and that run on large data sets.

本文记录一项基于 Flink / Hudi / Kafka / TiCDC 以及 TiDB 构建 Materialized View(物化视图,aka MV)的简易 demo。

Read more »

In database systems, Collation specifies how data is sorted and compared in a database. Collation provides the sorting rules, case, and accent sensitivity properties for the data in the database.

在数据库系统中,CHARACTER SET(aka 字符集) 为一组字符和编码的集合,COLLATION 则表示字符排序|比较规则、大小写敏感等属性。参考 Character Sets and Collations in MySQL,MySQL 支持多种字符集,每种字符集包含多种 collation(默认使用一种)。TiDB 体系中默认采用字符集 utf8mb4,collation utf8mb4_bin。对于 TiFlash 这样的 OLAP 引擎而言,字符集相关规则引入的额外抽象必然会对性能产生较大影响,本文主要阐述优化 collation 的过程并在 Benchmark TPCHClickBench 上验证效果。

Read more »

面向 C艹(aka C++ or CPP)的开发规范一直都比较松散,各个组织包括个体总能在不轻易间把项目堆成 xxxx xxxxxxxx。

随着工程规模增大,TiFlash 项目也逐渐开始暴露出这类问题:

  • 头文件凌乱
  • 模板滥用
  • 编译缓慢
  • 工程质量愈发难以控制

本文旨在提供量化指标和参考方法用以优化 C++ 工程项目的编译流程。希望动员社区的力量,一起来优化 TiFlash 的工程质量。

Read more »

PingCAP(aka 贵司)自研了套部署工具 TiUP 来取代早前使用的重型部署工具 Ansible。然而实际使用时,TiFlash 节点在打 patch 过程中出现过不符合预期的报错。后来发现,TiUP 打 patch 的操作并没有停进程,而是直接 tar 命令解压覆盖部署目录,原子性保障也是无从谈起。v6.0 版本前 TiFlash 部分模块包含动态加载 共享库(aka 动态库)的行为,这类行为会被搜索路径下的库文件影响。如果存在某个时刻引入的模块相互不兼容,则直接影响程序的行为。

因为是用 tar 命令解压覆盖,反而没有出现老生常谈的 cp 覆盖动态库引起 Segmentation fault 的问题。

正好借此整理下相关的几个问题:

  • cp / tar 命令是如何工作的?
  • cp 覆盖正在被使用的动态库为何会引发异常?
  • 使用动态库要避开哪些坑?
  • 动态库有哪些额外的开销?
Read more »

Release Notes 作为开源软件工程实践的重要一环,会很大程度上影响用户体验和交付流程。此篇文档是本人在历次发版任务中总结出来的模板规范,用以帮助产研提升 Release Notes 质量。该规范已由组内推广至 PingCAP 全公司。

Read more »

目前主流的数据库引擎可按照实现方式分为以下几种:B+ Tree、LSM、Delta Main。在类 LSM 的存储方案中,RocksDB 和 Kudu 之流通过 append 的方式写日志并定期重新组织,从而将写数据的压力平衡到读取的过程中。由于相邻的数据可能落在 Memtable 以及不同的 SST 中,在涉及到范围扫描时,需要对结构化/半结构化数据进行排序输出。因此,对于数据块排序过程的优化,也会对读性能产生重要影响。

文章将基于类LSM引擎,由浅入深地介绍几种相关方案,原文链接:知乎·尬聊数据库·浅析数据块排序

CSDN BLOG