IP Library Granted Patent US 12,657,181
Granted Patent B2
US 12,657,181 · App. 18/313,834 · Granted Jun 16, 2026

Fencing mechanism of statements for distributed multi-version concurrency control

Inventors: Nikolaos Romanos Katsipoulakis (Redwood City, CA); Alexander Miller (San Mateo, CA)
Assignee: Snowflake Inc.
G06F16/2379G06F16/22G06F16/2282G06F16/2329G06F16/2343G06F16/2365
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,657,181
App. No.
18/313,834
Granted
Jun 16, 2026
Kind
B2
Abstract

The subject technology determines that a request to commit a transaction has been received. The subject technology prior to committing the transaction, performs a write operation to store a metadata version of a table associated with the transaction in a metastore. The subject technology performs a register operation to register a background worker. The subject technology performs, by the background worker, a trigger operation to perform an execution node job on an execution node. The subject technology retrieves, by the execution node job, a set of identifiers of active transactions. The subject technology performs, by the execution node job, a write operation to store the metadata version of the table and the set of identifiers in a datastore. The subject technology receives, by the background worker, an indication that the execution node job has successfully completed. The subject technology performs an unlock operation to unlock the table.

Claims (80)

1 . A system comprising:

at least one hardware processor; and

a memory storing instructions that cause the at least one hardware processor to perform operations comprising:

determining that a request to commit a transaction has been received;

prior to committing the transaction and after receiving the request to commit the transaction, performing a write operation to store a metadata version of a table associated with the transaction in a metastore;

performing as part of performing the request to commit the transaction, by a compute service manager, a register operation to register a background worker, the background worker being initiated by a fencing manager provided by the compute service manager, the fencing manager being a different component from a transaction manager provided by the compute service manager;

performing, by the background worker, a trigger operation to perform an execution node job on an execution node;

retrieving, by the execution node job, a set of identifiers of active transactions;

performing, by the execution node job, a metadata version validation process comprising:

retrieving a first metadata version, stored in a table persistence object, of the table in the metastore;

retrieving a second metadata version of the table from a datastore;

comparing the first metadata version with the second metadata version;

determining whether the metadata version validation process fails when the first metadata version is less than the second metadata version, and a read timestamp associated with the transaction is not earlier than a write timestamp associated with the second metadata version; and

determining that the metadata version validation process is successful when determining that the metadata version validation process does not fail;

performing, by the execution node job, a write operation to store the metadata version of the table and the set of identifiers in the datastore;

receiving, by the background worker, an indication that the execution node job has successfully completed; and

performing, by the background worker, an unlock operation to unlock the table.

2 . The system of claim 1 , wherein the metastore comprises a metadata database, the datastore comprises a distributed database provided by a storage platform, and a workload analyzer provided by the compute service manager is different from the fencing manager.

3 . The system of claim 1 , wherein prior to performing the execution node job, performing a statement fencing process, the statement fencing process comprising at least performing the write operation to store the metadata version of the table associated with the transaction in the metastore.

4 . The system of claim 3 , wherein the statement fencing process is performed by an execution node worker.

5 . The system of claim 1 ,

wherein determining that the metadata version validation process fails further comprises:

determining that the second metadata version is found in the datastore;

determining that the first metadata version is less than the second metadata version; and

determining that a read timestamp associated with the transaction is not earlier than a write timestamp associated with the second metadata version.

6 . The system of claim 1 , wherein the operations further comprise:

after determining that the metadata version validation process fails, aborting a statement associated with the transaction; and

re-compiling the statement with an updated metadata version.

7 . The system of claim 1 , wherein the operations further comprise:

after retrieving the set of identifiers of active transactions, waiting until each active transaction associated with the set of identifiers has completed.

8 . The system of claim 1 , wherein the operations further comprise:

after receiving the indication that the execution node job has successfully completed, updating a flag in the metastore indicating that a statement fencing process has been successfully performed for the table, the statement fencing process comprising at least performing the write operation to store the metadata version of the table associated with the transaction in the metastore, and updating the flag in the metastore is performed by a driver provided by the compute service manager.

