Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Undefined Error during k/v updates, seems like a compact error #74

Open
eminarcissus opened this issue Jun 13, 2024 · 1 comment
Open

Comments

@eminarcissus
Copy link

I'm using. the most basic setups without any configuration and just fire up a file db in the GenServer init period, afterwards I do periodically handling GenServer's timeout to maintain the database status. But after a while I started to see the following errors.

** (Protocol.UndefinedError) protocol Enumerable not implemented for %CubDB.Btree{root: {:l, [valid_c: 257041, valid_c_timestamp: 271377, valid_i: 252945, valid_i_timestamp: 256017]}, root_loc: 271396, size: 4, dirt: 107, store: %CubDB.Store.File{pid: #PID<0.243.0>, file_path: "/home/lk/p_manage/_build/dev/lib/p_manage/priv/db/0.cub"}, capacity: 32} of type CubDB.Btree (a struct). This protocol is implemented for the following type(s): Date.Range, File.Stream, Function, GenEvent.Stream, HashDict, HashSet, IO.Stream, List, Map, MapSet, Range, Stream
(elixir 1.16.3) lib/enum.ex:1: Enumerable.impl_for!/1
(elixir 1.16.3) lib/enum.ex:166: Enumerable.reduce/3
(elixir 1.16.3) lib/enum.ex:4396: Enum.reduce/3
(cubdb 2.0.2) lib/cubdb/btree.ex:88: CubDB.Btree.load/3
(cubdb 2.0.2) lib/cubdb/compactor.ex:46: CubDB.Compactor.compact/2
(cubdb 2.0.2) lib/cubdb/compactor.ex:33: anonymous fn/2 in CubDB.Compactor.run/2

I'm using CubDB for some simple KV pairs for runtime configuration and data storage. while I'm keep updating on 2 keys with Poison encoded jsons. In the beginning it works without problem, but after a period of time it starts to raise the above errors. Looks more likely to be compact time error.

The structure of the stored content is [valid_c: 257041, valid_c_timestamp: 271377, valid_i: 252945, valid_i_timestamp: 256017],where timestamp are coming from :os.system_time(:millisecond) and valid_c/valid_i are Poison encoded json of a list of strings.

Is there anything I missed in configuration? Any hints would be real appreciatd.

@lucaong
Copy link
Owner

lucaong commented Jul 11, 2024

Hi @eminarcissus ,
the error looks very strange:

** (Protocol.UndefinedError) protocol Enumerable not implemented for %CubDB.Btree

The Btree module does implement the Enumerable protocol. I am not sure what is happening here.

Could you tell me more about your setup? What kind of device is CubDB running on (an embedded device or a standard computer)? Are you doing some kind of hot code reloading, or anything "unusual"?

Thank you for your report!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants