# US 2020/0004734 A1 · Multi-master data replication in a distributed multi-tenant system

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

- Number: US 2020/0004734 A1
- Document ID: US20200004734A1
- Status: Published application
- Kind: A1
- Application number: 16/566,613
- Filed: 2019-09-10
- Published: 2020-01-02
- Earliest claimed: 2011-04-11
- Assignees: salesforce.com, inc.
- Applicants: Salesforce.com, Inc.
- Inventors: Ian Varley; Scott Hansma; Paul Burstein
- Web page: https://patentgrep.com/patent/US20200004734A1

## CPC

- G06F 16/2322: {using timestamps}
- G06F 16/2379: {Updates performed during online database operations; commit processing}
- G06F 16/27: Replication, distribution or synchronisation of data between databases or within a distributed database system; Distributed database system architectures therefor
- G06F 16/273: {Asynchronous replication or reconciliation}
- G06F 16/275: {Synchronous replication}
- G06F 16/93: Document management systems
- G06F 16/9535: Search customisation based on user profiles and personalisation
- G06F 16/954: Navigation, e.g. using categorised browsing
- G06F: ELECTRIC DIGITAL DATA PROCESSING (computer systems based on specific computational models G06N)

## Abstract

A multi-master replication system is disclosed. The multi-master replication system allows a large set of peer instances to collaboratively replicate data to each other. According to an example, a change detection thread running on a first server associated with a first instance of multiple instances of a replicated database monitors for changes to any of multiple records within one or more shared tables of the replicated database. Responsive to detection of a change to a record, an item is stored by the change detection thread onto a queue containing information regarding the change. Groups of changes are packaged into multiple chunks, in which each chunk (i) corresponds to a discrete unit of progress for both change detection and transport; (ii) is associated with multiple changed records; (iii) contains metadata about the multiple changed records; and (iv) does not contain data from the one or more shared tables.

## Claims

### Claim 1

A method comprising:
monitoring, by a change detection thread running on a first server associated with a first instance of a plurality of instances of a replicated database, for changes to any of a plurality of records within one or more shared tables of the replicated database;
responsive to detection of a change to a record of the plurality of records, storing, by the change detection thread, an item onto a queue containing information regarding the change; and
packaging groups of changes into a plurality of chunks, wherein each chunk of the plurality of chunks:
corresponds to a discrete unit of progress for both change detection and transport;
is associated with a plurality of changed records;
contains metadata about the plurality of changed records; and
does not contain data from the one or more shared tables.

### Claim 2 (depends on 1)

The method of claim 1, wherein said packaging comprises:
periodically aggregating, by an indexer thread running on the first server, information regarding the plurality of changed records that have been committed since a previous execution of the indexer thread into a first chunk of the plurality of chunks and initializing the metadata contained therein by pulling items from the queue; and
completing, by a replication process running on the first server, the metadata based on a first changed record and a last changed record of the plurality of changed records and persisting the first chunk locally.

### Claim 3 (depends on 2)

The method of claim 2, further comprising facilitating, by the first server, replication of changed records to a second instance of the plurality of instances by:
receiving, from a second server associated with the second instance, a first request for a set of chunks, wherein the request includes one or more specified conditions;
responsive to the first request, returning, to the second server, those of the plurality of chunks containing metadata satisfying the one or more specified conditions;
receiving, from the second server, a second request for underlying data for a particular chunk of the plurality of chunks; and
responsive to the second request, returning, to the second server, the underlying data.

### Claim 4 (depends on 1)

The method of claim 1, wherein the metadata includes an identifier of the first instance, an entity type associated with the plurality of changed records, information identifying a partition of the one or more shared tables affected by the plurality of changed records and timestamp boundaries indicative of the plurality of changed records associated with the chunk.

### Claim 5 (depends on 1)

The method of claim 1, wherein the timestamp boundaries include a first timestamp indicating an earliest time at which the plurality of records was modified and a second timestamp indicating a latest time at which the plurality of records was modified.

### Claim 6 (depends on 5)

