Skip to content

Cluster redirect#36

Merged
Vishvas-meesho merged 25 commits intomasterfrom
cluster-redirect-vishvas
Mar 3, 2026
Merged

Cluster redirect#36
Vishvas-meesho merged 25 commits intomasterfrom
cluster-redirect-vishvas

Conversation

@Vishvas-meesho
Copy link

@Vishvas-meesho Vishvas-meesho commented Mar 3, 2026

What is this PR for?

A few sentences describing the overall goals of the pull request's commits.
First time? Check out the contributing guide - https://zeppelin.apache.org/contribution/contributions.html

What type of PR is it?

Bug Fix
Improvement
Feature
Documentation
Hot Fix
Refactoring
Please leave your type of PR only

Todos

  • - Task

What is the Jira issue?

How should this be tested?

  • Strongly recommended: add automated unit tests for any new or changed behavior
  • Outline any manual steps to test the PR here.

Screenshots (if appropriate)

Questions:

  • Does the license files need to update?
  • Is there breaking changes for older versions?
  • Does this needs documentation?

Summary by CodeRabbit

Release Notes

  • New Features

    • Added per-URL connection pool management for improved JDBC connection handling.
    • Introduced ability to override JDBC URLs for individual operations.
    • Enhanced connection validation with URL-aware processing.
  • Improvements

    • Improved websocket initialization and stability.

@coderabbitai
Copy link

coderabbitai bot commented Mar 3, 2026

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between c79788e and 2d10fde.

📒 Files selected for processing (5)
  • jdbc/src/main/java/org/apache/zeppelin/jdbc/JDBCInterpreter.java
  • jdbc/src/main/java/org/apache/zeppelin/jdbc/JDBCUserConfigurations.java
  • jdbc/src/main/java/org/apache/zeppelin/jdbc/ValidationRequest.java
  • jdbc/src/main/java/org/apache/zeppelin/jdbc/ValidationResponse.java
  • zeppelin-web/src/components/websocket/websocket-event.factory.js

Walkthrough

The changes implement deterministic per-URL JDBC connection pool management using SHA-256-based pool naming, add per-statement URL validation with optional dynamic URL override capabilities, and enhance validation request/response structures to support JDBC URL handling. WebSocket initialization configuration is also updated.

Changes

Cohort / File(s) Summary
JDBC Pool Management
jdbc/src/main/java/org/apache/zeppelin/jdbc/JDBCInterpreter.java, jdbc/src/main/java/org/apache/zeppelin/jdbc/JDBCUserConfigurations.java
Introduces deterministic pool naming via buildPoolName() using SHA-256, new per-URL closeDBPool(user, url) overload, updated getJDBCDriverName() to accept url parameter, shared PoolingDriver reuse per user, per-URL pool tracking with registeredPools set, and new public APIs: saveDBDriverPool(), getPoolingDriver(), removePoolName(), isConnectionInDBDriverPool(). Adds per-statement URL validation flow and connection lifecycle tracking via currentConnectionUrl variable.
Validation Protocol
jdbc/src/main/java/org/apache/zeppelin/jdbc/ValidationRequest.java, jdbc/src/main/java/org/apache/zeppelin/jdbc/ValidationResponse.java
Extends ValidationRequest with rawJdbcUrl field and constructor parameter. Adds rawJdbcUrl and newJdbcUrl fields to ValidationResponse with accessor methods and JSON parsing logic to support dynamic URL validation responses.
WebSocket Configuration
zeppelin-web/src/components/websocket/websocket-event.factory.js
Updates WebSocket initialization from separate property assignment to consolidated options object, adding useApplyAsync flag alongside existing reconnectIfNotNormalClose option.

Sequence Diagram(s)

sequenceDiagram
    participant Executor
    participant JDBCInterpreter
    participant ValidationAPI as Validation API
    participant PoolManager as Pool Manager
    participant Database

    Executor->>JDBCInterpreter: executeSql(statement)
    JDBCInterpreter->>ValidationAPI: POST ValidationRequest(query, user, url)
    ValidationAPI-->>JDBCInterpreter: ValidationResponse(newJdbcUrl)
    
    alt URL Changed
        JDBCInterpreter->>PoolManager: closeConnection(oldUrl)
        JDBCInterpreter->>PoolManager: buildPoolName(user, newUrl)
    else URL Unchanged
        JDBCInterpreter->>PoolManager: buildPoolName(user, originalUrl)
    end
    
    PoolManager->>PoolManager: Check isConnectionInDBDriverPool(poolName)
    
    alt Pool Exists
        PoolManager-->>JDBCInterpreter: getConnectionFromPool(poolName)
    else Pool Missing
        PoolManager->>PoolManager: createConnectionPool(poolName)
        PoolManager-->>JDBCInterpreter: newConnection
    end
    
    JDBCInterpreter->>Database: execute(statement)
    Database-->>JDBCInterpreter: result
    JDBCInterpreter->>PoolManager: commitTransaction()
    JDBCInterpreter-->>Executor: result
Loading

Comment @coderabbitai help to get the list of available commands and usage tips.

@Vishvas-meesho Vishvas-meesho merged commit 8e5d0b9 into master Mar 3, 2026
0 of 62 checks passed
@semgrep-sast-meesho
Copy link

Semgrep found 1 formatted-sql-string finding:

  • jdbc/src/main/java/org/apache/zeppelin/jdbc/JDBCInterpreter.java

Detected a formatted string in a SQL statement. This could lead to SQL injection if variables in the SQL statement are not properly sanitized. Use a prepared statements (java.sql.PreparedStatement) instead. You can obtain a PreparedStatement using 'connection.prepareStatement'.

