morningman opened a new issue #1291: Modify colocation feature
URL: https://github.com/apache/incubator-doris/issues/1291
 
 
   # 修改 Colocation 的创建逻辑
   
   之前的实现中,用户需要先创建一个 parent table,然后在创建1个或多个 child table关联到 parent table。同时在 
table 对象中记录了一个 colocateTable 对象,其中是 parent table 的名字。
   这个实现有一些问题,
   
   1. 当 parent table 需要改名时,需要联动修改其他 child table 中 colocateTable,非常麻烦
   2. 当 parent table 被删除时,其他 child table 的 colocate 属性如何处理?
   
   总结来说,就是将 colocate 属性和某一张表强绑定,可能会导致其他逻辑修改起来耦合太多。
   
   所以现将 Colocation 的创建逻辑修改如下:
   
   1. 增加一个 colocate group 的概念。group 拥有名字和全局唯一id。group 包含了 
ColocationGroupSchema,这schema包括所有 colocation 需要用到的信息,比如bucket 
数量,副本数、分桶列类型,backends 序列等。GroupId 由 dbId个group_id组成。group 属于某一个db。
   2. 用户在创建表时,可以指定 "colocate_with" = "group_name", 表明需要将这张表关联到这个 colocate 
group。如果group不存在,则会自动创建一个新的 group,该 group 的 Schema 通过这张表来生成。如果 group 
已经存在,则会检查这张表是否能够关联到这个 group,如果检查失败,则建表失败。
   3. 当一个 group 中所有表都被删除后,这个group也会被自动删除。
   4. 可以通过 alter table 语句修改一个表的 colocate 
group。如果表本身没有group,则会检查并关联到这个group,如果本身有group,则会从原有group中删除,加入新的group。也可以将 
group 置为空,即表示脱离这个group
   
   同时也修改一些问题:
   1. 当 drop table操作是,不应该直接从 ColocateTableIndex 中把 table 删除。因为 drop table 
实际是进入了 CatalogRecycleBin, 实际的表是在 CatalogRecycleBin 的 eraseTable 
中完成的。在erase前,表是可以被 recover 的。
   2. drop database 同上。
   
   # 增加查看 colocate group 的 proc
   
   `show proc '/colocate_group';`
   
   可以查看当前存在的 group以及其包含的表等一些信息。
   
   `show proc '/colocate_group/group_name';`
   
   可以查看这个group 的 backends buckets sequence
   
   
   # TODO
   
   1. 目前 colocate table 的副本均衡和修复还是交由 ColocateBalancer 来处理并对接 CloneChecker,后续会对接 
TabletScheduler。
   2. 因元数据变动较大,兼容性有待验证。

----------------------------------------------------------------
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]

Reply via email to