Allocation method and device for a distributed lock

US11288253B2 · US · B2

Patent metadata
FieldValue
Publication numberUS-11288253-B2
Application numberUS-201816014444-A
CountryUS
Kind codeB2
Filing dateJun 21, 2018
Priority dateJun 21, 2017
Publication dateMar 29, 2022
Grant dateMar 29, 2022

How to read this patent

A practical reading order for non-experts. Skip the full description unless you need deep technical detail.

  1. Title

    What the patent document calls the invention.

  2. Abstract

    A short plain-language summary of the technical disclosure.

  3. Assignees and inventors

    Who owns or filed the patent and who is credited as inventor.

  4. Key dates

    Filing, priority, publication, and grant dates set the timeline.

  5. First independent claim

    The legal scope of protection — read this for what is actually claimed.

  6. CPC / IPC classifications

    Technology tags used to group this patent with similar filings.

  7. Citations and related patents

    Prior art links and similar publications in this corpus.

Abstract

Official abstract text for this publication.

A method and device for allocating a distributed lock is provided. A globally unique service process ID (SPI) is introduced for each distributed application service process while guaranteeing correctness of a distributed lock, and the SPI is used to directly manage ownership of the distributed lock. The service replacement process sends to the server a request for inheriting ownership of the distributed lock before the lifecycle of the lock file expires, the inherit request including the SPI.

First claim

Opening claim text (preview).

The invention claimed is: 1. An allocation method for a distributed lock at a server, comprising: creating a lock file having a lifecycle for a distributed lock according to a lock file creation request received from a service process of a client; writing a unique service process ID (SPI) of the service process into the lock file according to an SPI writing request received from the service process, wherein upon a service process crash is detected, a service replacement process is initiated for allocating the SPI of the crashed service process to the service replacement process; acquiring a distributed lock inherit request sent by the service replacement process before the lifecycle of the lock file expires, the distributed lock inherit request including the SPI and indicating a request for inheriting ownership of the distributed lock to the server, the distributed lock inherit request further including a lock file deletion request for deleting the lock file created based on the request from the service process; determining whether the SPI of the service replacement process is consistent with an SPI in the lock file; and in response to the SPI of the service replacement process being consistent with the SPI in the lock file, deleting the lock file created according to the lock file creation request received from the service process and creating a new lock file of the distributed lock for the service replacement process, wherein deleting the lock file is based on a comparison of a transaction ID generated during creation of the lock file and a transaction ID in the lock file deletion request. 2. The method of claim 1 , wherein creating the new lock file comprises: attempting to create the new lock file of the distributed lock for the service replacement process according to a re-creation attempt request received from the service replacement process; in response to the attempt failing, feeding back a creation attempt failure to the service replacement process; acquiring a distributed lock inherit request sent by the service replacement process before the lifecycle of the lock file expires, the distributed lock inherit request including the SPI of the service replacement process; determining whether the SPI of the service replacement process is consistent with an SPI in the lock file; and in response to the SPI of the service replacement process being consistent with the SPI in the lock file, creating the new lock file of the distributed lock for the service replacement process. 3. The method of claim 2 , wherein after attempting to create the new lock file of the same distributed lock for the service replacement process, the method further comprises: feeding back a distributed lock contention success to the service replacement process in response to the creation attempt succeeding. 4. The method of claim 1 , wherein acquiring the distributed lock inherit request, determining whether the SPI of the service replacement process is consistent with the SPI in the lock file, and creating the new lock file comprises: receiving the lock file deletion request, the lock file deletion request including the SPI of the service replacement process; determining whether the SPI of the service replacement process is consistent with the SPI in the lock file according to the lock file deletion request; in response to the SPI of the service replacement process being consistent with the SPI in the lock file, deleting the lock file created by the service process; and creating the new lock file of the distributed lock for the replacement process according to a creation request received from the service replacement process. 5. The method of claim 4 , wherein after creating the lock file having the lifecycle for the distributed lock, the method further comprises: writing into the lock file the transaction ID generated during creation of the lock file; receiving the lock file deletion request, the lock file deletion request including the SPI of the service replacement process, the receiving further comprises: sending the transaction ID generated during creation of the lock file to the client according to a transaction ID acquisition request received from the client; and receiving the lock file deletion request, the lock file deletion request including the SPI of the service replacement process and the transaction ID generated during creation of the lock file; and deleting the lock file created by the service process, the deleting further comprises: determining whether the transaction ID in the lock file deletion request is consistent with the transaction ID generated during creation in the lock file for the distributed lock of the server, and in response to the transaction ID in the lock file deletion request being consistent with the generated transaction ID, deleting the lock file created by the service process, feeding back a deletion success to the service replacement process, and acquiring a request sent by the service replacement process for creating a new lock file for the distributed lock. 6. The method of claim 5 , wherein after feeding back whether the lock file is deleted successfully, the method further comprises: feeding back a lock file contention failure to the service replacement process in response to the deletion failing. 7. A server, comprising: a creation apparatus configured to create a lock file having a lifecycle for a distributed lock according to a lock file creation request received from a service process of a client; a writing apparatus configured to write a unique service process ID (SPI) of the service process into the lock file according to an SPI writing request received from the service process, wherein upon a service process crash is detected, a service replacement process is initiated for allocating the SPI of the crashed service process to the service replacement process; and an allocation apparatus configured to: acquire a distributed lock inherit request sent by the service replacement process before the lifecycle of the lock file expires, the distributed lock inherit request including the SPI and indicating a request for inheriting ownership of the distributed lock to the server, and the distributed lock inherit request further including a lock file deletion request for deleting the lock file created based on the request from the service process; determine whether the SPI of the service replacement process is consistent with an SPI in the lock file; and in response to the SPI of the service replacement process being consistent with the SPI in the lock file, delete the lock file created according to the lock file creation request received from the service process and create a new lock file of the distributed lock for the service replacement process, wherein deleting the lock file is based on a comparison of a transaction ID generated during creation of the lock file and a transaction ID in the lock file deletion request. 8. The server of claim 7 , wherein the allocation apparatus is configured to: attempt to create the new lock file of the distributed lock for the service replacement process according to a re-creation attempt request received from the service replacement process, and feed back a creation attempt failure to the service replacement process in response to the attempt failing; and acquire a distributed lock inherit request sent by the service replacement process before the lifecycle of the lock file expires, the distributed lock inherit request including the SPI of the service replacement process, determine whether the SPI of the service replacement process is consistent with an SPI in the lock file, and in response to the SPI of the service replacement process being consistent with the SPI in the lo

Assignees

Inventors

Classifications

  • G06F9/526Primary

    Mutual exclusion algorithms · CPC title

  • Locking methods, e.g. distributed locking or locking implementation details · CPC title

  • Protocols · CPC title

  • avoiding end of session, e.g. keep-alive, heartbeats, resumption message or wake-up for inactive or interrupted session · CPC title

  • in which an application is distributed across nodes in the network (software deployment G06F8/60; multiprogramming arrangements G06F9/46) · CPC title

Patent family

Related publications grouped by family.

External sources

Frequently asked questions

Answers are generated from the same data shown on this page.

What does patent US11288253B2 cover?
A method and device for allocating a distributed lock is provided. A globally unique service process ID (SPI) is introduced for each distributed application service process while guaranteeing correctness of a distributed lock, and the SPI is used to directly manage ownership of the distributed lock. The service replacement process sends to the server a request for inheriting ownership of the di…
Who is the assignee on this patent?
Alibaba Group Holding Ltd
What technology area does this patent fall under?
Primary CPC classification G06F9/526. Mapped technology areas include Physics.
When was this patent published?
Publication date Tue Mar 29 2022 00:00:00 GMT+0000 (Coordinated Universal Time) (B2). Legal status and post-grant events are not shown on this page.
What related patents are in patentsdb?
We list 5 related publications on this page (citations in our corpus or others sharing the same primary CPC).