IP Library Granted Patent US 12,001,409
Granted Patent B2
US 12,001,409 · App. 18/145,181 · Granted Jun 4, 2024

Merges using key range data structures

Inventors: Rohit Agrawal (San Francisco, CA); Aditya Shetty (San Francisco, CA); Kaushal Mittal (Dublin, CA); Terry Chong (Pleasanton, CA); Thomas Fanghaenel (Oakland, CA); Vaibhav Arora (San Francisco, CA)
Assignee: Salesforce, Inc.
G06F16/214G06F16/2246G06F21/6227
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 12,001,409
App. No.
18/145,181
Granted
Jun 4, 2024
Kind
B2
Abstract

Techniques are disclosed relating to merge operations for multi-level data structures, such as log-structured merge-trees (LSM trees). A computer system may store, in a database, a plurality of files as part of an LSM tree and a plurality of database key structures. A given one of the plurality of database key structures may indicate, for a corresponding one of the plurality of files, a set of key ranges derived from database records that are included in the corresponding file. The computer system may determine, using ones of the plurality of database key structures, a key range overlap that is indicative of an extent of overlap of key ranges from a set of the plurality of files with respect to a particular key range. Based on the determined key range overlap, the computer system may assign a priority level to a merge operation that involves the set of files.

Claims (42)

1. A method for performing a multi-level merge operation that involves at least three levels of a log-structured merge tree (LSM tree), the method comprising:

storing, by a computer system, files across a plurality of levels included in the LSM tree, wherein a given file stores a set of records associated with a set of database keys;

determining, by the computer system, to perform the multi-level merge operation for a particular merge key range; and

performing, by the computer system, the multi-level merge operation, including:

identifying levels of the LSM tree from which to copy records that fall within the particular merge key range into a target level of the LSM tree, wherein the identifying includes assessing a number of records contributed by ones of the plurality of levels for the particular merge key range and selecting sufficient levels for the multi-level merge operation to merge at least a threshold number of records into the target level, and wherein the identified levels include the at least three levels of the LSM tree; and

copying, from the identified levels, a set of records that fall within the particular merge key range into a file at the target level.

2. The method of claim 1 , wherein the multi-level merge operation is determined to be performed in place of a merge operation involving two levels in response to the computer system determining that a number of records contributed by two particular levels for the merge operation does not satisfy a threshold number of records.

3. The method of claim 1 , further comprising:

storing, by the computer system, a database key structure in association with a particular one of the identified levels, wherein the database key structure indicates, for a particular file of the particular identified level, a set of key ranges derived from a set of records stored in the particular file,

wherein the assessing includes determining a number of records that is contributed by the particular identified level based on an overlap between the particular merge key range and the set of key ranges identified by the database key structure.

4. The method of claim 3 , wherein the database key structure is a trie that includes a plurality of branches, a given one of which includes a set of linked nodes corresponding to a set of character values of a database key associated with a database record included in the particular file.

5. The method of claim 1 , further comprising:

assigning, by the computer system, a first priority level to the multi-level merge operation and a second priority level to a merge operation involving two levels of the LSM tree, wherein the first priority level and the second priority level are different priorities.

6. The method of claim 5 , further comprising:

creating, by the computer system, a work item to be processed to perform the multi-level merge operation, wherein the work item is associated with the first priority level that is assigned to the multi-level merge operation; and

enqueueing, by the computer system, the work item in a priority queue that orders work items according to priority level.

7. The method of claim 1 , wherein the particular merge key range corresponds to a key range of a particular file included in the identified levels of the LSM tree.

8. A non-transitory computer-readable medium having program instructions stored thereon that are capable of causing a computer system to perform operations comprising:

storing files across a plurality of levels included in an LSM tree, wherein a given file stores a set of records associated with a set of database keys;

determining to perform a multi-level merge operation for a particular merge key range; and

performing the multi-level merge operation, including:

identifying levels of the LSM tree from which to copy records that fall within the particular merge key range into a target level of the LSM tree, wherein the identifying includes assessing a number of records contributed by ones of the plurality of levels for the particular merge key range and selecting sufficient levels for the multi-level merge operation to merge at least a threshold number of records into the target level, and wherein the identified levels include at least three levels of the LSM tree; and

copying, from the identified levels, a set of records that fall within the particular merge key range into a file at the target level.

9. The non-transitory computer-readable medium of claim 8 , wherein the multi-level merge operation is determined to be performed in place of a merge operation involving two levels in response to the computer system determining that a number of records contributed by two particular levels for the merge operation does not satisfy a threshold number of records.

10. The non-transitory computer-readable medium of claim 8 , wherein the assessing includes:

determining, for a particular level of the levels, a number of records contributed by the particular level based on an overlap between the particular merge key range and a set of key ranges identified by a database key structure stored for the particular level.

11. The non-transitory computer-readable medium of claim 8 , wherein the operations further comprise:

assigning a first priority level to the multi-level merge operation; and

based on the first priority level, performing at least one other merge operation before the multi-level merge operation.

12. The non-transitory computer-readable medium of claim 8 , wherein the particular merge key range corresponds to a key range of a particular file included in the identified levels of the LSM tree.

13. A system, comprising:

at least one processor; and

memory having program instructions stored therein that are executable by the at least one processor to cause the system to perform operations comprising:

storing files across a plurality of levels included in an LSM tree, wherein a given file stores a set of records associated with a set of database keys;

determining to perform a multi-level merge operation for a particular merge key range; and

performing the multi-level merge operation, including:

identifying levels of the LSM tree from which to copy records that fall within the particular merge key range into a target level of the LSM tree, wherein the identifying includes assessing a number of records contributed by ones of the plurality of levels for the particular merge key range and selecting sufficient levels for the multi-level merge operation to merge at least a threshold number of records into the target level, and wherein the identified levels include at least three levels of the LSM tree; and

copying, from the identified levels, records that fall within the particular merge key range into a file at the target level.

14. The system of claim 13 , wherein the multi-level merge operation is determined to be performed in place of a merge operation involving two levels in response to the system determining that a number of records contributed by two particular levels for the merge operation does not satisfy a threshold number of records to be contributed to the target level.

15. The system of claim 13 , wherein the operations further comprise:

assigning a first priority level to the multi-level merge operation and a second priority level to a merge operation involving two levels of the LSM tree, wherein the multi-level merge operation and the merge operation are performed in an order defined by priority level.

16. The system of claim 13 , wherein the particular merge key range corresponds to a key range of a particular file included in the identified levels of the LSM tree.

Assignments (2)
CHANGE OF NAME Recorded Apr 26, 2024
From: SALESFORCE.COM, INC.
To: SALESFORCE, INC.
Reel/Frame 067244/0850 →
ASSIGNMENT OF ASSIGNOR'S INTEREST Recorded Dec 22, 2022
From: AGRAWAL, ROHIT; SHETTY, ADITYA; MITTAL, KAUSHAL; CHONG, TERRY; FANGHAENEL, THOMAS; ARORA, VAIBHAV
To: SALESFORCE.COM, INC.
Reel/Frame 062181/0626 →
Continuity (2)
Continuation 17009605 · Sep 1, 2020
Related Publication 20230141205A1 · May 11, 2023