morningman commented on a change in pull request #1289: Modify colocation
creation logic
URL: https://github.com/apache/incubator-doris/pull/1289#discussion_r293698050
##########
File path: fe/src/main/java/org/apache/doris/catalog/ColocateTableIndex.java
##########
@@ -33,35 +42,89 @@
import java.util.HashSet;
import java.util.List;
import java.util.Map;
+import java.util.Optional;
import java.util.Set;
-import java.util.concurrent.CopyOnWriteArraySet;
import java.util.concurrent.locks.ReentrantReadWriteLock;
+import java.util.stream.Collectors;
/**
* maintain the colocate table related indexes and meta
*/
public class ColocateTableIndex implements Writable {
- private transient ReentrantReadWriteLock lock;
+ private static final Logger LOG =
LogManager.getLogger(ColocateTableIndex.class);
+
+ public static class GroupId implements Writable {
+ public Long dbId;
+ public Long grpId;
+
+ private GroupId() {
+ }
+
+ public GroupId(long dbId, long grpId) {
+ this.dbId = dbId;
+ this.grpId = grpId;
+ }
+
+ public static GroupId read(DataInput in) throws IOException {
+ GroupId groupId = new GroupId();
+ groupId.readFields(in);
+ return groupId;
+ }
+
+ @Override
+ public void write(DataOutput out) throws IOException {
+ out.writeLong(dbId);
+ out.writeLong(grpId);
+ }
+
+ @Override
+ public void readFields(DataInput in) throws IOException {
+ dbId = in.readLong();
+ grpId = in.readLong();
+ }
+ @Override
+ public boolean equals(Object obj) {
+ if (!(obj instanceof GroupId)) {
+ return false;
+ }
+ GroupId other = (GroupId) obj;
+ return dbId.equals(other.dbId) && grpId.equals(other.grpId);
+ }
+
+ @Override
+ public int hashCode() {
+ int result = 17;
+ result = 31 * result + dbId.hashCode();
+ result = 31 * result + grpId.hashCode();
+ return result;
+ }
+
+ @Override
+ public String toString() {
+ return dbId + "." + grpId;
+ }
+ }
+
+ // group_name -> group_id
+ private Map<String, GroupId> groupName2Id = Maps.newHashMap();
+ // group_id -> group_name
+ private Map<GroupId, String> groupId2Name = Maps.newHashMap();
Review comment:
just a little bit use when we remove a table from colocate group.
But i will remove this member.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]