dremio 24 版本一个隐藏的Vacuum功能

dremio 24 版本支持对于apache iceberg 的 Vacuum,只是这个功能官方文档没有说明,但是通过源码我们可以看处理

功能开启

需要通过配置支持项处理

 

 

使用

官方支持的命令还是比较全的,只是目前官方文档暂时还是没写
整体的能力(通过测试方法看到的)

 

 

 

 

 


参考使用

 

 

dremio 内部处理

主要是通过VacuumHandler(TableManagementDirectHandler 子类)
处理处理核心是实现了execute 方法,参加如下
可以看出是使用了catalog 的vacuumTable 方法

 
@Override
protected void execute(Catalog catalog,
                     SqlNode sqlNode,
                     NamespaceKey path,
                     DatasetConfig datasetConfig,
                     TableMutationOptions tableMutationOptions) throws Exception {
final SqlVacuum sqlVacuum = SqlNodeUtil.unwrap(sqlNode, SqlVacuum.class);
catalog.vacuumTable(path, datasetConfig, sqlVacuum.getVacuumOption(), tableMutationOptions);
}

catalog 实现的处理(属于存储插件的能力,当前主要是文件系统的)

@Override
public void vacuumTable(NamespaceKey tableSchemaPath,
                      DatasetConfig datasetConfig,
                      SchemaConfig schemaConfig,
                      VacuumOption vacuumOption,
                      TableMutationOptions tableMutationOptions) {
// 此处会使用IcebergNessieModel
IcebergModel icebergModel = getIcebergModel();
icebergModel.vacuumTable(
  icebergModel.getTableIdentifier(validateAndGetPath(tableSchemaPath, schemaConfig.getUserName()).toString()), vacuumOption);
}

命令处理

@Override
public void vacuumTable(IcebergTableIdentifier tableIdentifier, VacuumOption vacuumOption) {
IcebergCommand icebergCommand = getIcebergCommandWithMetricStat(tableIdentifier);
icebergCommand.expireSnapshots(
  vacuumOption.getOlderThanInMillis(),
  vacuumOption.getRetainLast());
}

实际命令处理参考IcebergBaseCommand

说明

通过测试发现目前实际上对于数据以及元数据暂时是不删除的(关于配置部分的官方对于iceberg 的表属性没有配置),而且官方对于数据表优化部分文档也说明了
此功能比较适合与新版本的表优化功能一起使用,可以更好的进行数据管理,可以实现比较强大的数据湖管理了,很不错的好功能

参考资料

sabot/kernel/src/main/java/com/dremio/exec/planner/sql/handlers/direct/VacuumHandler.java
sabot/kernel/src/main/java/com/dremio/exec/ExecConstants.java
sabot/kernel/src/main/java/com/dremio/exec/catalog/DatasetCatalog.java
sabot/kernel/src/main/java/com/dremio/exec/catalog/MutablePlugin.java
sabot/kernel/src/main/java/com/dremio/exec/store/dfs/FileSystemPlugin.java
sabot/kernel/src/main/java/com/dremio/exec/store/iceberg/IcebergModelCreator.java
sabot/kernel/src/main/java/com/dremio/exec/store/iceberg/nessie/IcebergNessieModel.java
sabot/kernel/src/main/java/com/dremio/exec/store/iceberg/model/IcebergCommand.java
sabot/kernel/src/main/java/com/dremio/exec/store/iceberg/model/IcebergBaseCommand.java
sabot/kernel/src/main/java/com/dremio/exec/planner/sql/handlers/direct/TableManagementDirectHandler.java
https://docs.dremio.com/software/sql-reference/sql-commands/apache-iceberg-tables/
https://iceberg.apache.org/docs/latest/maintenance/

posted on   荣锋亮  阅读(50)  评论(0编辑  收藏  举报

相关博文:
阅读排行:
· 全程不用写代码,我用AI程序员写了一个飞机大战
· DeepSeek 开源周回顾「GitHub 热点速览」
· 记一次.NET内存居高不下排查解决与启示
· MongoDB 8.0这个新功能碉堡了,比商业数据库还牛
· .NET10 - 预览版1新功能体验(一)
历史上的今天:
2022-02-14 dremio的分布式存储简单说明
2021-02-14 go-mysql-server 新版本发布
2021-02-14 开发一个dremio user_agent 解析函数
2020-02-14 pgspider mongodb fdw 查询集成
2019-02-14 简单webpack plugin 开发
2019-02-14 immutable-styles 基本试用

导航

< 2025年3月 >
23 24 25 26 27 28 1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 31 1 2 3 4 5
点击右上角即可分享
微信分享提示