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

Partition rule "Hash" ( PartitionByLong ) may have a greater interger space than 1024 #285

Closed
Lordess opened this issue Sep 29, 2017 · 1 comment
Labels
community issue from community
Milestone

Comments

@Lordess
Copy link
Contributor

Lordess commented Sep 29, 2017

Phenonmenon

"Hash" class in rule.xml is redirected to com.actiontech.dble.route.function.PartitionByLong, which uses com.actiontech.dble.route.util.PartitionUtil for routing.

With comments inside, it seems that PartitionUtil wants to limit its sharding space into a [0,1024] interger space.

It will do check when it is initializing:

  1. get the dot product of partitionCount array and partitionLength array

dot product :=
{ partitionCount_1, partitionCount_2, ... , partitionCount_n } · { partitionLength_1, partitionLength_2, ... , partitionLength_n }

  1. compare the limit and the dot product.
partitionLength = ai[ai.length - 1];
/* other statments */
if (partitionLength > MAX_PARTITION_LENGTH) {
    throw new RuntimeException("error,check your partitionScope definition.MAX(sum(count*length[i]) must be less then 1024 ");
}

But, the limit here is not 1024, but 2880. So, a setting like partitionCount[] = {1} ; paritiontLength[] = {2880} is runnable. Though the case is against the design.

private static final int MAX_PARTITION_LENGTH = 2880;

How to Repeat

Start your dble, which has "Hash" tables, with settings belows, you will find dble works. Though this is against its design goal.

<function name="your_function_name" class="Hash" >
    <property name="partitionCount">1</property>
    <property name="partitionLength">2880</property>
</function>

Fix Suggestion

Change the value of MAX_PARTITION_LENGTH in PartitionUtil with 1024.

private static final int MAX_PARTITION_LENGTH = 1024;
@yanhuqing666
Copy link
Member

yanhuqing666 commented Sep 29, 2017

we will fix the error tip "error,check your partitionScope definition.Sum(count[i]*length[i]) must be less than 2880"

@yanhuqing666 yanhuqing666 added this to the 2.17.09.0 milestone Sep 30, 2017
@yanhuqing666 yanhuqing666 added the community issue from community label Jan 22, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
community issue from community
Projects
None yet
Development

No branches or pull requests

2 participants