View Dataflow Graph
flowchart LR
    classDef invis fill:white, stroke: none
    classDef default fill:#e7f5ff, color:#1c7fd6, stroke: none

    subgraph File0["<b>jdbc/src/main/java/org/apache/zeppelin/jdbc/JDBCInterpreter.java</b>"]
        direction LR
        %% Source

        subgraph Source
            direction LR

            v0["<a href=https://github.com/Meesho/zeppelin/blob/2d10fdec29d21b77cad030d0ebdd10e0f5a0fb50/jdbc/src/main/java/org/apache/zeppelin/jdbc/JDBCInterpreter.java#L451 target=_blank style='text-decoration:none; color:#1c7fd6'>[Line: 451] url</a>"]
        end
        %% Intermediate

        subgraph Traces0[Traces]
            direction TB

            v2["<a href=https://github.com/Meesho/zeppelin/blob/2d10fdec29d21b77cad030d0ebdd10e0f5a0fb50/jdbc/src/main/java/org/apache/zeppelin/jdbc/JDBCInterpreter.java#L456 target=_blank style='text-decoration:none; color:#1c7fd6'>[Line: 456] urlHash</a>"]

            v3["<a href=https://github.com/Meesho/zeppelin/blob/2d10fdec29d21b77cad030d0ebdd10e0f5a0fb50/jdbc/src/main/java/org/apache/zeppelin/jdbc/JDBCInterpreter.java#L454 target=_blank style='text-decoration:none; color:#1c7fd6'>[Line: 454] hex</a>"]

            v4["<a href=https://github.com/Meesho/zeppelin/blob/2d10fdec29d21b77cad030d0ebdd10e0f5a0fb50/jdbc/src/main/java/org/apache/zeppelin/jdbc/JDBCInterpreter.java#L451 target=_blank style='text-decoration:none; color:#1c7fd6'>[Line: 451] hash</a>"]

            v5["<a href=https://github.com/Meesho/zeppelin/blob/2d10fdec29d21b77cad030d0ebdd10e0f5a0fb50/jdbc/src/main/java/org/apache/zeppelin/jdbc/JDBCInterpreter.java#L466 target=_blank style='text-decoration:none; color:#1c7fd6'>[Line: 466] buildPoolName</a>"]

            v6["<a href=https://github.com/Meesho/zeppelin/blob/2d10fdec29d21b77cad030d0ebdd10e0f5a0fb50/jdbc/src/main/java/org/apache/zeppelin/jdbc/JDBCInterpreter.java#L645 target=_blank style='text-decoration:none; color:#1c7fd6'>[Line: 645] getJDBCDriverName</a>"]

            v7["<a href=https://github.com/Meesho/zeppelin/blob/2d10fdec29d21b77cad030d0ebdd10e0f5a0fb50/jdbc/src/main/java/org/apache/zeppelin/jdbc/JDBCInterpreter.java#L645 target=_blank style='text-decoration:none; color:#1c7fd6'>[Line: 645] jdbcDriver</a>"]

            v8["<a href=https://github.com/Meesho/zeppelin/blob/2d10fdec29d21b77cad030d0ebdd10e0f5a0fb50/jdbc/src/main/java/org/apache/zeppelin/jdbc/JDBCInterpreter.java#L707 target=_blank style='text-decoration:none; color:#1c7fd6'>[Line: 707] getConnectionFromPool</a>"]

            v9["<a href=https://github.com/Meesho/zeppelin/blob/2d10fdec29d21b77cad030d0ebdd10e0f5a0fb50/jdbc/src/main/java/org/apache/zeppelin/jdbc/JDBCInterpreter.java#L707 target=_blank style='text-decoration:none; color:#1c7fd6'>[Line: 707] connection</a>"]

            v10["<a href=https://github.com/Meesho/zeppelin/blob/2d10fdec29d21b77cad030d0ebdd10e0f5a0fb50/jdbc/src/main/java/org/apache/zeppelin/jdbc/JDBCInterpreter.java#L982 target=_blank style='text-decoration:none; color:#1c7fd6'>[Line: 982] getConnection</a>"]

            v11["<a href=https://github.com/Meesho/zeppelin/blob/2d10fdec29d21b77cad030d0ebdd10e0f5a0fb50/jdbc/src/main/java/org/apache/zeppelin/jdbc/JDBCInterpreter.java#L982 target=_blank style='text-decoration:none; color:#1c7fd6'>[Line: 982] connection</a>"]

            v12["<a href=https://github.com/Meesho/zeppelin/blob/2d10fdec29d21b77cad030d0ebdd10e0f5a0fb50/jdbc/src/main/java/org/apache/zeppelin/jdbc/JDBCInterpreter.java#L1005 target=_blank style='text-decoration:none; color:#1c7fd6'>[Line: 1005] statement</a>"]
        end
            v2 --> v3
            v3 --> v4
            v4 --> v5
            v5 --> v6
            v6 --> v7
            v7 --> v8
            v8 --> v9
            v9 --> v10
            v10 --> v11
            v11 --> v12
        %% Sink

        subgraph Sink
            direction LR

            v1["<a href=https://github.com/Meesho/zeppelin/blob/2d10fdec29d21b77cad030d0ebdd10e0f5a0fb50/jdbc/src/main/java/org/apache/zeppelin/jdbc/JDBCInterpreter.java#L1026 target=_blank style='text-decoration:none; color:#1c7fd6'>[Line: 1026] statement.execute(statementPrecode)</a>"]
        end
    end
    %% Class Assignment
    Source:::invis
    Sink:::invis

    Traces0:::invis
    File0:::invis

    %% Connections

    Source --> Traces0
    Traces0 --> Sink

Loading

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants