Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sql: Implement a preliminary version of multiple active portals #96358

Closed

Commits on Mar 27, 2023

  1. sql: set the clean-up steps for pausable portal

    This is part of the implementation of multiple active portals.
    
    To enable executing portals interleavingly, we need to persist certain resources
    for it, and delay their clean-up till we close the portal. Also, these resources
    don't need to be re-setup when we re-executing a portal.
    
    Thus we stores these cleanup steps in the `__Cleanup` function stacks in
    `portalPauseInfo`, and they are called when 1. sql txn is commited; 2. sql txn
    is rollbacked; 3. conn executor is closed.
    
    The cleanup functions should be called according to the original order of a normal
    portal. Since a portal's execution is via the `execPortal() -> execStmtInOpenState
    () -> dispatchToExecutionEngine() ->  flow.Run()` function flow, we categorized the
    cleanup functions accordingly into
    4 "layers": `exhaustPortal`, `execStmtCleanup` `dispatchToExecEngCleanup` and
    `flowCleanup`. The cleanup
    is always LIFO, i.e. following the `flowCleanup -> dispatchToExecEngCleanup ->
    execStmtCleanup -> exhaustPortal` order. Also, when there's error happens in each
    layer, cleanup the current and proceeding layers. e.g. if we encounter an error in
    `execStmtInOpenState()`, do `flowCleanup` and `dispatchToExecEngCleanup`
    (proceeding) and then `execStmtCleanup` (current), and return the
    error to `execPortal()`, where `exhaustPortal` will eventually be called.
    
    We also pass as reference the PreparedPortal to the planner in
    `execStmtInOpenState()`, so that the portal's flow can be set and reused.
    
    Release note: None
    ZhouXing19 committed Mar 27, 2023
    Configuration menu
    Copy the full SHA
    354b40c View commit details
    Browse the repository at this point in the history
  2. sql: add restrictions for pausable portals

    This commits add the following restrictions for pausable portals:
    
    1. Not an internal queries
    2. Read-only queries
    3. No sub-quereis or post-queries
    4. Local plan only
    
    This is because the current changes to the consumer-receiver model only consider
    the local push-based case.
    
    Release note: None
    ZhouXing19 committed Mar 27, 2023
    Configuration menu
    Copy the full SHA
    6b97c97 View commit details
    Browse the repository at this point in the history
  3. pgwire: add tests for multiple active portals

    Release note: None
    ZhouXing19 committed Mar 27, 2023
    Configuration menu
    Copy the full SHA
    13871ad View commit details
    Browse the repository at this point in the history