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

The database with q = 1024 #4196

Closed
ornotnull opened this issue Oct 5, 2022 · 6 comments · Fixed by #4197
Closed

The database with q = 1024 #4196

ornotnull opened this issue Oct 5, 2022 · 6 comments · Fixed by #4197
Labels

Comments

@ornotnull
Copy link

Trying to create a database with q = 1024 and n = 1.
Is this supported? Any limitation for q?

<0.7629.0> cd536cbb12 req_err(1645417114) unknown_error : badarith
[<<"math:pow/2">>,<<"fabric_util:get_db_timeout/4 L160">>,<<"fabric_util:get_db/2 L114">>,<<"fabric:get_security/2 L183">>,<<"chttpd_auth_request:db_authorization_check/1 L112">>,<<"chttpd_auth_request:authorize_request/1 L19">>,<<"chttpd:handle_req_after_auth/2 L325">>,<<"chttpd:process_request/1 L310">>]

the error is produced by line 160 of src/fabric/src/fabric_util.erl

math:pow(Factor, N + 1)

and do not see a way to avoid this

Factor is not less then 2 by 111 line
Factor = max(2, config:get_integer("fabric", "shard_timeout_factor", 2))

@nickva
Copy link
Contributor

nickva commented Oct 6, 2022

A q factor is 1024 is probably not practical. The default is 2 and I even it the larger clusters I don't recall seeing anything larger than 256.

What are you trying to do?

@ornotnull
Copy link
Author

OK. Now just testing the database of size about 10Tb
and follow the recommendation to keep a shard within 10Gb
https://neighbourhood.ie/blog/2020/09/22/sharding-choosing-the-right-q-value/

So the test database is q = 1024 and n = 2 but now only able to go with q = 256, n = 2

@big-r81
Copy link
Contributor

big-r81 commented Oct 6, 2022

Hi,

what @nickva says, but I can reproduce this.

curl -X PUT http:/a:[email protected]:15984/qdb?q=1024
{"error":"ok","reason":"ok"}

See for more error messages: https://gist.github.com/big-r81/d244a22c36820c165ed63a105d6a092b

@nickva
Copy link
Contributor

nickva commented Oct 6, 2022

@ornotnull you can still go as high as 1022 or so (the highest limit is 1023 and there is a +1 so max q would be about 1022). But even with a 10TB I would stick with a smaller sharding factor.

nickva added a commit that referenced this issue Oct 6, 2022
These may not be practical but our arithmetic blowing up shouldn't be the limit
preventing it.

Use the minimum timeout when the number of shards is greater than 64.

Fixes: #4196
@nickva
Copy link
Contributor

nickva commented Oct 6, 2022

@ornotnull thanks for reaching out and reporting the bug. Here is a PR that should fix it #4197

nickva added a commit that referenced this issue Oct 6, 2022
These may not be practical but our arithmetic blowing up shouldn't be the limit
preventing it.

Use the minimum timeout when the number of shards is greater than 64.

Fixes: #4196
nickva added a commit that referenced this issue Oct 6, 2022
These may not be practical but our arithmetic blowing up shouldn't be the limit
preventing it.

Use the minimum timeout when the number of shards is greater than 64.

Fixes: #4196
@ornotnull
Copy link
Author

@nickva, thank you a lot
able to compile the new 3.2.2-228b07e version and no issue any more

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

Successfully merging a pull request may close this issue.

3 participants