# US 2023/0409556 A1 · Techniques for synchronous access to database replicas

> Agents: this data is available as JSON from the patentgrep API and MCP server — see https://patentgrep.com/llms.txt

- Number: US 2023/0409556 A1
- Document ID: US20230409556A1
- Status: Published application
- Kind: A1
- Application number: 17/804,701
- Filed: 2022-05-31
- Published: 2023-12-21
- Earliest claimed: 2022-05-31
- Assignees: GONG.io Ltd.
- Applicants: GONG.io Ltd.
- Inventors: Zohar SHAY; Golan LEVY; Elad SWISA
- Web page: https://patentgrep.com/patent/US20230409556A1

## CPC

- G06F 16/2365: {Ensuring data consistency and integrity}
- G06F 16/2322: {using timestamps}
- G06F 16/2379: {Updates performed during online database operations; commit processing}
- G06F 16/275: {Synchronous replication}
- G06F 16/284: {Relational databases}
- G06F: ELECTRIC DIGITAL DATA PROCESSING (computer systems based on specific computational models G06N)

## Abstract

A method and system for providing consistency in read-after-write operations in a multi-replica relational database system (RDS) are provided. The method includes receiving a read transaction to read data from a database (DB) replica of the multi-replica RDS; obtaining counter values of DB replicas in the multi-replica RDS, a counter value of determines a current version of recent data stored in the respective DB replica; determining a write replica out of the DB replicas in the multi-replica RDS; determining if there is an available read replica, a read replica is a replica other than the determined write replica having counter value at least equals to a counter value of the write replica; and waiting, when there is no available read replica, a preconfigured time window to allow all replicas to synchronize with the write replica; and reading the data from a read replica when the preconfigured time window has elapsed.

## Claims

### Claim 1

A method for providing consistency in read-after-write operations in a multi-replica relational database system (RDS), comprising:
receiving a read transaction to read data from a database (DB) replica of the multi-replica RDS;
obtaining counter values of DB replicas in the multi-replica RDS, wherein a counter value of a DB replica in the multi-replica RDS determines a current version of recent data stored in the respective DB replica;
determining a write replica out of the DB replicas in the multi-replica RDS;
determining if there is an available read replica, wherein a read replica is a replica other than the determined write replica having counter value at least equals to a counter value of the write replica;
waiting, when there is no available read replica, a preconfigured time window to allow all replicas to synchronize with the write replica; and
reading the data from a read replica when the preconfigured time window has elapsed.

### Claim 2 (depends on 1)

The method of claim 1, wherein determining the write replica further comprises:
selecting a DB replica having the maximum counter value as the write replica.

### Claim 3 (depends on 1)

The method of claim 1, further comprising:
reading from the write replica when there is no available read replica, after the preconfigured time window has elapsed.

### Claim 4 (depends on 3)

The method of claim 3, further comprising:
returning the data read from either the write replica or read replica to an application server requesting the read transaction.

### Claim 5 (depends on 1)

The method of claim 1, wherein the read transaction is posted to an SQL engine.

### Claim 6 (depends on 5)

The method of claim 5, wherein the SQL engine is any one of: MySQL and PostgreSQL.

### Claim 7 (depends on 1)

The method of claim 1, wherein the preconfigured time window is shorter than a watchdog timer in the multi-replica RDS.

### Claim 8 (depends on 1)

The method of claim 1, wherein the preconfigured time window is set based on an update time parameter set by the multi-replica RDS.

### Claim 9 (depends on 1)

The method of claim 1, wherein the read transaction is received substantially received after a completion of a write transaction in the multi-replica RDS.

### Claim 10

A non-transitory computer readable medium having stored thereon instructions for causing a processing circuitry to execute a process for providing consistency in read-after-write operations in a multi-replica relational database system (RDS), the process comprising:
receiving a read transaction to read data from a database (DB) replica of the multi-replica RDS;
obtaining counter values of DB replicas in the multi-replica RDS, wherein a counter value of a DB replica in the multi-replica RDS determines a current version of recent data stored in the respective DB replica;
determining a write replica out of the DB replicas in the multi-replica RDS;
determining if there is an available read replica, wherein a read replica is a replica other than the determined write replica having counter value at least equals to a counter value of the write replica;
waiting, when there is no available read replica, a preconfigured time window to allow all replicas to synchronize with the write replica; and
reading the data from a read replica when the preconfigured time window has elapsed.

### Claim 11

A controller for providing consistency in read-after-write operations in a multi-replica relational database system (RDS), comprising:
a processing circuitry; and
a memory, the memory containing instructions that, when executed by the processing circuitry, configure the controller to:
receive a read transaction to read data from a database (DB) replica of the multi-replica RDS;
obtain counter values of DB replicas in the multi-replica RDS, wherein a counter value of a DB replica in the multi-replica RDS determines a current version of recent data stored in the respective DB replica;
determine a write replica out of the DB replicas in the multi-replica RDS;
determine if there is an available read replica, wherein a read replica is a replica other than the determined write replica having counter value at least equals to a counter value of the write replica;
wait, when there is no available read replica, a preconfigured time window to allow all replicas to synchronize with the write replica; and
read the data from a read replica when the preconfigured time window has elapsed.

### Claim 12 (depends on 11)

The controller of claim 11, wherein the controller is further configured to:
select a DB replica having the maximum counter value as the write replica.

### Claim 13 (depends on 11)

The controller of claim 11, wherein the controller is further configured to:
read from the write replica when there is no available read replica, after the preconfigured time window has elapsed.

### Claim 14 (depends on 11)

The controller of claim 11, wherein the controller is further configured to:
return the data read from either the write replica or read replica to an application server requesting the read transaction.

### Claim 15 (depends on 11)

The controller of claim 11, wherein the read transaction is posted to an SQL engine.

### Claim 16 (depends on 15)

The controller of claim 15, wherein the SQL engine is any one of: MySQL and PostgreSQL.

### Claim 17 (depends on 11)

The controller of claim 11, wherein the preconfigured time window is shorter than a watchdog timer in the multi-replica RDS.

### Claim 18 (depends on 11)

The controller of claim 11, wherein the preconfigured time window is set based on an update time parameter set by the multi-replica RDS.

### Claim 19 (depends on 11)

The controller of claim 11, wherein the read transaction is received substantially received after a completion of a write transaction in the multi-replica RDS.

### Claim 20 (depends on 11)

The controller of claim 11, wherein the controller is integrated in the multi-replica relational database system (RDS).
