Skip to content

fix(tmq): add test case for drop table & updata docs#35141

Merged
guanshengliang merged 5 commits intomainfrom
feat/6491115004
Apr 16, 2026
Merged

fix(tmq): add test case for drop table & updata docs#35141
guanshengliang merged 5 commits intomainfrom
feat/6491115004

Conversation

@wangmm0220
Copy link
Copy Markdown
Contributor

Description

Issue(s)

Checklist

Please check the items in the checklist if applicable.

  • Is the user manual updated?
  • Are the test cases passed and automated?
  • Is there no significant decrease in test coverage?

Copilot AI review requested due to automatic review settings April 15, 2026 01:33
@wangmm0220 wangmm0220 requested review from a team, guanshengliang and zitsen as code owners April 15, 2026 01:33
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds CI coverage for a TMQ scenario involving dropping and recreating a child table, and updates TMQ documentation to reflect the correct RELOAD TOPIC support version and audit-field descriptions.

Changes:

  • Add a new TMQ regression test flow (check_drop_ctable) and run it from test_tmq_ts6379.
  • Register test_tmq_ts6379.py in CI tasks, and also re-enable test_tmq_taosx.py.
  • Update EN/ZH TMQ docs to state RELOAD TOPIC is supported since 3.4.0; adjust EN/ZH security audit table row for “reload topic”.

Reviewed changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
test/ci/cases.task Adds TS-6379 test to CI and re-enables test_tmq_taosx.py.
test/cases/17-DataSubscription/02-Consume/test_tmq_ts6379.py Adds drop/recreate child-table TMQ test logic and invokes it in the test entrypoint.
docs/zh/14-reference/03-taos-sql/40-tmq.md Updates RELOAD TOPIC supported-since version to 3.4.0.
docs/zh/08-operation/16-security.md Corrects audit record fields for “reload topic”.
docs/zh/06-advanced/01-subscription/01-topic.md Updates RELOAD TOPIC supported-since version to 3.4.0.
docs/en/14-reference/03-taos-sql/40-tmq.md Updates RELOAD TOPIC supported-since version to 3.4.0.
docs/en/08-operation/16-security.md Corrects audit record fields for “reload topic”.
docs/en/06-advanced/01-subscription/01-topic.md Updates RELOAD TOPIC supported-since version to 3.4.0.
Comments suppressed due to low confidence (3)

test/cases/17-DataSubscription/02-Consume/test_tmq_ts6379.py:607

  • create database db_ctable without IF EXISTS (and without any cleanup) can make this test non-idempotent and fail when rerun in the same environment. Consider drop database if exists db_ctable at the start (or create database if not exists ...) and optionally drop it in finally to avoid cross-test interference.
    test/cases/17-DataSubscription/02-Consume/test_tmq_ts6379.py:633
  • The "no data after drop table" assertion stops after the first empty poll. That can miss late-arriving records (or delayed delivery) and lead to a false pass. Consider polling for a fixed total duration (e.g., 5–10 seconds) and only passing if all polls return empty/no-value during that whole window.
    test/cases/17-DataSubscription/02-Consume/test_tmq_ts6379.py:646
  • When expecting data after recreating the table + reload topic, this loop fails immediately on the first empty poll(1), which is prone to timing flakiness in CI. Consider looping until a reasonable timeout (or a max retry count) before failing, and validate the received record’s topic/table to ensure the message is from the recreated table.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread test/ci/cases.task
Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request updates the documentation to reflect that the RELOAD TOPIC syntax is supported starting from version 3.4.0 and corrects the associated audit log information. It also introduces a new test case, check_drop_ctable, to verify topic reloading after a table is dropped and recreated, and enables several tests in the CI configuration. Feedback suggests using IF NOT EXISTS when creating databases in tests to avoid conflicts and simplifying a redundant loop in the new test logic to improve readability.

Comment thread test/cases/17-DataSubscription/02-Consume/test_tmq_ts6379.py
Comment thread test/cases/17-DataSubscription/02-Consume/test_tmq_ts6379.py
@wangmm0220 wangmm0220 requested a review from dapan1121 as a code owner April 15, 2026 02:09
Copilot AI review requested due to automatic review settings April 15, 2026 02:25
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 9 out of 9 changed files in this pull request and generated 6 comments.

Comments suppressed due to low confidence (3)

