github-actions[bot] commented on code in PR #67173:
URL: https://github.com/apache/doris/pull/67173#discussion_r3863193397
##########
fe/fe-core/src/main/java/org/apache/doris/catalog/stream/BaseTableStream.java:
##########
@@ -93,30 +93,61 @@ public static TBinlogScanType toThrift(StreamScanType
streamScanType) {
@SerializedName("sr")
private String staleReason = "N/A";
- protected volatile TableIf baseTable;
-
// for persist
public BaseTableStream() {
super(TableType.STREAM);
}
- public BaseTableStream(long id, String streamName, List<Column>
fullSchema, TableIf baseTable) {
- super(id, streamName, TableType.STREAM, fullSchema);
+ public BaseTableStream(long id, String streamName, TableIf baseTable) {
+ super(id, streamName, TableType.STREAM, null);
Review Comment:
[P1] Preserve a serialized schema for older FE readers
Passing `null` here leaves `fullSchema` absent because Doris's Gson
configuration does not serialize null fields. A stream created by this FE is
therefore written without the only schema representation understood by the
pre-change reader: when an older FE replays the `CreateTableInfo` journal entry
or loads an image during rolling upgrade/failover, its no-arg construction
leaves an empty schema and its inherited accessors expose zero columns. Please
retain a serialized compatibility snapshot (new code can still ignore it at
runtime), or explicitly version/gate this metadata format and cover the
new-writer/old-reader path.
##########
regression-test/suites/table_stream_p0/test_olap_table_stream_schema_sync.groovy:
##########
@@ -0,0 +1,129 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+// The stream schema is generated dynamically from the base table, so a base
table
+// schema change (ADD/DROP COLUMN) must be reflected by the stream
automatically.
+suite("test_olap_table_stream_schema_sync", "nonConcurrent") {
+ if (isCloudMode()) {
+ return
+ }
+ sql "DROP DATABASE IF EXISTS test_olap_table_stream_schema_sync_db"
+ sql "CREATE DATABASE test_olap_table_stream_schema_sync_db"
+ sql "USE test_olap_table_stream_schema_sync_db"
+
+ def baseTable = "schema_sync_base"
+ def streamName = "schema_sync_stream"
+
+ def delta_time = 1000
+ def useTime = 0
+ def wait_for_latest_op_on_table_finish = { tableName, opTimeout ->
+ for (int t = delta_time; t <= opTimeout; t += delta_time) {
+ def alter_res = sql """SHOW ALTER TABLE COLUMN WHERE TableName =
"${tableName}" ORDER BY CreateTime DESC LIMIT 1;"""
+ alter_res = alter_res.toString()
+ if (alter_res.contains("FINISHED")) {
+ sleep(3000) // wait change table state to normal
+ logger.info(tableName + " latest alter job finished, detail: "
+ alter_res)
+ break
+ }
+ useTime = t
+ sleep(delta_time)
+ }
+ assertTrue(useTime <= opTimeout, "wait_for_latest_op_on_table_finish
timeout")
Review Comment:
[P2] Assert that this ALTER actually reached FINISHED
If the job never reaches `FINISHED`, the final unfinished iteration assigns
`useTime == opTimeout`, so this `<=` assertion still passes. The test then
continues while the ALTER is running or terminally failed, turning the intended
completion gate into a delayed or misleading schema assertion failure. Track a
per-invocation `finished` flag inside the closure and assert that flag after
the loop.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]