9 . A method comprising:

determining that a request to commit a transaction has been received;

prior to committing the transaction and after receiving the request to commit the transaction, performing a write operation to store a metadata version of a table associated with the transaction in a metastore;

performing as part of performing the request to commit the transaction, by a compute service manager, a register operation to register a background worker, the background worker being initiated by a fencing manager provided by the compute service manager, the fencing manager being a different component from a transaction manager provided by the compute service manager;

performing, by the background worker, a trigger operation to perform an execution node job on an execution node;

retrieving, by the execution node job, a set of identifiers of active transactions;

performing, by the execution node job, a metadata version validation process comprising:

retrieving a first metadata version, stored in a table persistence object, of the table in the metastore;

retrieving a second metadata version of the table from a datastore;

comparing the first metadata version with the second metadata version;

determining whether the metadata version validation process fails when the first metadata version is less than the second metadata version, and a read timestamp associated with the transaction is not earlier than a write timestamp associated with the second metadata version; and

determining that the metadata version validation process is successful when determining that the metadata version validation process does not fail;

performing, by the execution node job, a write operation to store the metadata version of the table and the set of identifiers in a datastore;

receiving, by the background worker, an indication that the execution node job has successfully completed; and

performing, by the background worker, an unlock operation to unlock the table.

10 . The method of claim 9 , wherein the metastore comprises a metadata database, and the datastore comprises a distributed database provided by a storage platform.

11 . The method of claim 9 , wherein prior to performing the execution node job, performing a statement fencing process, the statement fencing process comprising at least performing the write operation to store the metadata version of the table associated with the transaction in the metastore.

12 . The method of claim 11 , wherein the statement fencing process is performed by an execution node worker.

13 . The method of claim 9 ,

wherein determining that the metadata version validation process fails further comprises:

determining that the second metadata version is found in the datastore;

determining that the first metadata version is less than the second metadata version; and

determining that a read timestamp associated with the transaction is not earlier than a write timestamp associated with the second metadata version.

14 . The method of claim 9 , further comprising:

after determining that the metadata version validation process fails, aborting a statement associated with the transaction; and

re-compiling the statement with an updated metadata version.

15 . The method of claim 9 , further comprising:

after retrieving the set of identifiers of active transactions, waiting until each active transaction associated with the set of identifiers has completed.

16 . The method of claim 9 , further comprising:

after receiving the indication that the execution node job has successfully completed, updating a flag in the metastore indicating that a statement fencing process has been successfully performed for the table, the statement fencing process comprising at least performing the write operation to store the metadata version of the table associated with the transaction in the metastore, and updating the flag in the metastore is performed by a driver provided by the compute service manager.

17 . A non-transitory computer-storage medium comprising instructions that, when executed by one or more processors of a machine, configure the machine to perform operations comprising:

determining that a request to commit a transaction has been received;

prior to committing the transaction and after receiving the request to commit the transaction, performing a write operation to store a metadata version of a table associated with the transaction in a metastore;

performing as part of performing the request to commit the transaction, by a compute service manager, a register operation to register a background worker, the background worker being initiated by a fencing manager provided by the compute service manager, the fencing manager being a different component from a transaction manager provided by the compute service manager;

performing, by the background worker, a trigger operation to perform an execution node job on an execution node;

retrieving, by the execution node job, a set of identifiers of active transactions;

performing, by the execution node job, a metadata version validation process comprising:

retrieving a first metadata version, stored in a table persistence object, of the table in the metastore; and

retrieving a second metadata version of the table from a datastore;

comparing the first metadata version with the second metadata version;

determining whether the metadata version validation process fails when the first metadata version is less than the second metadata version, and a read timestamp associated with the transaction is not earlier than a write timestamp associated with the second metadata version; and

determining that the metadata version validation process is successful when determining that the metadata version validation process does not fail;

performing, by the execution node job, a write operation to store the metadata version of the table and the set of identifiers in a datastore;

receiving, by the background worker, an indication that the execution node job has successfully completed; and

performing, by the background worker, an unlock operation to unlock the table.

18 . The system of claim 1 , wherein performing, by the background worker, the trigger operation to perform the execution node job on the execution node comprises:

determining that the metastore is unavailable; and

in response to determining that the metastore is unavailable, re-executing the execution node job.

Assignments (1)
ASSIGNMENT OF ASSIGNOR'S INTEREST Recorded Oct 6, 2023
From: KATSIPOULAKIS, NIKOLAOS ROMANOS; MILLER, ALEXANDER
To: SNOWFLAKE INC.
Reel/Frame 065148/0898 →
Continuity (2)
Continuation 18313768 · May 8, 2023
Related Publication 20240378187A1 · Nov 14, 2024
References Cited (31)
US 7272589B1 · Guay et al. · 2007 [cited by applicant]
US 8635271B1 · Adya · 2014 [cited by examiner]
US 11327937B1 · Muniswamy Reddy et al. · 2022 [cited by applicant]
US 11853321B1 · Kumar · 2023 [cited by examiner]
US 20090037366A1 · Shankar · 2009 [cited by examiner]
US 20090037417A1 · Shankar et al. · 2009 [cited by applicant]
US 20090240895A1 · Nyland et al. · 2009 [cited by applicant]
US 20090240896A1 · Kang · 2009 [cited by applicant]
US 20100228764A1 · Sallakonda et al. · 2010 [cited by applicant]
US 20110185358A1 · Ostrovsky · 2011 [cited by examiner]
US 20120066670A1 · Mccarthy · 2012 [cited by examiner]
US 20120330964A1 · Baude et al. · 2012 [cited by applicant]
US 20150052104A1 · Shadmon · 2015 [cited by applicant]
US 20150278275A1 · Kumar · 2015 [cited by examiner]
US 20150319265A1 · DeRoo · 2015 [cited by examiner]
US 20160378822A1 · Jovanovic et al. · 2016 [cited by applicant]
US 20180322156A1 · Lee · 2018 [cited by examiner]
US 20180365114A1 · Horowitz · 2018 [cited by examiner]
US 20200356815A1 · Ioannou · 2020 [cited by examiner]
US 20220092051A1 · Miller · 2022 [cited by examiner]
US 20230297414A1 · Chen · 2023 [cited by examiner]
“U.S. Appl. No. 18/313,768, Non Final Office Action mailed Jul. 19, 2023”, 23 pages. [cited by applicant]
“U.S. Appl. No. 18/313,768, Final Office Action mailed Oct. 31, 2023”, 25 pgs. [cited by applicant]
“U.S. Appl. No. 18/313,768, Non Final Office Action mailed Feb. 8, 2024”, 26 pgs. [cited by applicant]
“U.S. Appl. No. 18/313,768, Response filed Jan. 29, 2024 to Final Office Action mailed Oct. 31, 2023”, 13 pgs. [cited by applicant]
“U.S. Appl. No. 18/313,768, Response filed Oct. 18, 2023 to Non Final Office Action mailed Jul. 19, 2023”, 14 pgs. [cited by applicant]
Antonopoulos, Panagiotis, et al., “Resumable Online Index Rebuild in SQL Server”, (Aug. 1, 2017), 12 pages. [cited by applicant]
Mohan, C., et al., “Algorithms for Creating Indexes for Very Large Tables Without Quiescing Updates”, Data Base Technology Institute, IBM Almaden Research Center, (Jun. 1992), 10 pages. [cited by applicant]
“U.S. Appl. No. 18/313,768, Notice of Allowance mailed May 28, 2024”, 9 pgs. [cited by applicant]
“U.S. Appl. No. 18/313,768, Response filed May 8, 2024 to Non Final Office Action mailed Feb. 8, 2024”, 17 pgs. [cited by applicant]
“U.S. Appl. No. 18/790,664, Non Final Office Action mailed May 6, 2025”, 26 pages. [cited by applicant]