TidesDB v0.7.0b #282
guycipher
announced in
Announcements
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
We are going strong! Onto a new minor TidesDB v0.7.0 BETA. With this new minor we offering greater memory efficiency with merging operations, greater read efficiency with optional block indices and more system stability! Thank you to our awesome open-source crew as well for their meaningful contributions. We have also introduced a new external library xxhash to assist withe our internal sorted binary hash array which is used for block indices.
Features
TDB_BLOCK_INDICES
is set to 1. This means TidesDB for each column family sstable there is a last block containing a sorted binary hash array. This compact data structure gives us the ability to retrieve the specific offset for a key and seek to its containing key value pair block within an sstable without having to scan an entire sstable. IfTDB_BLOCK_INDICES
is set to 0 then block indices aren't used nor created and reads are slower and consume more IO and CPU having to scan and compare.Building
Using cmake to build the shared library.
cmake -S . -B build cmake --build build cmake --install build
Requirements
You need cmake and a C compiler.
You also require the
snappy
,lz4
, andzstd
libraries.Linux
MacOS
Windows
Windows using vcpkg
Dependencies
Include
Usage
Each database method returns a
tidesdb_err_t*
which returns an error code and message. If no error, TidesDB returnsNULL
.Example of error structure
Opening a database
To open a database you pass the path to the database directory and a pointer to the database.
Creating a column family
In order to store data in TidesDB you need a column family. This is by design.
You pass
TDB_MEMTABLE_SKIP_LIST
) passTDB_USING_HT_MAX_LEVEL
if usingTDB_MEMTABLE_HASH_TABLE
TDB_MEMTABLE_SKIP_LIST
) passTDB_USING_HT_PROBABILITY
if usingTDB_MEMTABLE_HASH_TABLE
TDB_NO_COMPRESSION
,TDB_COMPRESS_SNAPPY
,TDB_COMPRESS_LZ4
,TDB_COMPRESS_ZSTD
]TDB_MEMTABLE_SKIP_LIST
,TDB_MEMTABLE_HASH_TABLE
]Using Snappy compression, bloom filters and hash table memtable.
Dropping a column family
Listing column families
You can list all column families in the database list as a string. You must free the string when done.
Putting a key-value pair
You pass
Putting a key-value pair with TTL
Getting a key-value pair
You pass
Deleting a key-value pair
You pass
Transactions
You can perform a series of operations atomically. This will block other threads from reading or writing to the column family until the transaction is committed or rolled back.
You begin a transaction by calling
tidesdb_txn_begin
.You pass
Now we can add operations to the transaction.
Cursors
You can iterate over key-value pairs in a column family.
Compaction
There are 2 ways to compact sstables. Manual multi-threaded paired and merged compaction and automatic background partial merge compaction.
Compaction removes tombstones and expired keys if ttl is set. Because merging merges and older and newer sstables only the newest version of key lives on.
Manual Multi-Threaded Parallel Compaction
You can manually compact sstables. This method pairs and merges column family sstables from oldest to latest. It will remove tombstones and expired keys if ttl is set.
Say you have 100, after compaction you will have 50; Always half the amount you had prior. You can set the number of threads to use for compaction. Each thread handles 1 pair.
Automatic / Background Partial Merge Compaction
You can start a background partial merge compaction. This will incrementally merge sstables in the background from oldest to newest when minimum sstables are reached. Merges are done every n seconds. Merges are not done in parallel but incrementally.
You can set the minimum amount of column family sstables to trigger a background partial merge. Background merging blocks less than manual compaction.
You pass
What's Changed
tidesdb_list_column_families
should return type of tidesdb_err_t * (as any other tidesdb API) but no char* #253 for API consistency by @guycipher in tidesdb: tidesdb_list_column_families reformat as per issue #253 for API consistency #258Full Changelog: v0.6.0b...v0.7.0b
This discussion was created from the release v0.7.0b.
Beta Was this translation helpful? Give feedback.
All reactions