opti(stream): remove old logic of stream - #34642
Conversation
Summary of ChangesHello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request undertakes a substantial optimization and cleanup of the stream processing and Time-series Message Queue (TMQ) related components. It systematically removes outdated and unused data structures, enums, and functions that were part of an older stream logic, including a complete deprecation of a previous stream notification event system. The changes also involve a significant refactoring and simplification of the TMQ scan operator and task information structures, leading to a more streamlined and efficient codebase. Additionally, error handling for TMQ operations has been improved to better manage specific scenarios like WAL log absence or fetch timeouts. Highlights
🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console. Changelog
Activity
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request is a large but valuable refactoring that removes a significant amount of old and unused stream logic. The changes simplify the codebase by removing obsolete data structures and functions, and renaming others for better clarity (e.g., SStream* to STmq*). The overall direction is positive. However, I've found some issues in the error handling logic within the tq module, where changes from using the global terrno to using function return codes seem to be incorrect or incomplete, potentially leading to bugs. Please see my detailed comments.
There was a problem hiding this comment.
Pull request overview
This PR removes legacy stream-executor logic and stream-specific data-block “type” handling, shifting TMQ execution paths toward the newer tmqInfo-based task state and simplifying several executor/scan code paths.
Changes:
- Renames/removes legacy stream task state (
streamInfo/SStreamTaskInfo) in favor oftmqInfo/STmqTaskInfoand updates many executor operators accordingly. - Deletes stream notify-event implementation and related public APIs/types.
- Removes
EStreamTypeandSDataBlockInfo.typeusage from common data-block structures and updates assorted logging/scan code.
Reviewed changes
Copilot reviewed 29 out of 29 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| source/libs/executor/src/timewindowoperator.c | Simplifies sliding-window checks by removing stream block-type dependency. |
| source/libs/executor/src/streamNotify.c | Removes legacy stream notify-event implementation (file deleted). |
| source/libs/executor/src/scanoperator.c | Refactors stream scan structs to TMQ scan structs; removes legacy stream-only behaviors. |
| source/libs/executor/src/querytask.c | Removes legacy stream state backend wiring; updates task cleanup for tmqInfo. |
| source/libs/executor/src/projectoperator.c | Removes stream-special-case passthrough; removes stream state pointer from agg support init/reset. |
| source/libs/executor/src/operator.c | Updates stream scan info type usage to STmqQueryScanInfo. |
| source/libs/executor/src/groupoperator.c | Removes stream create-table block helper; removes stream state pointer from agg support init/reset. |
| source/libs/executor/src/externalwindowoperator.c | Removes stream state pointer from agg support init/reset. |
| source/libs/executor/src/executor.c | Removes old stream input buffering; updates TMQ scanner extraction paths and some TMQ logic. |
| source/libs/executor/src/executil.c | Removes stream block “type” initialization and stream-type logging from debug helpers. |
| source/libs/executor/src/eventwindowoperator.c | Removes stream state pointer from agg support init/reset. |
| source/libs/executor/src/countwindowoperator.c | Removes stream state pointer from agg support init/reset. |
| source/libs/executor/src/anomalywindowoperator.c | Removes stream state pointer from agg support init/reset. |
| source/libs/executor/src/aggregateoperator.c | Removes stream state pointer from agg support init/reset. |
| source/libs/executor/inc/streamexecutorInt.h | Drops stream notify-event related API declarations. |
| source/libs/executor/inc/querytask.h | Replaces SStreamTaskInfo with STmqTaskInfo on SExecTaskInfo. |
| source/libs/executor/inc/executorInt.h | Removes multiple legacy stream structs/enums; introduces STmqQueryScanInfo/STmqRawScanInfo. |
| source/dnode/vnode/src/tq/tqUtil.c | Fixes WAL-not-exist handling to rely on code instead of terrno. |
| source/dnode/vnode/src/tq/tqScan.c | Handles TMQ fetch timeout and WAL-not-exist codes explicitly during scan. |
| source/dnode/mnode/impl/test/stream/stream.cpp | Removes legacy task status population in a stream test helper. |
| source/dnode/mnode/impl/inc/mndStream.h | Removes unused SVgroupChangeInfo type. |
| source/common/src/tdatablock.c | Removes createSpecialDataBlock and stream block-type debug output. |
| source/common/src/msg/streamMsg.c | Removes legacy stream message encode/decode types and helpers. |
| include/libs/nodes/cmdnodes.h | Removes legacy EStreamNotifyEventType. |
| include/libs/executor/storageapi.h | Removes SRecDataInfo and related state pointer from STableTsDataState. |
| include/common/tmsg.h | Removes STaskNotifyEventStat. |
| include/common/tdatablock.h | Removes createSpecialDataBlock declaration. |
| include/common/tcommon.h | Removes EStreamType and SDataBlockInfo.type. |
| include/common/streamMsg.h | Removes legacy dispatch/retrieve message types and encode/decode declarations. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
@gemini-code-assist review |
|
Warning You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again! |
|
/gemini review |
|
Warning You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again! |
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 28 out of 28 changed files in this pull request and generated 1 comment.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
@github-copilot review |
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 28 out of 28 changed files in this pull request and generated 3 comments.
Comments suppressed due to low confidence (1)
include/common/tcommon.h:223
- Removing the
EStreamTypeenum and theSDataBlockInfo::typefield breaks existing code that still relies onSSDataBlock.info.typeand constants likeSTREAM_CHECKPOINT/STREAM_DELETE_RESULT(e.g., vnode SMA code andqSetSMAInputcall sites). Either keeptype(and the enum/values) for compatibility, or update all remaining producers/consumers to use a replacement mechanism before removing the field from the sharedSSDataBlockABI.
typedef struct SDataBlockInfo {
STimeWindow window;
int32_t rowSize;
uint32_t capacity;
int64_t rows; // todo hide this attribute
SBlockID id;
int16_t hasVarCol;
int16_t dataLoad; // denote if the data is loaded or not
uint8_t scanFlag;
bool blankFill;
SValue pks[2];
// TODO: optimize and remove following
int64_t version; // used for stream, and need serialization
int32_t childId; // used for stream, do not serialize
STimeWindow calWin; // used for stream, do not serialize
TSKEY watermark; // used for stream
char parTbName[TSDB_TABLE_NAME_LEN]; // used for stream partition
} SDataBlockInfo;
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
You can also share your feedback on Copilot code review. Take the survey.
|
/gemini review |
There was a problem hiding this comment.
Code Review
This pull request is a large-scale refactoring that removes a significant amount of old stream processing logic. The changes are widespread, affecting data structures, function definitions, and their usage across multiple components. Key changes include the removal of many stream-related message types and their serialization functions, the deletion of the EStreamType enum and its usages, and the simplification and renaming of core data structures like SStreamScanInfo to STmqQueryScanInfo. The cleanup appears to be thorough and consistent across all modified files. The removal of this legacy code should improve maintainability. The changes are well-contained and I did not find any issues.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 28 out of 28 changed files in this pull request and generated 3 comments.
Comments suppressed due to low confidence (1)
include/common/tcommon.h:223
- Removing the
SDataBlockInfo::typefield (and the relatedEStreamTypevalues likeSTREAM_CHECKPOINT/STREAM_GET_ALL) breaks existing in-tree users that still set/testSSDataBlock.info.type(e.g.,source/dnode/vnode/src/sma/smaEnv.candsmaRollup.c). This will currently fail to compile and/or removes the ability for SMA code to distinguish control blocks.
Suggested fix: either (a) refactor those SMA paths to use a new/remaining field (e.g., scanFlag/a dedicated control-kind enum) and remove all STREAM_* usage, or (b) keep a dedicated block-kind field in SDataBlockInfo (not stream-specific) until all downstream users are migrated.
// TODO: optimize and remove following
int64_t version; // used for stream, and need serialization
int32_t childId; // used for stream, do not serialize
STimeWindow calWin; // used for stream, do not serialize
TSKEY watermark; // used for stream
char parTbName[TSDB_TABLE_NAME_LEN]; // used for stream partition
} SDataBlockInfo;
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
You can also share your feedback on Copilot code review. Take the survey.
Description
Issue(s)
Checklist
Please check the items in the checklist if applicable.