OceanBase logo

OceanBase

A unified distributed database ready for your transactional, analytical, and AI workloads.

Product Overview
DEPLOY YOUR WAY

OceanBase Cloud

The best way to deploy and scale OceanBase

OceanBase Enterprise

Run and manage OceanBase on your infra

TRY OPEN SOURCE

OceanBase Community Edition

The free, open-source distributed database

OceanBase seekdb

Open source AI native search database

Customer Stories

Real-world success stories from enterprises across diverse industries.

View All
BY USE CASES

Mission-Critical Transactions

Global & Multicloud Application

Elastic Scaling for Peak Traffic

Real-time Analytics

Active Geo-redundancy

Database Consolidation

Resources

Comprehensive knowledge hub for OceanBase.

Blog

Live Demos

Training & Certification

Documentation

Official technical guides, tutorials, API references, and manuals for all OceanBase products.

View All
PRODUCTS

OceanBase Cloud

OceanBase Database

Tools

Connectors and Middleware

QUICK START

OceanBase Cloud

OceanBase Database

BEST PRACTICES

Practical guides for utilizing OceanBase more effectively and conveniently

Company

Learn more about OceanBase – our company, partnerships, and trust and security initiatives.

About OceanBase

Partner

Trust Center

Contact Us

International - English
中国站 - 简体中文
日本 - 日本語
Sign In
Start on Cloud

OceanBase

A unified distributed database ready for your transactional, analytical, and AI workloads.

Product Overview
DEPLOY YOUR WAY

OceanBase Cloud

The best way to deploy and scale OceanBase

OceanBase Enterprise

Run and manage OceanBase on your infra

TRY OPEN SOURCE

OceanBase Community Edition

The free, open-source distributed database

OceanBase seekdb

Open source AI native search database

Customer Stories

Real-world success stories from enterprises across diverse industries.

View All
BY USE CASES

Mission-Critical Transactions

Global & Multicloud Application

Elastic Scaling for Peak Traffic

Real-time Analytics

Active Geo-redundancy

Database Consolidation

Comprehensive knowledge hub for OceanBase.

Blog

Live Demos

Training & Certification

Documentation

Official technical guides, tutorials, API references, and manuals for all OceanBase products.

View All
PRODUCTS
OceanBase CloudOceanBase Database
ToolsConnectors and Middleware
QUICK START
OceanBase CloudOceanBase Database
BEST PRACTICES

Practical guides for utilizing OceanBase more effectively and conveniently

Learn more about OceanBase – our company, partnerships, and trust and security initiatives.

About OceanBase

Partner

Trust Center

Contact Us

Start on Cloud
编组
All Products
    • Databases
    • iconOceanBase Database
    • iconOceanBase Cloud
    • iconOceanBase Tugraph
    • iconInteractive Tutorials
    • iconOceanBase Best Practices
    • Tools
    • iconOceanBase Cloud Platform
    • iconOceanBase Migration Service
    • iconOceanBase Developer Center
    • iconOceanBase Migration Assessment
    • iconOceanBase Admin Tool
    • iconOceanBase Loader and Dumper
    • iconOceanBase Deployer
    • iconKubernetes operator for OceanBase
    • iconOceanBase Diagnostic Tool
    • iconOceanBase Binlog Service
    • Connectors and Middleware
    • iconOceanBase Database Proxy
    • iconEmbedded SQL in C for OceanBase
    • iconOceanBase Call Interface
    • iconOceanBase Connector/C
    • iconOceanBase Connector/J
    • iconOceanBase Connector/ODBC
    • iconOceanBase Connector/NET
icon

OceanBase Database Proxy

V4.2.0Community Edition

  • What is ODP?
  • Installation and deployment
    • Deploy ODP by using OBD
    • Deploy ODP by using OCP
    • Deploy ODP by using the CLI
    • Deployment modes
  • Basic operations
  • Configuration parameter
    • Parameter description
    • Dynamically modifiable parameters
    • Parameters that are not dynamically modifiable
    • Internal and inherited parameters
    • In-memory parameters
  • Connection management
    • Principles
    • Session status synchronization
    • Client session
    • Server session
  • Data routing
    • Factors affecting data routing
    • Routing strategies
    • ODP routing
    • Intra-tenant routing
    • Read/Write separation
    • Follower latency threshold
  • High availability mechanism
    • Overview
    • High availability of ODP services
    • High availability of OceanBase Database
    • High availability testing
  • Security and protocols
  • Operation and maintenance
    • Troubleshooting
      • Troubleshooting logic
      • Monitoring logs
    • Performance analysis
    • Show Trace

