1
0
mirror of https://github.com/armink/FlashDB.git synced 2025-01-16 20:12:52 +08:00

126 Commits

Author SHA1 Message Date
MGlolenstine
cf47f490bb
[fdb] Fixed a bug with reversed arguments to the fwrite and fread functions for LIBC mode. (#333) 2024-12-25 09:30:34 +08:00
Mason-Zhang-X-C
714d6159e7
[tsdb][read_sector_info]: fix flash overwrite when abnormal power loss (#316) 2024-10-06 13:45:40 +08:00
armink
72a7905238 [kvdb] Improve the GC algorithm to solve the problem of failure to collection in some cases. 2024-10-05 22:53:52 +08:00
莫若麦香
fd08d7f323
[kvdb] fix null-pointer dereference (#314)
The C library function - strlen() does not accept a null-pointer.

Signed-off-by: FragrantRye <903465575@qq.com>
2024-09-15 16:32:07 +08:00
Kenny Zhang
a8e8dcad64
[fdb_utils][_fdb_flash_write]: fix returned incorrect error code. (#300)
If user has set file mode, but file mode is disabled, _fdb_flash_write should return FDB_WRITE_ERR, not FDB_READ_ERR.
2024-07-26 09:44:36 +08:00
r0lsec
8f80336b89
[tsdb][read_sector_info]: fix read last valid tsl (#302)
Co-authored-by: wuchushun <wuchushun@kaadas.com>
2024-07-25 19:36:10 +08:00
Mr. Chip
60675db070
[fdb_kvdb] fix lock issue to fix block on first run (#295) 2024-05-10 15:27:33 +08:00
Anuj Deshpande
86d00aa5fd
[fdb] Fixes to build for IDF w/o errors (#293) 2024-04-24 20:24:11 +08:00
shihang-zhang
24305a9c76
[kvdb] Clear cache before setting kv to default (#282)
* fix: clear cache.

* Update fdb_kvdb.c, remove sector cache clear.

---------

Co-authored-by: shihang zhang <shihang.zhang.ext@siemens.com>
2024-03-22 13:51:56 +08:00
_VIFEXTech
7dfed14304
[fdb_kvdb]: fix shadow warning (#272)
```bash
FlashDB/src/fdb_kvdb.c: In function ‘read_sector_info’:
FlashDB/src/fdb_kvdb.c:488:23: warning: declaration of ‘sector_cache’ shadows a previous local [-Wshadow]
  488 |         kv_sec_info_t sector_cache = get_sector_from_cache(db, sector->addr);
      |                       ^~~~~~~~~~~~
FlashDB/src/fdb_kvdb.c:421:19: note: shadowed declaration is here
  421 |     kv_sec_info_t sector_cache = get_sector_from_cache(db, addr);
      |                   ^~~~~~~~~~~~
```

Signed-off-by: FASTSHIFT <vifextech@foxmail.com>
2024-01-02 13:55:00 +08:00
_VIFEXTech
760520564c
[fdb_kvdb] fix runtime error (#271)
```bash
FlashDB/src/fdb_kvdb.c:288:83: runtime error: left shift of 255 by 24 places cannot be represented in type 'int'
```

Signed-off-by: FASTSHIFT <vifextech@foxmail.com>
2024-01-01 18:25:13 +08:00
Oleg Hahm
0594fdc957
[kvdb] Initialize only status explicitly (#267)
Co-authored-by: Oleg Hahm <oleg@riot-os.org>
2023-12-08 16:40:45 +08:00
Oleg Hahm
86f5550e60
[fdb] close stream pointer via fclose() (#268)
Co-authored-by: Oleg Hahm <oleg@riot-os.org>
2023-12-08 16:38:51 +08:00
armink
c1226f337a [kvdb] update some log level. 2023-12-02 19:26:45 +08:00
armink
8056e17f29 [kvdb] remove unused lock. 2023-12-02 19:25:26 +08:00
armink
718f73fbe6 [fdb] Add file access cache in file mode. The GC speed is up 2X. 2023-11-19 12:34:43 +08:00
armink
189b22e0a4 [fdb] Improve the database lock uses in init function. 2023-11-19 12:32:30 +08:00
armink
5ebf8e6e8f [kvdb] Add kvdb inergrity check API. 2023-11-19 11:32:19 +08:00
armink
7e91b05483 [fdb] Add the lock in database init function. 2023-11-19 11:30:45 +08:00
armink
2dea1b2b88 [kvdb] Add more error logs. 2023-11-19 11:27:23 +08:00
armink
a2c442435c [kvdb] Improve the kvdb cache performance. The GC will be 8x faster in file mode. 2023-11-19 11:26:48 +08:00
armink
3dca512285 [kvdb] Improve the GC speed when in recovery mode. 2023-11-19 11:06:12 +08:00
_VIFEXTech
dc6121b448
[fdb] fix warning (#258)
Signed-off-by: FASTSHIFT <vifextech@foxmail.com>
2023-11-12 13:27:43 +08:00
Valeriy Kucherenko
0d1b438947
Add ability to append TSDB value at specific timestamp (#256) 2023-11-09 19:27:52 +08:00
shihang-zhang
a208b1555b
Fix invalid oldest address assignment (#255)
* fix: fix invalid oldest address assignment after gc the last traversed sector.
* feat: always update oldest address after sector GC.

---------

Co-authored-by: shihang zhang <shihang.zhang.ext@siemens.com>
2023-10-31 10:13:55 +08:00
tinic
7bdef5eab7
[fdb] Support 128bit write granularity for kvdb (#250)
* Support 128bit write granularity

The new stm32h5xx chips can only write quad words, i.e. 128bits.

* Update fdb_tsdb.c to include 128bit option
* Update fdb_cfg.h to include 64bit and 128bit option.
2023-10-17 10:01:43 +08:00
armink
12f3960307 [kvdb] Fix testcase error from #251 2023-10-16 21:25:01 +08:00
Lyon
7b2557f3e7
[kvdb] interrupt iteraotor when read_section_info fails (#251)
* interrupt iteraotor when read_section_info failed

* Update src/fdb_kvdb.c

Co-authored-by: 朱天龙 (Armink) <armink.ztl@gmail.com>

* Update src/fdb_kvdb.c

Co-authored-by: 朱天龙 (Armink) <armink.ztl@gmail.com>

---------

Co-authored-by: 朱天龙 (Armink) <armink.ztl@gmail.com>
2023-10-16 09:06:35 +08:00
armink
deae3d1d3f [fdb] Fixed build error. 2023-10-15 15:00:10 +08:00
armink
c02f3f8573 [fdb] Update the fdb file mode log. 2023-10-15 14:31:38 +08:00
armink
1c68317574 [tsdb] Improve fdb_tsl_query_count return value. Delete the tsl_append assert check. 2023-10-15 11:49:37 +08:00
armink
ab4c69f302 [fdb] Improve the fdb_kv_iterate. Only crc check OK kv will be iterated. 2023-10-15 11:46:28 +08:00
armink
5a8d7d0842 [fdb] Remove sector continuous mode assert check. It may trigger accidentally when db meta info has an error. 2023-10-15 11:36:50 +08:00
armink
1d2fc750f9 [kvdb] update the log 2023-10-15 11:24:56 +08:00
armink
c8dd4ebe63 [kvdb] Fixed an issue where KVDB may not be able to automatically recover under extreme circumstances 2023-10-15 11:22:13 +08:00
BecauseItIsThere
09fa698f95
[fdb] Relocate #include<unistd.h> (fixed #248) 2023-10-12 17:51:19 +08:00
guoweilkd
d2cae60cff fix db_lock()/db_unlock() not calling in pairs 2023-10-12 10:51:39 +08:00
fzi-haxel
56b658e522
[fdb]Replaced ~0UL in max value checks (#243)
The actual value of `~0UL` is architecture dependent. The `unsigned long` type must be at least 32 bits, but can be larger.
Especially on 64-bit systems, `unsigned long` usually is 64 bits long, for which `~0UL` will result in `0xFFFFFFFFFFFFFFFF` instead of `0xFFFFFFFF`.
If this is the case, comparisons like `kv->len == ~0UL`, where `kv->len` is of type `uint32_t`, are always false.
This commit replaces `~0UL` with the appropriate max value defines from stdint.h.
2023-10-06 14:35:55 +08:00
benpicco
07dcd7f035
[fdb] fix comparison of integer expressions of different signedness (#226) 2023-08-08 10:34:54 +08:00
grape-wzy
cc1c6f4d9f
[kvdb] update _fdb_kv_load(fdb_kvdb_t db) (#219)
remove function declaration in fdb_low_lvl.h;
add static qualifier in fdb_kvdb.c
2023-06-10 13:30:15 +08:00
PostmanLinux
89796605c7
[kvdb] improve kvdb cache algo when key was first found (#218) 2023-06-05 22:53:41 +08:00
朱天龙 (Armink)
4e56774082 [fdb] add db path info for logs 2023-05-28 19:03:26 +08:00
朱天龙 (Armink)
8608140d88 [fdb] check some read error for file mode 2023-05-28 19:02:04 +08:00
朱天龙 (Armink)
3c80fa5679 [kvdb] add align padding for 64bit write granularity mode 2023-05-16 09:50:17 +08:00
朱天龙 (Armink)
a035ea3b2c [fdb] change some assert to error logs 2023-05-14 21:20:30 +08:00
朱天龙 (Armink)
dbf5a58fa1 [kvdb] fixed the memory read out of bounds error 2023-05-14 18:31:10 +08:00
朱天龙 (Armink)
6e3ebdc056 [kvdb] fix kvdb memory access error when FDB_WRITE_GRAN is 64 2023-05-07 21:25:59 +08:00
朱天龙 (Armink)
63fe2961c4 [kvdb] Improve the oldest sector search method. 2023-04-29 23:49:37 +08:00
朱天龙 (Armink)
cc5d665bbc [kvdb] fix kvdb iterate bug after set default. 2023-04-29 21:06:16 +08:00
朱天龙 (Armink)
c829b3d8e2 [kvdb] fix #211 , fdb kv iterate from the oldest sector. 2023-04-29 16:11:35 +08:00