Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 8 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,14 +60,18 @@ You can build each parts separatly by running `make` in each separated directori
# Running

0-db is made to be run in network server mode (using zdbd), documentation here is about the server.
More documentation will comes about the library itself. The library is fresh new and lack of documentation.

## Default port
0-db listens by default on port `9900` but this can be overidden on the commandline using `--port` option.
More documentation will comes about the library itself. The library lacks of documentation.

Without argument, datafiles and indexfiles will be stored on the current working directory, inside
`zdb-data` and `zdb-index` directories.

It's recommended to store index on SSD, data can be stored on HDD, fragmentation will be avoided as much
as possible (only on Linux). Please avoid CoW (Copy-on-Write) for both index and data.

## Default port

0-db listens by default on port `9900` but this can be overidden on the commandline using `--port` option.

# Always append
Data file (files which contains everything, included payload) are **in any cases** always append:
any change will result in something appened to files. Data files are immuables. If any suppression is
Expand Down
9 changes: 9 additions & 0 deletions libzdb/data.c
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#define _GNU_SOURCE

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
Expand Down Expand Up @@ -251,6 +253,13 @@ void data_initialize(char *filename, data_root_t *root) {
zdb_diep(filename);
}

#ifdef __linux__
// pre-allocate data size to avoid fragmentation, only on Linux
zdb_settings_t *settings = zdb_settings_get();
if(fallocate(fd, FALLOC_FL_KEEP_SIZE, 0, settings->datasize) < 0)
zdb_warnp(filename);
#endif

// writing initial header
data_header_t header;

Expand Down