Repository navigation
[feat](dynamic table) support stream part 1: stream meta data & basic DDL - #61382
Conversation
|
Thank you for your contribution to Apache Doris. Please clearly describe your PR:
|
8800590 to
02dbb12
Compare
|
run buildall |
|
/review |
|
run buildall |
Cloud UT Coverage ReportIncrement line coverage Increment coverage report
|
FE UT Coverage ReportIncrement line coverage |
|
run buildall |
Cloud UT Coverage ReportIncrement line coverage Increment coverage report
|
FE UT Coverage ReportIncrement line coverage |
TPC-H: Total hot run time: 27041 ms |
TPC-DS: Total hot run time: 168631 ms |
BE UT Coverage ReportIncrement line coverage Increment coverage report
|
BE Regression && UT Coverage ReportIncrement line coverage Increment coverage report
|
908e093 to
bf84473
Compare
|
run buildall |
Cloud UT Coverage ReportIncrement line coverage Increment coverage report
|
FE UT Coverage ReportIncrement line coverage |
TPC-H: Total hot run time: 26802 ms |
TPC-DS: Total hot run time: 168467 ms |
BE UT Coverage ReportIncrement line coverage Increment coverage report
|
BE Regression && UT Coverage ReportIncrement line coverage Increment coverage report
|
|
|
||
| public void dropTable(String catalogName, String dbName, String tableName, boolean isView, boolean isMtmv, | ||
| boolean ifExists, boolean mustTemporary, boolean force) throws DdlException { | ||
| boolean isStream, boolean ifExists, boolean mustTemporary, boolean force) |
There was a problem hiding this comment.
put isStream in the last argument, and add another dropTable function like:
public void dropTable(String catalogName, String dbName, String tableName, boolean isView, boolean isMtmv,
boolean ifExists, boolean mustTemporary, boolean force) throws DdlException {
this function just call dropTable with isStream set false?
then you will decrease some changes.
There was a problem hiding this comment.
as dropTable is a interface of catalogIf, we may have to do about the same amount of works anyways. So I think the current modification is better.
0951cf3 to
a2dd793
Compare
|
run buildall |
Cloud UT Coverage ReportIncrement line coverage Increment coverage report
|
FE UT Coverage ReportIncrement line coverage |
dda1608 to
e00e6eb
Compare
|
run buildall |
|
PR approved by at least one committer and no changes requested. |
Cloud UT Coverage ReportIncrement line coverage Increment coverage report
|
FE UT Coverage ReportIncrement line coverage |
BE UT Coverage ReportIncrement line coverage Increment coverage report
|
BE Regression && UT Coverage ReportIncrement line coverage Increment coverage report
|
… DDL (apache#61382) ### What problem does this PR solve? Issue Number: close #xxx Related PR: apache#57921 Problem Summary: stream as basic building blocks for dynamic computing 1. basic DDL: - create stream ```sql CREATE STREAM `s1` ON TABLE tbl1 COMMENT 'test stream 1' PROPERTIES( 'type' = 'min_delta', 'show_initial_rows' = 'true' ); ``` - drop stream ```sql drop stream if exists s1 force; ``` - show streams - show create stream 2. stream information schema ```sql MySQL [test]> select * from information_schema.table_streams; +---------+-------------+---------------+-------------------+--------------+----------------+-----------------+---------------+----------------+-----------------+---------+----------+--------------+ | DB_NAME | STREAM_NAME | STREAM_ID | STREAM_TYPE | CONSUME_TYPE | STREAM_COMMENT | BASE_TABLE_NAME | BASE_TABLE_DB | BASE_TABLE_CTL | BASE_TABLE_TYPE | ENABLED | IS_STALE | STALE_REASON | +---------+-------------+---------------+-------------------+--------------+----------------+-----------------+---------------+----------------+-----------------+---------+----------+--------------+ | test | s1 | 1774337847177 | OLAP_TABLE_STREAM | MIN_DELTA | test stream 1 | tbl1 | test | internal | OLAP | 1 | 0 | N/A | +---------+-------------+---------------+-------------------+--------------+----------------+-----------------+---------------+----------------+-----------------+---------+----------+--------------+ 1 row in set (0.03 sec) ``` 3. stream consumption information schema ```sql MySQL [test]> select * from information_schema.table_stream_consumption; +---------+-------------+---------------+------+--------------------+------+-----------------------+ | DB_NAME | STREAM_NAME | STREAM_ID | UNIT | CONSUMPTION_STATUS | LAG | LAST_CONSUMPTION_TIME | +---------+-------------+---------------+------+--------------------+------+-----------------------+ | test | s1 | 1774337847177 | tbl1 | 32 | 0 | -1 | +---------+-------------+---------------+------+--------------------+------+-----------------------+ 1 row in set (0.02 sec) ``` ### Release note None ### Check List (For Author) - Test <!-- At least one of them must be included. --> - [x] Regression test - [x] Unit Test - [ ] Manual test (add detailed scripts or steps below) - [ ] No need to test or manual test. Explain why: - [ ] This is a refactor/code format and no logic has been changed. - [ ] Previous test can cover this change. - [ ] No code files have been changed. - [ ] Other reason <!-- Add your reason? --> - Behavior changed: - [ ] No. - [x] Yes. <!-- Explain the behavior change --> - Does this need documentation? - [ ] No. - [x] Yes. <!-- Add document PR link here. eg: apache/doris-website#1214 --> ### Check List (For Reviewer who merge this PR) - [ ] Confirm the release note - [ ] Confirm test cases - [ ] Confirm document - [ ] Add branch pick label <!-- Add branch pick label that this PR should merge into -->
|
Tracked by #65418 as part of the row binlog, Table Stream, and MTMV incremental-computation work. |
### What problem does this PR solve? Issue Number: N/A Related PR: apache#61382 Problem Summary: Stream metadata could dereference a concurrently cleared base table, mix availability states within one table_streams row, and keep creation-time base table names after same-ID rename or recovery. Resolve the base table once per metadata row, use live qualifiers when available, and recover the latest dropped-table identity from the recycle bin for SHOW CREATE without adding persistent state. ### Release note Stream metadata and SHOW CREATE STREAM now preserve consistent, current base table identity across rename, drop, and recovery. ### Check List (For Author) - Test: Unit Test - ./run-fe-ut.sh --run org.apache.doris.catalog.DropTableStreamTest (5 tests passed before the final SHOW CREATE assertion; the final source and test compilation passed, but rerunning was blocked by an external IntelliJ JPS error-stub class in target/test-classes) - env DISABLE_BUILD_UI=ON ./build.sh --fe --clean (passed with 0 checkstyle violations before the external JPS process began overwriting target classes) - Behavior changed: Yes. Stream metadata uses one base-table availability snapshot and preserves the latest same-ID base table qualifiers. - Does this need documentation: No
### What problem does this PR solve? Issue Number: N/A Related PR: apache#61382 Problem Summary: Stream metadata could dereference a concurrently cleared base table, mix availability states within one table_streams row, and keep creation-time base table names after same-ID rename or recovery. Resolve the base table once per metadata row, use live qualifiers when available, and recover the latest dropped-table identity from the recycle bin for SHOW CREATE without adding persistent state. ### Release note Stream metadata and SHOW CREATE STREAM now preserve consistent, current base table identity across rename, drop, and recovery. ### Check List (For Author) - Test: Unit Test - ./run-fe-ut.sh --run org.apache.doris.catalog.DropTableStreamTest (5 tests passed before the final SHOW CREATE assertion; the final source and test compilation passed, but rerunning was blocked by an external IntelliJ JPS error-stub class in target/test-classes) - env DISABLE_BUILD_UI=ON ./build.sh --fe --clean (passed with 0 checkstyle violations before the external JPS process began overwriting target classes) - Behavior changed: Yes. Stream metadata uses one base-table availability snapshot and preserves the latest same-ID base table qualifiers. - Does this need documentation: No
### What problem does this PR solve? Issue Number: N/A Related PR: apache#61382 Problem Summary: Stream metadata could dereference a concurrently cleared base table, mix availability states within one table_streams row, and keep creation-time base table names after same-ID rename or recovery. Resolve the base table once per metadata row, use live qualifiers when available, and recover the latest dropped-table identity from the recycle bin for SHOW CREATE without adding persistent state. ### Release note Stream metadata and SHOW CREATE STREAM now preserve consistent, current base table identity across rename, drop, and recovery. ### Check List (For Author) - Test: Unit Test - ./run-fe-ut.sh --run org.apache.doris.catalog.DropTableStreamTest (5 tests passed before the final SHOW CREATE assertion; the final source and test compilation passed, but rerunning was blocked by an external IntelliJ JPS error-stub class in target/test-classes) - env DISABLE_BUILD_UI=ON ./build.sh --fe --clean (passed with 0 checkstyle violations before the external JPS process began overwriting target classes) - Behavior changed: Yes. Stream metadata uses one base-table availability snapshot and preserves the latest same-ID base table qualifiers. - Does this need documentation: No
### What problem does this PR solve? Issue Number: N/A Related PR: apache#61382 Problem Summary: Stream metadata could dereference a concurrently cleared base table, mix availability states within one table_streams row, and keep creation-time base table names after same-ID rename or recovery. Resolve the base table once per metadata row, use live qualifiers when available, and recover the latest dropped-table identity from the recycle bin for SHOW CREATE without adding persistent state. ### Release note Stream metadata and SHOW CREATE STREAM now preserve consistent, current base table identity across rename, drop, and recovery. ### Check List (For Author) - Test: Unit Test - ./run-fe-ut.sh --run org.apache.doris.catalog.DropTableStreamTest (5 tests passed before the final SHOW CREATE assertion; the final source and test compilation passed, but rerunning was blocked by an external IntelliJ JPS error-stub class in target/test-classes) - env DISABLE_BUILD_UI=ON ./build.sh --fe --clean (passed with 0 checkstyle violations before the external JPS process began overwriting target classes) - Behavior changed: Yes. Stream metadata uses one base-table availability snapshot and preserves the latest same-ID base table qualifiers. - Does this need documentation: No
### Background Since apache#61382, a table stream (`CREATE STREAM s ON TABLE t`) is listed with the tables and views of its database in `SHOW FULL TABLES` and `information_schema.tables`, with `ENGINE` `Stream`. Incremental refresh (apache#62606) creates one for each base table of an incrementally refreshed materialized view, named `__doris_ivm_stream_<mv id>_<hash>`. `TableIf.TableType.toMysqlType` gives a stream the table type `VIEW`. ### What problem does this PR solve? Issue Number: None Related PR: apache#61382, apache#62606 PR Type: Enhancement Problem Summary: Metadata clients take a `VIEW` row for a view: they read its definition and parse it for lineage. A stream has no view definition; `SHOW CREATE TABLE` prints `CREATE STREAM ... ON TABLE ...`. OpenMetadata, for one, ingests every stream as a view whose definition is that statement, and the streams incremental refresh creates appear as views nobody created. This PR lists a stream as `BASE TABLE`: it is read with SELECT like a table, and MySQL defines no other table type that fits. `ENGINE` stays `Stream`, so clients can still tell streams apart. Table streams and incremental refresh are only on master, so no released version changes its output. ### Details - **Before and after:** | | Before | After | |---|---|---| | `Table_type` of a stream in `SHOW FULL TABLES` | `VIEW` | `BASE TABLE` | | `TABLE_TYPE`, `ENGINE` of a stream in `information_schema.tables` | `VIEW`, `Stream` | `BASE TABLE`, `Stream` | | the `__doris_ivm_stream_*` streams of an incrementally refreshed MV | listed, `VIEW` | listed, `BASE TABLE` | Views keep `VIEW` and system tables `SYSTEM VIEW`. `information_schema.views`, `SHOW STREAMS`, `SHOW CREATE TABLE` and `information_schema.table_streams` are unchanged: they select streams and views by `TableType`, not by this string. - **Configs and defaults:** None. - **Impact on existing users:** None on released versions: table streams and incremental refresh are on neither branch-4.1 nor branch-4.2. On master, `SHOW FULL TABLES ... WHERE Table_type = 'VIEW'` and JDBC `getTables` with the type `VIEW` no longer return streams, and the type `TABLE` now does. Nothing is persisted: the type is computed whenever a listing is served. ### Testing - Regression test (new): `query_p0/schema_table/test_stream_table_type` creates a table, a stream on it and a view, and checks the stream and the view in `SHOW FULL TABLES`, all three in `information_schema.tables`, and that `information_schema.views` lists only the view. The `.out` is generated. On the code before this PR it fails at its first check: `Expect cell is: BASE TABLE`, `But real is: VIEW`. - FE unit test (new): `TableTypeTest` checks that a stream maps to `BASE TABLE` with the engine `Stream`, and that `VIEW`, `INLINE_VIEW`, `SCHEMA`, `OLAP` and `MATERIALIZED_VIEW` keep their types. `./run-fe-ut.sh --run org.apache.doris.catalog.TableTypeTest`: 2 tests, 0 failures. - Manual: an incrementally refreshed materialized view over a merge-on-write table with changelog; its `__doris_ivm_stream_*` stream is listed as `BASE TABLE` / `Stream` in both listings, and as `VIEW` / `Stream` before this PR. - Environment: a local cluster whose FE ran this branch's fe-core jar (and, for the before runs, a jar of the same base without this change), with a BE from an earlier master build (`6991e766329`); the change is FE-only. ### Notes for Reviewers - Why `BASE TABLE` and not a new value such as `STREAM`: MySQL defines `BASE TABLE`, `VIEW` and `SYSTEM VIEW`, and clients map and filter by them (MySQL Connector/J returns `BASE TABLE` rows as `TABLE` from `getTables`), so a new value would drop streams from client listings or break their type mapping. - Why the streams incremental refresh creates stay listed: they are real objects that `SHOW STREAMS` and `information_schema.table_streams` show and that can be queried; hiding them by their name prefix in some listings would make the listings disagree. - The incremental-refresh case is checked by hand rather than in the suite: it needs a merge-on-write base table with changelog, and a materialized view's `ENGINE` in `information_schema.tables` is about to change (apache#70523), which the `.out` would then depend on. ### Release note None ### Check List (For Author) - Behavior changed: Yes. Table streams are listed as `BASE TABLE` instead of `VIEW`; table streams are not released yet. - Does this need documentation: No. doris-website has no page on table streams yet. - Pre-submission status: Ready ### AI Disclosure - Tool: Claude Code (Claude Opus 5.5) - Generated: the code change, both tests and this description - Human review: not stated Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
) ### Background Since #61382, a table stream (`CREATE STREAM s ON TABLE t`) is listed with the tables and views of its database in `SHOW FULL TABLES` and `information_schema.tables`, with `ENGINE` `Stream`. Incremental refresh (#62606) creates one for each base table of an incrementally refreshed materialized view, named `__doris_ivm_stream_<mv id>_<hash>`. `TableIf.TableType.toMysqlType` gives a stream the table type `VIEW`. ### What problem does this PR solve? Issue Number: None Related PR: #61382 (introduced table streams), #62606 (introduced incremental refresh) PR Type: Enhancement Problem Summary: Metadata clients interpret streams listed as `VIEW` as views and try to parse their `CREATE STREAM ... ON TABLE ...` definitions; OpenMetadata exposes IVM streams as user views. List streams as `BASE TABLE`, keeping `ENGINE = 'Stream'` so clients can distinguish them. Adapt the global hash-bucket checker to select the `Doris` engine, since streams have no physical buckets. Streams and incremental refresh exist only on master, so released versions are unaffected. ### Details - **Before and after:** | | Before | After | |---|---|---| | `Table_type` of a stream in `SHOW FULL TABLES` | `VIEW` | `BASE TABLE` | | `TABLE_TYPE`, `ENGINE` of a stream in `information_schema.tables` | `VIEW`, `Stream` | `BASE TABLE`, `Stream` | | the `__doris_ivm_stream_*` streams of an incrementally refreshed MV | listed, `VIEW` | listed, `BASE TABLE` | Views keep `VIEW` and system tables `SYSTEM VIEW`. `information_schema.views`, `SHOW STREAMS`, `SHOW CREATE TABLE` and `information_schema.table_streams` are unchanged: they select streams and views by `TableType`, not by this string. - **Configs and defaults:** None. - **Impact on existing users:** None on released versions: table streams and incremental refresh are on neither branch-4.1 nor branch-4.2. On master, `SHOW FULL TABLES ... WHERE Table_type = 'VIEW'` and JDBC `getTables` with the type `VIEW` no longer return streams, and the type `TABLE` now does. Nothing is persisted: the type is computed whenever a listing is served. ### Testing - CloudP0 on `6f6109a339b8`: `test_stream_table_type` passed; `check_hash_bucket_table` failed when `SHOW PARTITIONS` reached an internal IVM stream. The engine selector added in this follow-up has not been rerun against a cluster; this worktree has no deployed FE/BE. - Regression test (new): `query_p0/schema_table/test_stream_table_type` creates a table, a stream on it and a view, and checks the stream and the view in `SHOW FULL TABLES`, all three in `information_schema.tables`, and that `information_schema.views` lists only the view. The `.out` is generated. On the code before this PR it fails at its first check: `Expect cell is: BASE TABLE`, `But real is: VIEW`. - FE unit test (new): `TableTypeTest` checks that a stream maps to `BASE TABLE` with the engine `Stream`, and that `VIEW`, `INLINE_VIEW`, `SCHEMA`, `OLAP` and `MATERIALIZED_VIEW` keep their types. `./run-fe-ut.sh --run org.apache.doris.catalog.TableTypeTest`: 2 tests, 0 failures. - Manual: an incrementally refreshed materialized view over a merge-on-write table with changelog; its `__doris_ivm_stream_*` stream is listed as `BASE TABLE` / `Stream` in both listings, and as `VIEW` / `Stream` before this PR. - Original local checks used this branch's FE jar, or the same base without the metadata change, with BE `6991e766329` from an earlier master build. ### Notes for Reviewers - `check_hash_bucket_table` selects the current database's `Doris` engine tables from `information_schema.tables`. `BASE TABLE` includes streams, for which `SHOW PARTITIONS` is invalid. Filtering by engine covers user and IVM streams; async-MV exclusion stays in place. - Why `BASE TABLE`: Connector/J maps it to `TABLE` and clients filter by standard MySQL types; an unfamiliar value such as `STREAM` could drop streams from listings or break type mapping. - Why the streams incremental refresh creates stay listed: they are real objects that `SHOW STREAMS` and `information_schema.table_streams` show and that can be queried; hiding them by their name prefix in some listings would make the listings disagree. - The incremental-refresh case is checked by hand rather than in the suite: it needs a merge-on-write base table with changelog, and a materialized view's `ENGINE` in `information_schema.tables` is about to change (#70523), which the `.out` would then depend on.
What problem does this PR solve?
Issue Number: close #xxx
Related PR: #57921
Problem Summary:
stream as basic building blocks for dynamic computing
Release note
None
Check List (For Author)
Test
Behavior changed:
Does this need documentation?
Check List (For Reviewer who merge this PR)