Download PDF

What is ODP? Deploy ODP by using OBD Deploy ODP by using OCP Deploy ODP by using the CLI Deployment modes Basic operations Parameter description Dynamically modifiable parameters Parameters that are not dynamically modifiable Internal and inherited parameters In-memory parameters Principles Session status synchronization Client session Server session Factors affecting data routing Routing strategies ODP routing Intra-tenant routing Read/Write separation Follower latency threshold Overview High availability of ODP services High availability of OceanBase Database High availability testing Security and protocols Troubleshooting logic Monitoring logs Performance analysis Show Trace
OceanBase logo

The Unified Distributed Database for the AI Era.

Follow Us
Products
OceanBase CloudOceanBase EnterpriseOceanBase Community EditionOceanBase seekdb
Resources
DocsBlogLive DemosTraining & Certification
Company
About OceanBaseTrust CenterLegalPartnerContact Us
Follow Us

© OceanBase 2026. All rights reserved

Cloud Service AgreementPrivacy PolicySecurity
Contact Us
Document Feedback
  1. Documentation Center
  2. OceanBase Database Proxy
  3. V4.2.0
iconOceanBase Database Proxy
V 4.2.0Community Edition
  • V 4.3.6
  • V 4.3.4
  • V 4.3.3
  • V 4.3.2
  • V 4.3.1
  • V 4.3.0
  • V 4.2.3
  • V 4.2.2
  • V 4.2.0 and earlier
Community Edition
  • V 4.2.0
  • V 4.1.0
  • V 4.0.0
  • V 3.1.0

Session status synchronization

Last Updated:2025-01-20 07:01:42  Updated
share
What is on this page
Purpose
Process

folded

share

This topic describes the purpose and process of OceanBase Database Proxy (ODP) session status synchronization.

Purpose

When a client establishes a connection to OceanBase Database through ODP, there is only one connection between the client and ODP and there may be multiple connections between ODP and OBServer nodes, as shown in the following figure. In other words, one client connection maps multiple server connections. To ensure the accuracy of execution results, the session status of multiple server connections must be consistent.

Session

As shown in the figure above, between the client and ODP, there is a session called Session0, which is perceived by the client. If the state of Session0 is not synchronized to Session1, Session2, or Session3, an error may occur when an SQL statement is executed.

To solve this problem, ODP introduces the versioning mechanism to ensure the status synchronization of the database, session variables, last_insert_id, and prepared statements. ODP will synchronize the state of Session0 (such as system variables, user variables, and transaction status) to Session1, Session2, and Session3 so that OBServer nodes can take correct actions based on the session status.

As an example to illustrate the problem caused by out-of-sync state, assuming that autocommit is set to 1 for the current cluster, execute the following statements:

set autocommit = 0;
insert into t1 values(1);
insert into t2 values(2);

The execution process is as follows:

  1. ODP sends the set autocommit = 0; statement to OBServer1.

  2. ODP sends the insert into t1 values(1); statement to OBServer1.

  3. ODP switches to the connection with OBServer2 and sends the insert into t2 values(2); statement to OBServer2.

Example

Since the connection status autocommit=0 is not synchronized to the session between ODP and OBServer2, the transaction is committed on OBServer2 after the third SQL statement insert into t2 values(2); is executed, but OBServer1 is still in the transaction. To avoid this issue, ODP must synchronize the value of the autocommit variable before sending the INSERT SQL statement to OBServer2.

Process

In this section, we demonstrate how ODP performs status synchronization by modifying session-level system variables.

  1. The client initiates a connection (Session0) with ODP, and ODP establishes a connection (Session1) with one of the OBServer nodes in the current cluster.

  2. Assuming that autocommit is set to 1 for the cluster, when the client sends the set autocommit = 0 statement to change the value of the system variable autocommit to 0, ODP records the change in Session0 and then forwards it to OBServer1 through Session1.

    Session1

  3. If the client sends an SQL statement to access the data on OBServer2, ODP parses the statement and establishes a connection (Session2) with OBServer2 upon receipt of the statement.

    Session2

  4. In Session0, the system variable autocommit is set to 0, while in Session2, the system variable remains at its default value of 1. In this case, ODP will override the value of AUTOCOMMIT=0 from Session0 to Session2 to ensure that the client's session status remains consistent with the server's session status.

    Synchronization

Previous topic

Principles
Last

Next topic

Client session
Next
What is on this page
Purpose
Process