Skip to content

opti(stream): remove old logic of stream - #34642

Merged
guanshengliang merged 24 commits into
3.0from
enh/6554623504-rm-old-stream
Mar 12, 2026
Merged

guanshengliang merged 24 commits into
3.0from
enh/6554623504-rm-old-stream

Conversation

@wangmm0220

@wangmm0220 wangmm0220 commented Mar 2, 2026

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 March 2, 2026 08:15
@gemini-code-assist

Copy link
Copy Markdown
Contributor

Summary of Changes

Hello, 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

  • Removed Legacy Stream Logic: Eliminated numerous unused or deprecated data structures and functions related to stream messages, task updates, and dispatch requests from include/common/streamMsg.h and source/common/src/msg/streamMsg.c.
  • Stream Type Simplification: Removed the EStreamType enum and its usage, including the type field from SDataBlockInfo and the createSpecialDataBlock function.
  • Deprecated Stream Notification System Removal: The entire source/libs/executor/src/streamNotify.c file and related data structures (STaskNotifyEventStat, EStreamNotifyEventType, SStreamNotifyEventSupp, SSteamOpBasicInfo) were removed, indicating a complete overhaul or deprecation of the old stream notification mechanism.
  • TMQ Scan Operator Refactoring: Consolidated and simplified stream scan-related structures by replacing SStreamScanInfo and SStreamRawScanInfo with STmqQueryScanInfo and STmqRawScanInfo, respectively, and removing many redundant fields and associated logic.
  • Task Information Streamlining: Replaced SStreamTaskInfo with STmqTaskInfo in querytask.h, significantly reducing the complexity of task-related data by removing fields like recoverStep, fillHistoryVer, pState, notifyResultSchema, and pNotifyEventStat.
  • Error Handling Improvement for TMQ: Enhanced error handling in tqScan.c and tqUtil.c for TMQ operations by explicitly checking for TSDB_CODE_WAL_LOG_NOT_EXIST and TSDB_CODE_TMQ_FETCH_TIMEOUT.
  • Aggregation Operator State Simplification: Modified various aggregation operators (e.g., aggregateoperator.c, timewindowoperator.c) to no longer rely on pTaskInfo->streamInfo.pState, aligning with the removal of this state from the simplified task information.

🧠 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
  • include/common/streamMsg.h
    • Removed declarations for SStreamRetrieveReq, SStreamDispatchReq, SNodeUpdateInfo, SStreamUpstreamEpInfo, SStreamTaskNodeUpdateMsg, SStreamTaskCheckReq, SStreamTaskCheckRsp structs and their associated encoding/decoding/destroy functions.
  • include/common/tcommon.h
    • Removed EStreamType enum and the type field from SDataBlockInfo.
  • include/common/tdatablock.h
    • Removed declaration of createSpecialDataBlock function.
  • include/common/tmsg.h
    • Removed STaskNotifyEventStat struct.
  • include/libs/executor/storageapi.h
    • Removed SRecDataInfo struct and pRecValueBuff field from STableTsDataState.
  • include/libs/nodes/cmdnodes.h
    • Removed EStreamNotifyEventType enum.
  • source/common/src/msg/streamMsg.c
    • Removed implementations of encoding/decoding/destroy functions for various stream message structs.
  • source/common/src/tdatablock.c
    • Removed implementation of createSpecialDataBlock and removed 'block type' from a debug print.
  • source/dnode/mnode/impl/inc/mndStream.h
    • Removed SVgroupChangeInfo struct.
  • source/dnode/mnode/impl/test/stream/stream.cpp
    • Removed test code related to STaskStatusEntry and SStreamTask setup.
  • source/dnode/vnode/src/tq/tqScan.c
    • Added handling for TSDB_CODE_TMQ_FETCH_TIMEOUT and TSDB_CODE_WAL_LOG_NOT_EXIST in getDataBlock and tqScanData.
  • source/dnode/vnode/src/tq/tqUtil.c
    • Corrected error code check from terrno to code for TSDB_CODE_WAL_LOG_NOT_EXIST.
  • source/libs/executor/inc/executorInt.h
    • Replaced EStreamScanMode, SStreamNotifyEventSupp, SSteamOpBasicInfo, SStreamFillSupporter, SStreamScanInfo, SStreamRawScanInfo with STmqQueryScanInfo and STmqRawScanInfo.
  • source/libs/executor/inc/querytask.h
    • Replaced SStreamTaskInfo with STmqTaskInfo and removed several fields.
  • source/libs/executor/inc/streamexecutorInt.h
    • Removed declarations for initStreamBasicInfo, encodeStreamBasicInfo, decodeStreamBasicInfo, and several addAggNotifyEvent functions.
  • source/libs/executor/src/aggregateoperator.c
    • Updated initAggSup and resetAggSup calls to pass NULL instead of pTaskInfo->streamInfo.pState.
  • source/libs/executor/src/anomalywindowoperator.c
    • Updated initAggSup and resetAggSup calls to pass NULL instead of pTaskInfo->streamInfo.pState.
  • source/libs/executor/src/countwindowoperator.c
    • Updated initAggSup and resetAggSup calls to pass NULL instead of pTaskInfo->streamInfo.pState.
  • source/libs/executor/src/eventwindowoperator.c
    • Updated initAggSup and resetAggSup calls to pass NULL instead of pTaskInfo->streamInfo.pState.
  • source/libs/executor/src/executil.c
    • Removed pBlock->info.type = STREAM_INVALID; assignment and 'block type' from debug output.
  • source/libs/executor/src/executor.c
    • Removed old doSetSMABlock logic for stream input types.
    • Renamed SStreamScanInfo to STmqQueryScanInfo and SStreamRawScanInfo to STmqRawScanInfo.
    • Replaced pTaskInfo->streamInfo with pTaskInfo->tmqInfo.
  • source/libs/executor/src/externalwindowoperator.c
    • Updated initAggSup and resetAggSup calls to pass NULL instead of pTaskInfo->streamInfo.pState.
  • source/libs/executor/src/groupoperator.c
    • Updated initAggSup and resetAggSup calls to pass NULL instead of pTaskInfo->streamInfo.pState.
    • Removed buildCreateTableBlock function.
  • source/libs/executor/src/operator.c
    • Renamed SStreamScanInfo to STmqQueryScanInfo.
  • source/libs/executor/src/projectoperator.c
    • Updated initAggSup and resetAggSup calls to pass NULL instead of pTaskInfo->streamInfo.pState.
    • Removed stream-specific block type handling in doProjectOperation.
  • source/libs/executor/src/querytask.c
    • Removed pStateBackend and pOtherBackend assignments.
    • Replaced cleanupStreamInfo with cleanupTmqInfo and simplified it.
  • source/libs/executor/src/scanoperator.c
    • Removed logic for TSDB_CODE_PAR_TABLE_NOT_EXIST related to streamInfo.pState.
    • Renamed SStreamScanInfo to STmqQueryScanInfo and SStreamRawScanInfo to STmqRawScanInfo.
    • Replaced pTaskInfo->streamInfo with pTaskInfo->tmqInfo.
    • Simplified destroyTmqScanOperatorInfo and createTmqScanOperatorInfo by removing many stream-specific fields and logic.
  • source/libs/executor/src/streamNotify.c
    • Removed the entire file.
  • source/libs/executor/src/timewindowoperator.c
    • Removed EStreamType blockType parameter from inCalSlidingWindow and inSlidingWindow.
    • Updated initAggSup and resetAggSup calls to pass NULL instead of pTaskInfo->streamInfo.pState.
Activity
  • The pull request was created by wangmm0220.
  • The title 'opti(stream): remove old logic of stream' indicates an optimization and cleanup effort.
  • No specific comments or reviews have been provided in the context.
Using Gemini Code Assist

The 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 /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

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 .gemini/ folder in the base of the repository. Detailed instructions can be found here.

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

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

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

Copy link
Copy Markdown
Contributor

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 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.

Comment thread source/dnode/vnode/src/tq/tqUtil.c Outdated
Comment thread source/dnode/vnode/src/tq/tqScan.c Outdated

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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 of tmqInfo/STmqTaskInfo and updates many executor operators accordingly.
  • Deletes stream notify-event implementation and related public APIs/types.
  • Removes EStreamType and SDataBlockInfo.type usage 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.

Comment thread source/libs/executor/src/executor.c
Comment thread source/libs/executor/src/scanoperator.c
Comment thread source/libs/executor/src/scanoperator.c
Comment thread include/common/tcommon.h
Copilot AI review requested due to automatic review settings March 3, 2026 02:50
@wangmm0220

Copy link
Copy Markdown
Contributor Author

@gemini-code-assist review

@gemini-code-assist

Copy link
Copy Markdown
Contributor

Warning

You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again!

@wangmm0220

Copy link
Copy Markdown
Contributor Author

/gemini review

@gemini-code-assist

Copy link
Copy Markdown
Contributor

Warning

You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again!

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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 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.

Comment thread source/libs/executor/test/joinTests.cpp Outdated
@wangmm0220

Copy link
Copy Markdown
Contributor Author

@github-copilot review

Copilot AI review requested due to automatic review settings March 4, 2026 08:44

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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 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 EStreamType enum and the SDataBlockInfo::type field breaks existing code that still relies on SSDataBlock.info.type and constants like STREAM_CHECKPOINT / STREAM_DELETE_RESULT (e.g., vnode SMA code and qSetSMAInput call sites). Either keep type (and the enum/values) for compatibility, or update all remaining producers/consumers to use a replacement mechanism before removing the field from the shared SSDataBlock ABI.
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.

Comment thread source/libs/executor/src/scanoperator.c
Comment thread source/libs/executor/src/executor.c
Comment thread source/libs/executor/inc/executorInt.h Outdated
@wangmm0220

Copy link
Copy Markdown
Contributor Author

/gemini review

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

Copy link
Copy Markdown
Contributor

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 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.

Copilot AI review requested due to automatic review settings March 5, 2026 10:19

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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 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::type field (and the related EStreamType values like STREAM_CHECKPOINT/STREAM_GET_ALL) breaks existing in-tree users that still set/test SSDataBlock.info.type (e.g., source/dnode/vnode/src/sma/smaEnv.c and smaRollup.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.

Comment thread source/libs/executor/src/executor.c
Comment thread source/libs/executor/src/executor.c
Comment thread source/libs/executor/src/executil.c
@guanshengliang
guanshengliang merged commit 6ade4e4 into 3.0 Mar 12, 2026
23 of 26 checks passed
@guanshengliang
guanshengliang deleted the enh/6554623504-rm-old-stream branch March 12, 2026 01:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants