# US 2018/0322158 A1 · Changing concurrency control modes

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

- Number: US 2018/0322158 A1
- Document ID: US20180322158A1
- Status: Published application
- Kind: A1
- Application number: 15/585,153
- Filed: 2017-05-02
- Published: 2018-11-08
- Earliest claimed: 2017-05-02
- Assignees: Hewlett Packard Enterprise Development LP
- Applicants: Hewlett Packard Enterprise Development LP
- Inventors: Huanchen Zhang; Kimberly Keeton
- Web page: https://patentgrep.com/patent/US20180322158A1

## CPC

- G06F 16/2343: {Locking methods, e.g. distributed locking or locking implementation details}
- G06F 16/2322: {using timestamps}
- G06F 16/2329: {using versioning}
- G06F: ELECTRIC DIGITAL DATA PROCESSING (computer systems based on specific computational models G06N)

## Abstract

Example implementations relate to changing concurrency control modes. An example implementation includes controlling a concurrency control mode of a data slot that stores a data value. A concurrency control mode of a data slot may be changed from an optimistic concurrency control mode to a multi-version concurrency control mode responsive to detecting a read-write conflict for the data slot. A concurrency control mode of a data slot may be changed from a multi-version concurrency control mode to an optimistic concurrency control mode responsive to detecting that the data slot satisfies a low contention criterion.

## Claims

### Claim 1

A method comprising:
controlling a concurrency control mode of a data slot that stores a data value, wherein the concurrency control mode determines how a transaction is handled responsive to a read-write conflict, and controlling the concurrency control mode comprises:
responsive to detecting a read-write conflict for the data slot, changing the concurrency control mode from an optimistic concurrency control mode to a multi-version concurrency control mode; and
changing the concurrency control mode from the multi-version concurrency control mode to the optimistic concurrency control mode responsive to detecting that the data slot satisfies a low contention criterion.

### Claim 2 (depends on 1)

The method of claim 1, where the read-write conflict for the data slot is detected by:
comparing a first version of the data value read at a first time with a second version of the data value read at a second time different than the first time; and
determining that the first version and the second version are different.

### Claim 3 (depends on 2)

The method of claim 2, wherein the data value read at the first time is read during an execution phase of the transaction and the data value read at the second time is read during a validation phase of the transaction.

### Claim 4 (depends on 1)

The method of claim 1, wherein the read-write conflict for the data slot is detected by:
assigning a transaction timestamp to the transaction; and
determining that the transaction timestamp is earlier in time than a commit time of the stored data value.

### Claim 5 (depends on 4)

The method of claim 4, wherein, when in the optimistic concurrency control mode, the transaction is aborted responsive to detecting that the transaction timestamp is earlier in time than a commit time of the stored data value.

### Claim 6 (depends on 1)

The method of claim 1, wherein an additional version of the stored data value is stored within a transaction record and is assigned a commit time.

### Claim 7 (depends on 6)

The method of claim 6, wherein any additional version of the stored data value stored within a transaction record is located by a version chain locator in the data slot.

### Claim 8 (depends on 7)

The method of claim 7, wherein the transaction record is in a per-thread ring buffer and the additional version of the stored data value is ordered by commit time in a version chain located by the version chain locator.

### Claim 9 (depends on 8)

The method of claim 8, wherein the low contention criterion is satisfied where the version chain locator in the data slot does not locate any created additional version of the stored data value.

### Claim 10 (depends on 1)

The method of claim 1, wherein, when in the optimistic concurrency control mode, a write of the transaction is updated to an optimistic concurrency buffer in a transaction record of the transaction, and wherein the transaction record comprises the optimistic concurrency control buffer and a multi-version concurrency control buffer.

### Claim 11 (depends on 10)

The method of claim 10, wherein the transaction record further comprises a transaction status field to indicate a transaction status of the transaction.

### Claim 12 (depends on 10)

The method of claim 10, wherein the optimistic concurrency control buffer is stored within a per-thread ring buffer, and wherein the optimistic concurrency control buffer is reclaimed upon a commit of the transaction.

### Claim 13 (depends on 1)

The method of claim 1, wherein, when in the multi-version concurrency control mode, a write of the transaction is updated to a multi-version concurrency control buffer in a transaction record of the transaction.

### Claim 14

A system comprising:
a processor; and
a set of memory resources storing:
a data slot comprising:
a committed in-place data value; and
a mode indicator to indicate whether a concurrency control mode of the data slot is in an optimistic concurrency control mode that aborts a transaction upon detecting a read-write conflict, or a multi-version concurrency control mode that creates an additional version of the committed data value responsive to detecting the read-write conflict; and
instructions in memory to be executed by a processor, the instructions when executed to:
change the concurrency control mode from the optimistic concurrency control mode to the multi-version concurrency control mode responsive to detecting the read-write conflict for the data slot; and
change the concurrency control mode from the multi-version concurrency control mode to the optimistic concurrency control mode responsive to detecting that the data slot satisfies a low contention criterion.

### Claim 15 (depends on 14)

The system of claim 14, wherein the data slot further comprises a version chain locator to locate any created additional version of the committed data value.

### Claim 16 (depends on 15)

The system of claim 15, wherein the data slot further comprises a priority indicator to indicate whether a read should first occur from the committed in-place data value of the data slot or the version chain locator of the data slot.

### Claim 17 (depends on 15)

The system of claim 15, wherein the low contention criterion is satisfied where the version chain locator of the data slot does not locate any created additional version of the committed data value.

### Claim 18 (depends on 15)

The system of claim 15, wherein the instructions in memory further comprise instructions to assign a commit timestamp to an additional version of the committed data value upon validation of the additional version, and wherein the validated additional version is ordered by commit time.

### Claim 19

A non-transitory computer-readable medium comprising instructions executable by a processor to:
detect a read-write conflict for a data slot;
responsive to detecting the read-write conflict, change a concurrency control mode of the data slot from an optimistic concurrency control mode that aborts a transaction upon detecting a read-write conflict, to a multi-version concurrency control mode that creates an additional version of the stored data value;
detect that a version chain locator of the data slot does not point to any additional version of the stored data value;
responsive to detecting that the version chain locator does not point to any additional version of the stored data value, change the concurrency control mode from the multi-version concurrency control mode to the optimistic concurrency control mode.

### Claim 20 (depends on 19)

The non-transitory computer-readable medium of claim 19, wherein the read-write conflict is detected by:
assigning a transaction timestamp to a received transaction; and
determining that the transaction timestamp is earlier in time than a commit time of a stored data value in the data slot.