The method of claim 5, wherein the timestamp boundaries of a first chunk of the plurality of chunks overlap the timestamp boundaries of a second chunk of the plurality of chunks.

### Claim 7 (depends on 6)

The method of claim 6, wherein the first timestamp of a first chunk of the plurality of chunks lies between the timestamp boundaries of a second chunk of the plurality of chunks.

### Claim 8 (depends on 6)

The method of claim 6, wherein the second timestamp of a first chunk of the plurality of chunks lies between the timestamp boundaries of a second chunk of the plurality of chunks.

### Claim 9 (depends on 6)

The method of claim 6, wherein the timestamp boundaries of a first chunk of the plurality of chunks encompass the timestamp boundaries of a second chunk of the plurality of chunks.

### Claim 10 (depends on 6)

The method of claim 6, wherein said overlap is as a result of one of the plurality of changed records associated with the second chunk committing after all of the plurality of changed records associated with the first chunk.

### Claim 11

An article of manufacture comprising a computer-readable medium having stored thereon instructions that, when executed by one or more processors of a server associated with a first instance of a plurality of instances of a replicated database, cause the one or more processors to:
monitor for changes to any of a plurality of records within one or more shared tables of the replicated database;
responsive to detection of a change to a record of the plurality of records, storing an item onto a queue containing information regarding the change; and
packaging groups of changes into a plurality of chunks, wherein each chunk of the plurality of chunks:
corresponds to a discrete unit of progress for both change detection and transport;
is associated with a plurality of changed records;
contains metadata about the plurality of changed records; and
does not contain data from the one or more shared tables.

### Claim 12 (depends on 11)

The article of claim 11, wherein said packaging comprises:
periodically aggregating, by an indexer thread, information regarding the plurality of changed records that have been committed since a previous execution of the indexer thread into a first chunk of the plurality of chunks and initializing the metadata contained therein by pulling items from the queue; and
completing the metadata based on a first changed record and a last changed record of the plurality of changed records and persisting the first chunk locally.

### Claim 13 (depends on 12)

The article of claim 12, further comprising facilitating replication of changed records to a second instance of the plurality of instances by:
receiving, from a second server associated with the second instance, a first request for a set of chunks, wherein the request includes one or more specified conditions;
responsive to the first request, returning, to the second server, those of the plurality of chunks containing metadata satisfying the one or more specified conditions;
receiving, from the second server, a second request for underlying data for a particular chunk of the plurality of chunks; and
responsive to the second request, returning, to the second server, the underlying data.

### Claim 14 (depends on 11)

The article of claim 11, wherein the metadata includes an identifier of the first instance, an entity type associated with the plurality of changed records, information identifying a partition of the one or more shared tables affected by the plurality of changed records and timestamp boundaries indicative of the plurality of changed records associated with the chunk.

### Claim 15 (depends on 11)

The article of claim 11, wherein the timestamp boundaries include a first timestamp indicating an earliest time at which the plurality of records was modified and a second timestamp indicating a latest time at which the plurality of records was modified.

### Claim 16 (depends on 15)

The article of claim 15, wherein the timestamp boundaries of a first chunk of the plurality of chunks overlap the timestamp boundaries of a second chunk of the plurality of chunks.

### Claim 17 (depends on 16)

The article of claim 16, wherein the first timestamp of a first chunk of the plurality of chunks lies between the timestamp boundaries of a second chunk of the plurality of chunks.

### Claim 18 (depends on 16)

The article of claim 16, wherein the second timestamp of a first chunk of the plurality of chunks lies between the timestamp boundaries of a second chunk of the plurality of chunks.

### Claim 19 (depends on 16)

The article of claim 16, wherein the timestamp boundaries of a first chunk of the plurality of chunks encompass the timestamp boundaries of a second chunk of the plurality of chunks.

### Claim 20 (depends on 16)

The article of claim 16, wherein said overlap is as a result of one of the plurality of changed records associated with the second chunk committing after all of the plurality of changed records associated with the first chunk.
