IP Library Granted Patent US 11,232,089
Granted Patent B2
US 11,232,089 · App. 16/566,613 · Granted Jan 25, 2022

Multi-master data replication in a distributed multi-tenant system

Inventors: Ian Varley (Austin, TX); Scott Hansma (Burlingame, CA); Paul Burstein (San Francisco, CA)
Assignee: salesforce.com, Inc.
G06F16/2322G06F16/2379G06F16/27G06F16/273G06F16/93G06F16/954G06F16/9535
View Patent ↗
Loading inventors, assignments & file history…
Monitor This Case
Get email alerts when status or documents change.
Order Certified Copies
Most orders are placed with the USPTO same day — all within 24 business hours.
Order via The Patent Place →
Pre-filled with this patent's details
Quick Facts
Patent No.
US 11,232,089
App. No.
16/566,613
Granted
Jan 25, 2022
Kind
B2
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 (65)

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, represented by multiple items on the queue, 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, wherein the metadata includes timestamp boundaries indicative of the plurality of changed records associated with the chunk, and wherein the timestamp boundaries include a first timestamp indicating an earliest time at which the plurality of changed records was modified and a second timestamp indicating a latest time at which the plurality of changed records was modified; and

does not contain data from the one or more shared tables; and

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.

2. 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 particular 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.

3. 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.

4. 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.

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

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

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

8. The method of claim 1 , 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.

9. An article of manufacture comprising a non-transitory 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, store an item onto a queue containing information regarding the change; and

package groups of changes, represented by multiple items on the queue, 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, wherein the metadata includes timestamp boundaries indicative of the plurality of changed records associated with the chunk, and wherein the timestamp boundaries include a first timestamp indicating an earliest time at which the plurality of changed records was modified and a second timestamp indicating a latest time at which the plurality of changed records was modified; and

does not contain data from the one or more shared tables; and

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.

10. The article of claim 9 , wherein packaging the groups of changes 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.

11. The article of claim 10 , wherein the instructions further cause the one or more processors to facilitate 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.

12. The article of claim 9 , 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.

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

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

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

16. The article of claim 11 , 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.

17. A system comprising:

a processor; and

a non-transitory computer-readable medium, coupled to the processing resource, having stored therein instructions that when executed by the processor cause the processor to:

monitor for changes to any of a plurality of records within one or more shared tables of a first instance of a plurality of instances of a replicated database;

responsive to detection of a change to a record of the plurality of records, store an item onto a queue containing information regarding the change; and

package groups of changes, represented by multiple items on the queue, 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, wherein the metadata includes timestamp boundaries indicative of the plurality of changed records associated with the chunk, and wherein the timestamp boundaries include a first timestamp indicating an earliest time at which the plurality of changed records was modified and a second timestamp indicating a latest time at which the plurality of changed records was modified; and

does not contain data from the one or more shared tables;

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; and

wherein the overlap is as a result of a long-running transaction involving 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.

18. The system of claim 17 , wherein packaging the groups of changes 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.

19. The system of claim 18 , wherein the instructions further cause the processor to facilitate 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.

20. The system of claim 17 , 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.

Assignments (2)
CHANGE OF NAME Recorded Dec 18, 2024
From: SALESFORCE.COM, INC.
To: SALESFORCE, INC.
Reel/Frame 069717/0444 →
ASSIGNMENT OF ASSIGNOR'S INTEREST Recorded Oct 24, 2019
From: VARLEY, IAN; HANSMA, SCOTT; BURSTEIN, PAUL
To: SALESFORCE.COM, INC.
Reel/Frame 050815/0488 →
Continuity (4)
Continuation 15198411 · Jun 30, 2016
Continuation 13252214 · Oct 4, 2011
Provisional Application 61474157 · Apr 11, 2011
Related Publication 20200004734A1 · Jan 2, 2020