Iceberg 删除与读取核对

Iceberg 文档索引:Iceberg 文档总览。

先完成基础 Iceberg 订单教程的 SQL 清理,然后在启动 mo-service 的终端按 Ctrl+C,等待进程退出。独立 E2E 会自行启动 MatrixOne;其预检要求 6001、7001 等端口空闲。仅运行 make dev-down-iceberg-tier-a 不会停止教程中手动启动的 mo-service。

从 MatrixOne 源码根目录停止基础教程的 Compose 服务,再运行独立测试:

make dev-down-iceberg-tier-a
make test-iceberg-e2e-local

如果基础教程使用本地 brew 服务,先运行 make dev-down-iceberg-tier-a-brew,再运行测试;独立 E2E 仍需要 Docker Compose。

测试在真实 Nessie、MinIO 和 MatrixOne 上创建 merge_on_read 的 mor_accounts 表,插入四行、删除一行,并验证剩余计数和金额。其 用例实现 使用如下关键操作;在自己已配置的 merge_on_read 外表上替换名称执行:

INSERT INTO cookbook_iceberg.mor_accounts VALUES
  (1,100,'ksa'),(2,200,'uae'),(3,300,'ksa'),(4,300,'qat');
DELETE FROM cookbook_iceberg.mor_accounts WHERE account_id = 2;
SELECT COUNT(*) AS remaining, SUM(balance) AS balance_sum
FROM cookbook_iceberg.mor_accounts;
SELECT COUNT(*) AS deleted_rows FROM cookbook_iceberg.mor_accounts
WHERE account_id = 2;

预期为 remaining=3、balance_sum=700、deleted_rows=0。基础订单教程使用 append_only,不能直接在该映射上做删除。清理顺序是删除 MatrixOne 映射、撤销访问策略、删除目录,再停止本地服务;远端 Iceberg 数据另行确认后清理。