-
Notifications
You must be signed in to change notification settings - Fork 3.2k
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
[Feature][ResourceTag] Support Resource Tag #6203
[Feature][ResourceTag] Support Resource Tag #6203
Conversation
13d8ab0
to
d61275b
Compare
b7b3fb1
to
a767b76
Compare
a767b76
to
4b981b6
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
PR approved by at least one committer and no changes requested. |
PR approved by anyone and no changes requested. |
270fc6e
to
88cc6c2
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
PR approved by at least one committer and no changes requested. |
Is there a way to check a BE's tags? @morningman |
|
Oh I see. Another small question, if |
Yes. It will. Currently, the user property |
Proposed changes
Step 1 and 2 of #5902
This CL mainly changes:
Support setting tags for BE nodes:
And for compatibility, all BE nodes will be set a "default" tag when upgrading:
"tag.location": "default"
.Create a new class
ReplicaAllocation
to replace the previousreplication_num
.ReplicaAllocation
represents the allocation of the replicas of a tablet. It contains a map fromTag to number of replicas.
For example, if user set a table's replication num to 3, it will be converted to a ReplicaAllocation
like:
"tag.location.default" : "3"
, which means the tablet will have 3 replicas and all of them will beallocated in BE nodes with tag "default";
Support create table with replication allocation:
Also support set replica allocation for dynamic tables, and modify replica allocation at runtime.
For compatibility, user can still set "replication_num" = "3", and it will be automatically converted to:
"replication_allocation"="tag.location.default:3"
Support tablet repair and balance based on Tag
For tablets of non-colocate table, most of the logic is the same as before,
but when selecting the destination node for clone, the tag of the node will be considered.
If the required tag does not exist, it cannot be repaired.
Similarly, under the condition of ensuring that the replicas are complete, the tablet will be
reallocated according to the tag or the replicas will be balanced.
Balancing is performed separately within each resource group.
For tablets of colocate table, the backends sequence of buckets will be splitted by tag.
For example, if replica allocation is "tag.location.zone1:1, tag.location.zone2:2",
And zone1 has 2 BE: A, B; zone2 has 3 BE: C, D, F
there will be 2 backend sequences: one is for zone1, and the other is for zone2.
And one posible seqeunces will be:
zone1: [A] [B] [A] [B]
zone2: [C, D][D, F][F, C][C, D]
Support setting tags for user and restrict execution node with tags:
After setting, the user 'cmy' can only query data stored on backends with tag zone1 and zone2,
And query can only be executed on backends with tag zone1 and zone2
For compatibility, after upgrading, the property
resource_tags.location
will be empty,so that user can still query data stored on any backends.
Modify the Unit test frame of FE so that we can created multi backends with different mocked IP in unit test.
This help us to easily test some distributed cases like query, tablet repair and balance
The document will be added in another PR.
Also fix a bug described in #6194
Types of changes
What types of changes does your code introduce to Doris?
Put an
x
in the boxes that applyChecklist
Put an
x
in the boxes that apply. You can also fill these out after creating the PR. If you're unsure about any of them, don't hesitate to ask. We're here to help! This is simply a reminder of what we are going to look for before merging your code.Further comments
If this is a relatively large or complex change, kick off the discussion at dev@doris.apache.org by explaining why you chose the solution you did and what alternatives you considered, etc...