diff --git a/README.md b/README.md index 480d71e..4ed18e7 100644 --- a/README.md +++ b/README.md @@ -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 diff --git a/libzdb/data.c b/libzdb/data.c index 54c8d47..247f700 100644 --- a/libzdb/data.c +++ b/libzdb/data.c @@ -1,3 +1,5 @@ +#define _GNU_SOURCE + #include #include #include @@ -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;