posted time Created time: 2017-02-15 Last updated time:

Execute Transaction Concurrently with Record Cache

Record Cache Engine

Concurrency Control of Transaction is implemented by records cache. This page explains how the cache is used.

Record Caches for Each Transaction

Record Caches are used to check which records are updated by local transaction.

Fast Concurrency Control

Alinous Elastic DB does not update data in the storage engine before committing the transaction.

Even if table partitioning or replication cluster is used, the data in the storage is single point on update it.

By reducing these opportunities to update it, scalability of parallel transaction increases.

On Memory or Disk

The record cache works as on memory cache, but the number of records are big, it uses disk to store them.

Even when the data is written into disk, it can access the data rapidly. That is because data is stored on BTree engine, and the disk I/O engine has memory cache.

The data on the disk is deleted when the transaction ends.

Types of Caches

There are 3 types of caches. These are updated when following DMLs are executed.

  • INSERT statement
  • UPDATE statement
  • DELETE statement

Insert Cache

The Insert Cache is to store records inserted by current transaction.

After a record is stored, it has temporary Oid, which is minus value.

In addition to that, the inserted, deleted, and updated version is temporary, because committed data does not exists in this case.

Update Cache

The Update Cache is to store records updated by current transaction.

On scanning table by SELECT, UPDATE, and INSERT SQL statements, this cache is used to adapt records' update by local transaction.

Delete Cache

The Delete Cache is to mark records as deleted ones by current transaction.

The table scanner assumes records, which are in the cache, as deleted. Records are identified by Oid.

Cached Records Structure

There are two types of record structure.

Insert and Delete Cache

Database Record Structure

The records of Insert & Delete Cache has same structure with ones in the storage engine.

Inserted Records

Inserted records are simply same with ones in storage engine.

Deleted Records

A record is identified by Oid, but deleted records has other data. That is because when you use remote table partitioning, it is necessary in order to reduce network access.

If remote partition node to insert the data is selected, database engine have to access  the node, only.

Update Cache

The records of Update Cache has different structure with ones of Insert and Delete Cache.

In addition to record data in the storage engine, it has old record data before update it.

That is because transaction engine have to update the last record's updated commit id. In local mode, it is easy, just search by Oid, it can find the record.

But this database is distributed database, if table partitioning using remote storage engine is used, it have to retrieve last data. Then the last record data is used.

Go to Top