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

Storage Records Data Format for Partitioning

The Storage Engine of Distributed Database has records in it. The format have to resolve ACID status with the record's information.

Especially on using partitioning, the format is very important to make the performance high.

Data Format of Storage Records

There are two types of policies in database records management supporting ACID. When the records are changed, one of following operations are done.

  • Update or Delete the record
  • Add a new record with new version

MySQL uses the first method, and PostgreSQL uses second one. The Alinous Elastic DB uses the second method like PostgreSQL.

The actual format is following.

When a record is inserted & updated, the number of records increases like log. When deleted, the latest record is updated. Therefore database vacuum is necessary.

The meaning of each fields are below.

Inserted Version

The version of the record is created. All records have this version.

Updated Version

When UPDATE SQL Statement executed, the field of last record is set into current record's version.

Deleted Version

When the record is deleted, this field is set. The record is logically deleted.

Next Partition Key

When the partitioning key is updated, this field is added. In other case, this field is not set.

Transaction &ACID

The reason why this method is hired is that records must to have information to detect version status of  the record id(oid).

Alinous Elastic DB is relational database with 3 isolation levels, READ COMMITTED, REPEATABLE READ, and SERIALIZABLE.

But the REPEATABLE READ level is not same with other relational databases. It is same with SERIALIZABLE level.

That is because phantom read is solved by the first visibility check. Therefore it actually supports READ COMMITTED and SERIALIZABLE.

Inserted & Overwritten Records

If the record has updated version as the commit id , which is greater than 0. The record is updated.

Then transactions with each atomicity deal like below.

READ COMMITTED

Ever time, ignore the records with Updated Version greater than 0.

REPEATABLE READ & SERIALIZABLE

If Updated Version is greater than 0. Then if following condition is satisfied, it is visible.

Insert Version <= current version < Updated Version

If Updated Version is 0. The record is visible when Inserted Version equals or greater than current version.

Deleted Records

When the records are deleted, the Deleted Version is set. The version is always 0, if the record has upper version.

READ COMMITTED

READ COMMITTED isolation level transaction reads record data whose Updated Version is 0. Therefore such data has Deleted Version, then ignore it

REPEATABLE READ & SERIALIZABLE

If the record is visible, and Deleted Version equals or is greater than current version, the record is ignored.



Go to Top