test/cases/17-DataSubscription/02-Consume/test_tmq_ts6379.py:613

  • This test creates db_stable without any prior cleanup (no DROP DATABASE IF EXISTS / CREATE DATABASE IF NOT EXISTS) and uses fixed names (db_stable, st, t1, t2). That makes it prone to failures on reruns or shared/parallel CI because these objects may already exist. Prefer namespacing with func_name (or add drop-if-exists) and clean up created topics/databases in a finally block.
    test/cases/17-DataSubscription/02-Consume/test_tmq_ts6379.py:666
  • check_drop_stable_stable_topic() drops t2/db_stable at the start but then creates topic t3 and never drops it (nor db_stable) at the end. This can leave state behind that interferes with reruns/other tests. Please add cleanup for t3 (and optionally db_stable) in a finally block or use unique names per test.
    test/cases/17-DataSubscription/02-Consume/test_tmq_ts6379.py:716
  • check_drop_ctable() creates db_ctable without IF NOT EXISTS / prior DROP DATABASE IF EXISTS, and it also creates a fixed-name topic/table (t1). This makes the test sensitive to reruns and shared environments. Prefer a per-test unique database/topic/table name (e.g., based on func_name) or add explicit cleanup at start/end.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread docs/en/14-reference/03-taos-sql/40-tmq.md
Comment thread docs/en/06-advanced/01-subscription/01-topic.md
Comment thread docs/en/06-advanced/01-subscription/01-topic.md
Comment thread docs/en/14-reference/03-taos-sql/40-tmq.md
Comment thread docs/zh/14-reference/03-taos-sql/40-tmq.md
Comment thread docs/zh/06-advanced/01-subscription/01-topic.md
@wangmm0220 wangmm0220 changed the title fix(tmq): add test case for drop table fix(tmq): add test case for drop table & updata docs Apr 15, 2026
@JinqingKuang
Copy link
Copy Markdown
Contributor

Code Review — PR #35141

本 PR 移除了 mndCheckDropStbForTopic 保护检查,允许有 topic 引用时也能 DROP 超级表,并配套更新了文档和测试用例。整体方向正确,但有以下几个问题需要关注。


[HIGH] 行为兼容性破坏:移除 DROP 超级表的 topic 保护检查

文件: source/dnode/mnode/impl/src/mndStb.c

mndCheckDropStbForTopic 函数被整体删除,mndProcessDropStbReq 中的调用也一并移除。原来执行 DROP TABLE(超级表)时若有 topic 引用,会返回 TSDB_CODE_MND_TOPIC_MUST_BE_DELETED;现在会静默成功。

这是一个语义兼容性破坏:使用了该错误码进行防御性检查的上层代码将失去保护。建议在 PR 描述中明确说明此为 intentional breaking change,并确认是否需要更新错误码或升级文档中的"从 X 版本起支持"说明。

新增的三个测试用例仅覆盖了 DROP 后 poll 的静止状态,未测试 DROP 发生时正在活跃消费的 consumer 的行为(例如:consumer 正在 poll 时超级表被删)。建议补充该场景的测试。


[MEDIUM] 文档:删除了"新增列不出现在结果中"的说明

文件: docs/en/06-advanced/01-subscription/01-topic.mddocs/zh/14-reference/03-taos-sql/40-tmq.md

原文档有一条说明:"若发生表结构变更,新增的列不出现在结果中(If there are changes to the table structure, new columns will not appear in the results)"。此条被直接删除,但没有 RELOAD TOPIC 的情况下该限制仍然成立。建议改写为:

若发生表结构变更(新增列),新增的列默认不出现在结果中;需要执行 RELOAD TOPIC 后才会生效。

避免用户误解为新增列会自动出现在订阅结果中。


[MEDIUM] cases.task:test_tmq_taosx.py 被无注释地取消注释

文件: test/ci/cases.task(第 665 行)

该测试此前被注释,现在被重新启用,但 PR 描述中无任何说明。如果这是预期行为(bug 修复后恢复),请在 PR 描述中补充说明,避免后续 CI 问题难以溯源。


🤖 由 Claude Code 生成的代码审查

Comment thread test/cases/17-DataSubscription/02-Consume/test_tmq_ts6379.py
Comment thread test/cases/17-DataSubscription/02-Consume/test_tmq_ts6379.py
Comment thread test/cases/17-DataSubscription/02-Consume/test_tmq_ts6379.py
Comment thread test/ci/cases.task
@guanshengliang guanshengliang merged commit ee7c9c3 into main Apr 16, 2026
19 of 20 checks passed
@guanshengliang guanshengliang deleted the feat/6491115004 branch April 16, 2026 08:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants