diff --git a/hetu-docs/en/admin/properties.md b/hetu-docs/en/admin/properties.md index 8e93a1698..966260256 100644 --- a/hetu-docs/en/admin/properties.md +++ b/hetu-docs/en/admin/properties.md @@ -390,6 +390,7 @@ Exchanges transfer data between openLooKeng nodes for different stages of a quer > - **Default value:** `10` > > The maximum number of retry for failed task performed by the coordinator before considering it as a permanent failure. This property is used only when exchange.is-timeout-failure-detection-enabled is set to false. + ### `sink.max-buffer-size` > - **Type:** `data size` @@ -781,7 +782,7 @@ helps with cache affinity scheduling. > Auto-Vacuum enables the system to automatically manage vacuum jobs by constantly monitoring the tables which needs vacuum in order to maintain optimal performance. > Engine gets the tables from data sources that are eligible for vacuum and trigger vacuum operation for those tables. -### `auto-vacuum.enabled:` +### `auto-vacuum.enabled` > - **Type:** `boolean` > - **Default value:** `false` diff --git a/hetu-docs/en/admin/web-interface.md b/hetu-docs/en/admin/web-interface.md index 9dd26bcdc..4d6e383bd 100644 --- a/hetu-docs/en/admin/web-interface.md +++ b/hetu-docs/en/admin/web-interface.md @@ -33,32 +33,32 @@ and statistics about the query is available by clicking the *JSON* link. These v > - **Allowed values:** `true`, `false` > - **Default value:** `false` > -> Insecure authentication over HTTP is disabled by default. This could be overridden via "hetu.queryeditor-ui.allow-insecure-over-http" property of "etc/config.properties" (e.g. hetu.queryeditor-ui.allow-insecure-over-http=true). +> Insecure authentication over HTTP is disabled by default. This could be overridden via `hetu.queryeditor-ui.allow-insecure-over-http` property of `etc/config.properties` (e.g. hetu.queryeditor-ui.allow-insecure-over-http=true). ### `hetu.queryeditor-ui.execution-timeout` > - **Type:** `duration` -> - **Default value:** `100 DAYS`> +> - **Default value:** `100 DAYS` > -> UI Execution timeout is set to 100 days as default. This could be overridden via "hetu.queryeditor-ui.execution-timeout" of "etc/config.properties" +> UI Execution timeout is set to 100 days as default. This could be overridden via `hetu.queryeditor-ui.execution-timeout` of `etc/config.properties` ### `hetu.queryeditor-ui.max-result-count` > - **Type:** `int` > - **Default value:** `1000` > -> UI max result count is set to 1000 as default. This could be overridden via "hetu.queryeditor-ui.max-result-count" of "etc/config.properties" +> UI max result count is set to 1000 as default. This could be overridden via `hetu.queryeditor-ui.max-result-count` of `etc/config.properties` ### `hetu.queryeditor-ui.max-result-size-mb` >- **Type:** `size` >- **Default value:** `1GB` > -> UI max result size is set to 1 GB as default. This could be overridden via "hetu.queryeditor-ui.max-result-size-mb" of "etc/config.properties" +> UI max result size is set to 1 GB as default. This could be overridden via `hetu.queryeditor-ui.max-result-size-mb` of `etc/config.properties` ### `hetu.queryeditor-ui.session-timeout` > - **Type:** `duration` > - **Default value:** `1 DAYS` > -> UI session timeout is set to 1 day as default. This could be overridden via "hetu.queryeditor-ui.session-timeout" of "etc/config.properties" \ No newline at end of file +> UI session timeout is set to 1 day as default. This could be overridden via `hetu.queryeditor-ui.session-timeout` of `etc/config.properties` \ No newline at end of file diff --git a/hetu-docs/en/preagg/overview.md b/hetu-docs/en/preagg/overview.md index b9ff354f2..741baf1b3 100644 --- a/hetu-docs/en/preagg/overview.md +++ b/hetu-docs/en/preagg/overview.md @@ -121,7 +121,7 @@ Since the data inserted into the Cube was for `nationkey >= 5`, only queries mat Queries not matching the condition would continue to work but won't use the Cube. If the source table of a Cube gets updated, the corresponding Cube gets expired automatically. In order to overcome -this issue, we have added support in OpenLooKeng CLI by introducing **RELOAD CUBE** command. The user will have the +this issue, we have added support in openLooKeng CLI by introducing **RELOAD CUBE** command. The user will have the ability to manually reload a cube if the status of the Cube becomes INACTIVE or EXPIRED. The syntax to reload the Cube nation_cube is as follows, diff --git a/hetu-docs/zh/admin/properties.md b/hetu-docs/zh/admin/properties.md index ea510bc41..9faf7c35f 100644 --- a/hetu-docs/zh/admin/properties.md +++ b/hetu-docs/zh/admin/properties.md @@ -148,6 +148,24 @@ > > 此配置属性可由`spill_window_operator`会话属性重写。 +### `experimental.spill-build-for-outer-join-enabled` + +> - **类型:** `boolean` +> - **默认值:** `false` +> +> 为右外连接和全外连接操作启用溢出功能。 +> +> 此config属性可被`spill_build_for_outer_join_enabled`会话属性覆盖。 + +### `experimental.inner-join-spill-filter-enabled` + +> - **类型:** `boolean` +> - **默认值:** `false` +> +> 启用基于布隆过滤器的构建侧溢出匹配,以进行探查侧溢出决策。 +> +> 此config属性可被`inner_join_spill_filter_enabled`会话属性覆盖。 + ### `experimental.spill-reuse-tablescan` > - **类型**:`boolean` @@ -163,7 +181,7 @@ > - **无默认值。** 启用溢出时必须设置。 > > 溢出内容写入的目录。该属性可以是一个逗号分隔的列表,以同时溢出到多个目录,这有助于利用系统中安装的多个驱动器。 -> +> 当`experimental.spiller-spill-to-hdfs`为`true`时,`experimental.spiller-spill-path`必须只包含一个目录。 > 不建议溢出到系统驱动器上。最重要的是,不要溢出到写入JVM日志的驱动器,因为磁盘过度使用可能导致JVM长时间暂停,从而导致查询失败。 ### `experimental.spiller-max-used-space-threshold` @@ -208,7 +226,7 @@ > > 用于在Reuse Exchange中缓存页面的内存限制。 -### experimental.spill-compression-enabled` +### `experimental.spill-compression-enabled` > - **类型:** `boolean` > - **默认值:** `false` @@ -222,6 +240,69 @@ > > 允许使用随机生成的密钥(每个溢出文件)来加密和解密溢出到磁盘的数据。 +### `experimental.spill-direct-serde-enabled` + +> - **类型:** `boolean` +> - **默认值:** `false` +> +> 允许将页面直接序列化/读取到流中或从流中序列化/读取页面。 + +### `experimental.spill-prefetch-read-pages` + +> - **类型:** `integer` +> - **默认值:** `1` +> +> 设置从溢出文件读取时预取的页数。 + + +### `experimental.spill-use-kryo-serialization` + +> - **类型:** `boolean` +> - **默认值:** `false` +> +> 启用基于Kryo的序列化以溢出到磁盘,而不使用默认的Java序列化器。 + + +### `experimental.revocable-memory-selection-threshold` + +> - **类型:** `data size` +> - **默认值:** `512 MB` +> +> 设置运算符可撤销内存的内存选择阈值,直接为准备撤销的剩余字节分配可撤销内存。 + +### `experimental.prioritize-larger-spilts-memory-revoke` + +> - **类型:** `boolean` +> - **默认值:** `true` +> +> 启用对具有较大可撤销内存的Split进行优先级排序。 + +### `experimental.spill-non-blocking-orderby` + +> - **类型:** `boolean` +> - **默认值:** `false` +> +> 开启按照运算符排序,使用异步机制溢出。即使在溢出正在进行时,也可以累积输入,并在次要数据累积超过阈值或主溢出完成时启动次溢出。阈值的默认值是20MB到可用内存的5%之间的最小值。此属性必须与`experimental.spill-enabled`属性结合使用。 +> +> 此config属性可被`spill_non_blocking_orderby`会话属性覆盖。 + +### `experimental.spiller-spill-to-hdfs` + +> - **类型:** `boolean` +> - **默认值:** `false` +> +> 启用溢出到HDFS。当此属性设置为`true`时,必须设置`experimental.spiller-spill-profile`属性,并且`experimental.spiller-spill-path`必须仅包含单个路径。 + +### `experimental.spiller-spill-profile` + +> - **类型:** `string` +> - **无默认值。** 启用溢出到HDFS时必须设置此属性。 +> +> +> 此属性定义用于溢出的[filesystem](../develop/filesystem.md)配置文件。对应的配置文件必须存在于`etc/filesystem`中。例如,如果此属性设置为`experimental.spiller-spill-profile=spill-hdfs`,则必须在`etc/filesystem`中创建描述此文件系统的配置文件`spill-hdfs.properties`,其中包含必要的信息,包括身份验证类型、config和keytab(如果适用,详情请参见[filesystem](../develop/filesystem.md))。 +> +> 当`experimental.spiller-spill-to-hdfs`设置为`true`时,必须配置此属性。所有Coordinator和Worker的配置文件中必须包含此属性。指定的文件系统必须可由所有Worker访问,并且Worker必须能够读取和写入指定文件系统中`experimental.spiller-spill-path`文件夹中指明的路径。 + ## 交换属性 在openLooKeng节点之间为查询的不同阶段交换数据。调整这些属性可有助于解决节点间通信问题或提高网络利用率。 @@ -267,6 +348,20 @@ > > 交换错误最大缓冲时间,超过该时限则查询失败。 +### `exchange.is-timeout-failure-detection-enabled` + +> - **类型:** `boolean` +> - **默认值:** `true` +> +> 正在使用的故障检测机制。默认值是基于超时的故障检测。但是,当该属性设置为`false`时,启用基于最大重试次数的故障检测机制。 + +### `exchange.max-retry-count` + +> - **类型:** `integer` +> - **默认值:** `10` +> +> Coordinator在将失败任务视为永久失败之前对其执行的最大重试次数。仅当`exchange.is-timeout-failure-detection-enabled`设置为`false`时,才使用此属性。 + ### `sink.max-buffer-size` > - **类型:** `data size` @@ -634,7 +729,7 @@ > 自动清空使系统能够通过持续监测需要清空的表来自动管理清空作业,以保持最佳性能。引擎从符合清空条件的数据源获取表,并触发对这些表的清空操作。 -### `auto-vacuum.enabled:` +### `auto-vacuum.enabled` > - **类型:** `boolean` > - **默认值:** `false` @@ -737,6 +832,13 @@ > > 也可以使用`snapshot_retry_timeout`会话属性在每个查询基础上指定。 +### `hetu.snapshot.useKryoSerialization` + +> - **类型:** `boolean` +> - **默认值:** `false` +> +> 为快照启用基于Kryo的序列化,而不是默认的Java序列化。 + ## HTTP客户端属性配置 ### `http.client.idle-timeout` diff --git a/hetu-docs/zh/admin/reliable-execution.md b/hetu-docs/zh/admin/reliable-execution.md index 88d594d77..8821110f1 100644 --- a/hetu-docs/zh/admin/reliable-execution.md +++ b/hetu-docs/zh/admin/reliable-execution.md @@ -55,6 +55,16 @@ 建议仅在必要时启用分布式快照,如运行时间较长的查询任务。对于这些类型的工作负载,捕获快照的开销可以忽略不计。 +## 快照统计信息 + +在调试模式下启动CLI时,快照捕获信息和恢复信息将与查询结果一起显示在CLI中。 + +快照捕获信息包括查询期间捕获的快照大小、捕获快照的CPU时间和捕获快照的挂钟时间。分别显示所有快照和最后一个快照的捕获信息。 + +快照恢复信息包括查询期间从快照恢复的次数、加载用于恢复的快照大小、从快照恢复所需的CPU时间和从快照恢复所需的挂钟时间。仅当查询期间发生恢复时,才会显示恢复信息。 + +![](../images/snapshot_statistics.png) + ## 配置 与分布式快照功能相关的配置可参见[属性参考](properties.md#分布式快照)。 \ No newline at end of file diff --git a/hetu-docs/zh/admin/spill.md b/hetu-docs/zh/admin/spill.md index bf7b8d368..284484097 100644 --- a/hetu-docs/zh/admin/spill.md +++ b/hetu-docs/zh/admin/spill.md @@ -31,6 +31,10 @@ openLooKeng将溢出路径视为独立的磁盘(参见[JBOD](https://en.wikipedia.org/wiki/Non-RAID_drive_architectures#JBOD )),因此无需使用RAID进行溢出。 +## 溢出到HDFS + +操作可以直接溢出到HDFS。将`experimental.spiller-spill-to-hdfs`设置为`true`,配置`experimental.spiller-spill-profile`,并且`spiller-spill-path`必须仅包含一个目录。(更多详情请参见`experimental.spiller-spill-to-hdfs`和`experimental.spiller-spill-profile`属性) + ## 溢出压缩 当启用溢出压缩(`tuning-spilling`中的`spill-compression-enabled`属性)时,溢出页将被压缩后再写入磁盘。启用此特性可以减少磁盘I/O,但会牺牲额外的CPU负载来压缩和解压缩溢出页。 @@ -60,6 +64,7 @@ openLooKeng将溢出路径视为独立的磁盘(参见[JBOD](https://en.wikipe ### 排序 如果尝试对大量数据进行排序,可能需要大量内存。当启用为排序溢出到磁盘时,如果内存不足,则中间排序结果将写入磁盘。结果被重新加载回来,并以较低的内存占用量合并。 +通常,当溢出正在进行时,运算符将被阻止接受输入,但当`experimental.spill-non-blocking-orderby`设置为`true`时,使用异步机制溢出(请参见`experimental.spill-non-blocking-orderby`)。 ### 开窗函数 diff --git a/hetu-docs/zh/admin/web-interface.md b/hetu-docs/zh/admin/web-interface.md index d82a9ae6a..c2eed936a 100644 --- a/hetu-docs/zh/admin/web-interface.md +++ b/hetu-docs/zh/admin/web-interface.md @@ -31,3 +31,31 @@ openLooKeng提供了一个用于监视和管理查询的Web界面。Web界面可 > - **默认值:** `false` > > 默认情况下,基于HTTP的非安全环境禁用WEB UI。可以通过配置`etc/config.properties`文件的`hetu.queryeditor-ui.allow-insecure-over-http`属性启用(例子: hetu.queryeditor-ui.allow-insecure-over-http=true)。 + +### `hetu.queryeditor-ui.execution-timeout` + +> - **类型:** `duration` +> - **默认值:** `100 DAYS` +> +> UI执行超时默认设置为100天。可以通过配置`etc/config.properties`文件中的`hetu.queryeditor-ui.execution-timeout`属性修改。 + +### `hetu.queryeditor-ui.max-result-count` + +> - **类型:** `int` +> - **默认值:** `1000` +> +> UI最大结果计数默认设置为1000。可以通过配置`etc/config.properties`文件中的`hetu.queryeditor-ui.max-result-count`属性修改。 + +### `hetu.queryeditor-ui.max-result-size-mb` + +>- **类型:** `size` +>- **默认值:** `1GB` +> +>UI最大结果大小默认设置为1 GB。可以通过配置`etc/config.properties`文件中的`hetu.queryeditor-ui.max-result-size-mb`属性修改。 + +### `hetu.queryeditor-ui.session-timeout` + +> - **类型:** `duration` +> - **默认值:** `1 DAYS` +> +> UI会话超时默认设置为1天。可以通过配置`etc/config.properties`文件中的`hetu.queryeditor-ui.session-timeout`属性修改。 \ No newline at end of file diff --git a/hetu-docs/zh/images/snapshot_statistics.png b/hetu-docs/zh/images/snapshot_statistics.png new file mode 100644 index 000000000..f41da3e3e Binary files /dev/null and b/hetu-docs/zh/images/snapshot_statistics.png differ diff --git a/hetu-docs/zh/preagg/overview.md b/hetu-docs/zh/preagg/overview.md index 5942d912b..4a7700c61 100644 --- a/hetu-docs/zh/preagg/overview.md +++ b/hetu-docs/zh/preagg/overview.md @@ -61,8 +61,6 @@ AggregationNode 2.1. 克服为更大的数据集创建Cube的限制。 - 2.2. 如果源表已更新,则更新Cube。 - ## 启用和禁用StarTree Cube 启用: ```sql @@ -121,6 +119,14 @@ SELECT nationkey, avg(nationkey), max(regionkey) FROM nation WHERE nationkey >= 由于插入Cube的数据是为`nationkey >= 5`,只有匹配此条件的查询才会使用Cube。 不符合条件的查询将继续工作,但不会使用Cube。 +如果Cube的源表更新,则对应的Cube自动过期。为了克服这个问题,我们通过引入**RELOAD CUBE**命令在openLooKeng CLI中添加了支持。如果Cube的状态变为“未激活”或“过期”,用户将能够手动重新加载Cube。重新加载Cube`nation_cube`的语法如下: + +```sql +RELOAD CUBE nation_cube +``` + +请注意,此功能仅在CLI支持。在重新加载过程中,如果发生意外错误,用户可以查看原始SQL语句,手动重新创建Cube。 + ## 为大型数据集构建Cube 当前实现的限制之一是不能一次为更大的数据集构建Cube。这是由于集群内存限制。 处理大量行需要比集群配置更多的内存。这会导致查询失败并显示消息**Query exceeded per-node user memory limit**,也就是警告查询超出每节点用户内存限制。为了克服这个问题,**INSERT INTO CUBE** SQL支持被添加了。 @@ -178,38 +184,56 @@ SHOW CUBES; ``` **注意:** -1. 系统将尝试将所有类型的Predicates重写为Range以查看它们是否可以合并在一起。 + +① 系统将尝试将所有类型的Predicates重写为Range以查看它们是否可以合并在一起。 所有连续谓词将合并为单个范围谓词,其余谓词保持不变。 仅支持以下类型并且可以合并在一起。 - `Integer, TinyInt, SmallInt, BigInt, Date` + `Integer, TinyInt, SmallInt, BigInt, Date, String` - 对于其他数据类型,很难确定两个谓词是否连续,因此它们不能合并在一起。 - 由于这个问题,即使Cube具有所有必需的数据,在查询优化期间也可能不会使用特定Cube。例如, + 对于字符串数据类型,谓词合并逻辑仅在字符串以数字结尾,并且所有字符串的长度相同时才能生效。例如, ```sql INSERT INTO CUBE store_sales_cube WHERE store_id BETWEEN 'A01' AND 'A10'; INSERT INTO CUBE store_sales_cube WHERE store_id BETWEEN 'A11' AND 'A20'; ``` - 这里这两个谓词不能合并到store_id BETWEEN 'A01' AND 'A20'; - 因此,Cube不会用于跨越两个谓词的查询; - -```sql - SELECT ss_store_id, sum(ss_sales_price) WHERE ss_store_id BETWEEN 'A05' AND 'A15'; - Cube won't be used for optimizing this query. This is a limitation as of now. -``` - 由于谓词重写,无法支持以下某些查询 - -```sql - INSERT INTO CUBE store_sales_cube WHERE ss_sold_date_sk > 2451911; -``` + 插入后,两个谓词将被合并至`'A01' AND 'A20'`。 + + ```sql + SELECT ss_store_id, sum(ss_sales_price) WHERE ss_store_id BETWEEN 'A05' AND 'A15'; - Cube 能被这个查询语句所使用 + ``` + + 以下示例中,`store_id`值的长度不相同。 + + ``` + INSERT INTO CUBE store_sales_cube WHERE store_id = 'A1'; + INSERT INTO CUBE store_sales_cube WHERE store_id = 'A2' + ``` + + 根据varchar谓词合并逻辑,store_id谓词将被重写为`store_id >= 'A1' and store < 'A3'`; + + ``` + INSERT INTO CUBE store_sales_cube WHERE store_id = 'A10' + ``` + + 上述查询将失败,因为`A10`是范围`store_id >= 'A1' and store < 'A3'`的子集。请用户注意这个问题。 + + 对于其他数据类型,很难识别两个谓词是否连续,因此它们无法被合并。因此,即使某些Cube具有所有所需的数据,也可能不会被用来优化查询。 + +② 谓词重写也有一些限制。如以下查询: + + ```sql + INSERT INTO CUBE store_sales_cube WHERE ss_sold_date_sk > 2451911; + ``` + 谓词重写为ss_sold_date_sk >= 2451912为合并连续谓词做准备。 - 由于谓词被重写,他们使用ss_sold_date_sk > 2451911谓词查询将与Cube谓词不匹配,因此不会使用Cube来优化查询。 - 这同样适用于带有<=运算符的谓词,例如,ss_sold_date_sk <= 2451911改写为ss_sold_date_sk < 2451912。 - -```sql - SELECT ss_sold_date_sk, .... FROM hive.tpcds_sf1.store_sales WHERE ss_sold_date_sk > 2451911 -``` -3. 只能合并单列谓词。 + 由于谓词已重写,使用ss_sold_date_sk > 2451911谓词进行查询将无法匹配到Cube谓词,因此不会使用Cube优化查询。同样的情况也适用于具有<=运算符的谓词。例如 ss_sold_date_sk <= 2451911重写为ss_sold_date_sk < 2451912。 + + ```sql + SELECT ss_sold_date_sk, .... FROM hive.tpcds_sf1.store_sales WHERE ss_sold_date_sk > 2451911 + ``` + +③ 只能合并单列谓词。 ## 未解决的问题和限制 1. StarTree Cube仅在按基数分组的数量远小于源表中的行数时有效。 @@ -218,10 +242,11 @@ SHOW CUBES; 4. 即使源表尚未更新,在事务表上创建的Cubes也可能会自动过期。 这是由于压缩策略将delta文件合并为单个大型ORC文件,这反过来又更改了表的最后修改时间。 Cube状态是通过比较创建Cube时表的最后修改时间戳与执行查询时表的最后修改时间来确定的。 -5. OpenLooKeng CLI已经过修改,以简化为更大的数据集创建Cubes的过程。 +5. openLooKeng CLI已经过修改,以简化为更大的数据集创建Cubes的过程。 但是这种实现仍然存在局限性,因为该过程涉及将多个Cube谓词合并为一个。 只有定义在Integer、Long和Date类型上的Cube谓词才能正确合并。 对Char、String类型的支持仍需实现。 - +6. 当Varchar类型的谓词的数值长度是一样时可合并。 + ## Star Tree上的性能优化 1. 对同一个group by列的星型查询重写优化:如果查询语句与Cube组匹配,则会改写查询计划将聚合运算结果重定向到Cube结果,否则将添加其他聚合结果内部应用于重写语句。 2. 平均聚合函数的star tree表扫描优化:如果查询语句与group by列的Cube匹配,则会改写查询计划将聚合运算结果重定向到Cube的预聚合列的平均值结果,否则语句将在内部重写,以选择star tree预聚合Sum和Count结果,随后计算平均值。 \ No newline at end of file diff --git a/hetu-docs/zh/preagg/statements.md b/hetu-docs/zh/preagg/statements.md index 6a3f5c746..3813abbdd 100644 --- a/hetu-docs/zh/preagg/statements.md +++ b/hetu-docs/zh/preagg/statements.md @@ -150,6 +150,26 @@ SHOW CUBES [ FOR table_name ]; SHOW CUBES FOR orders; ``` +## RELOAD CUBE + +### 概要 + +``` sql +RELOAD CUBE cube_name +``` + +### 描述 + +源表更新后重新加载Cube。 + +### 示例 + +如果Cube`orders_cube`的源表`orders`被更新,且`orders_cube`的状态为“过期”,运行`RELOAD CUBE cube_name`命令重新加载Cube: + +```sql +RELOAD CUBE orders_cube +``` + ## DROP CUBE ### 概要 diff --git a/hetu-docs/zh/sql/show-create-cube.md b/hetu-docs/zh/sql/show-create-cube.md new file mode 100644 index 000000000..556a6c3db --- /dev/null +++ b/hetu-docs/zh/sql/show-create-cube.md @@ -0,0 +1,32 @@ + +SHOW CREATE CUBE +================= + +概要 +-------- + +``` sql +SHOW CREATE CUBE cube_name +``` + +描述 +----------- + +显示创建指定cube的SQL语句。 + +示例 +-------- + +在`orders`表上创建cube`orders_cube` + + CREATE CUBE orders_cube ON orders WITH (AGGREGATIONS = (avg(totalprice), sum(totalprice), count(*)), + GROUP = (custKEY, ORDERkey), format= 'orc') + +运行`SHOW CREATE CUBE`命令显示用于创建cube`orders_cube`的SQL语句: + + SHOW CREATE CUBE orders_cube; + +``` sql +CREATE CUBE orders_cube ON orders WITH (AGGREGATIONS = (avg(totalprice), sum(totalprice), count(*)), +GROUP = (custKEY, ORDERkey), format= 'orc') +```