The components of Concerted are:
Locking manager: The locking manager is the component of Concerted which handles all the locking and concurrency in Concerted.
Data store: The data store is the part of Concerted which stores the data and reads and supports queries on the data.
Cache: The cache brings in the data in pages of a fixed size from the disk.
Transaction Manager: The Transaction Manager handles the transactions and the ‘all-or-nothing’ aspect of the transactions and operations.
The locking manager manages the locking in Concerted. It manages the locking with read and write locks and lock upgradation.
The locking manager has locking queues and spinlocks. A lock is granted, and any other request for the lock while the lock is being held by some thread are added to a queue with a flag. The waiting thread checks the value of the flag and once the value of the flag becomes a specific value, the thread can proceed with its operations as it has been granted the lock.
After completing the tasks, the thread which holds the lock currently calls ReleaseLock to release the lock from itself.
The locking manager is designed with NUMA in mind. Hence, the flags for checking whether the lock the thread is waiting for has been granted or not are distributed, so that threads can access the flag in their cache lines, so that the lookup is less expensive.
The data store is the component of Concerted which holds the data present in the database. The data is stored in various data structures and written to disk. The data from a specific data structure is read from disk into main memory when queries based on it are present.
A cache is present which reads the data from disk and keeps it in main memory. The cache has LRU based page replacement algorithm.
The Transaction Manager manages the transactions taking place inside the database and ensures consistency in the data. The transaction manager makes all the changes done to the data in a local copy of the data and writes the changes to the main data store only when commit takes place. Commit takes place when all the operations complete successfully.
For more examples of usage, please see the tests included.
For running any test present in the Tests folder, please use:
g++ [name of code file to compile] -lpthread -lrt