couchbase / forestdb

A Fast Key-Value Storage Engine Based on Hierarchical B+-Tree Trie
Apache License 2.0
1.29k stars 172 forks source link

Some questions and Suggestions about ForestDB #17

Closed tpri-hq closed 6 years ago

tpri-hq commented 6 years ago

ForestDB is a very good KV storage component, Some questions and Suggestions about ForestDB:

  1. The binary cross-c/C++ compiler call is not supported on MSVC because in fdb_types.h:

    ifndef __cplusplus

    pragma once

define false (0)

define true (1)

define bool int

endif

sizeof(bool)==1 On the c ++ compiler, and sizeof(bool)==4 On the c ++ compiler, ForestDB must be compiled using the c ++ compiler, because byte alignment is different, the result error by call fdb_get_default_config() and fdb_get_default_kvs_config() API.

  1. Some API parameters are not appropriate:

    LIBFDB_API fdb_config fdb_get_default_config(void) change for LIBFDB_API fdb_status fdb_get_default_config(fdb_config fconfig) LIBFDB_API fdb_kvs_config fdb_get_default_kvs_config(void) change for LIBFDB_API fdb_status fdb_get_default_kvs_config(fdb_kvs_config config) fdb_status fdb_doc_update(fdb_doc *doc,... change for fdb_status fdb_doc_update(fdb_doc doc,...

    That's more reasonable.

  2. After enable stale block reusing, repeat full table write->commit->full table update->commit->full table delete->commit, etc,stale block reusing ineffectiveness, If you control the commit granularity, that you can.

4.enable DOCIO_BLOCK_ALIGN macro in option.h, Partial record call fdb_get_kv() retrieval failed.

  1. When num_keeping_headers is set to 1, Write 100w record(key: int, value: 1KB), set/get/update is good, But deleting errors: [FDB ERR: -61] Read error: BID 550859 in a database file './tag-table.db' is not read correctly: only -61 bytes read (hex) 0x88d2400, 4096 (0x1000) bytes 0000 00 20 00 00 00 04 3d dc ff ff ff ff ff ff ff ff . ....=......... ... ... 0ff0 ff ff ff ff ff ff ff ff 00 00 00 00 00 00 00 ff ................ [FDB ERR: -61] Failed to read a database header with block id 550859 in a database file './tag-table.db' [FDB ERR: -5] Read error: read offset 14757395258967638016 exceeds the file's current offset 2256322560 in a database file './tag-table.db'

[FDB ERR: -5] Failed to read a database header with block id 14757395258967641292 in a database file './tag-table.db'

No error occurred while num_keeping_headers>1.

ingenthr commented 6 years ago

Thanks @tpri-hq ! Note that ForestDB is not under active development at the moment. I'd recommend forking and submitting a PR for your suggestions.