imay commented on a change in pull request #246: Colocate Join (#245)
URL: https://github.com/apache/incubator-doris/pull/246#discussion_r231485965
 
 

 ##########
 File path: fe/src/main/java/org/apache/doris/catalog/Catalog.java
 ##########
 @@ -3376,12 +3477,36 @@ private Table createOlapTable(Database db, 
CreateTableStmt stmt, boolean isResto
                 if (!db.createTableWithLock(olapTable, false, 
stmt.isSetIfNotExists())) {
                     
ErrorReport.reportDdlException(ErrorCode.ERR_CANT_CREATE_TABLE, tableName, 
"table already exists");
                 }
+
+                //we have added these index to memory, only need to persist 
here
+                if (olapTable.getColocateTable() != null) {
+                    Long groupId = 
db.getTable(olapTable.getColocateTable()).getId();
+                    ColocatePersistInfo info = 
ColocatePersistInfo.CreateForAddTable(tableId, groupId, db.getId());
+                    editLog.logColocateAddTable(info);
+
+                    if 
(getColocateTableIndex().isColocateParentTable(tableId)) {
+                        List<List<Long>> backendsPerBucketSeq = 
getColocateTableIndex().getBackendsPerBucketSeq(groupId);
+                        info = 
ColocatePersistInfo.CreateForBackendsPerBucketSeq(groupId, 
backendsPerBucketSeq);
+                        editLog.logColocateBackendsPerBucketSeq(info);
+                    }
 
 Review comment:
   We must keep metadata keep consistent. If one operation failed, we should 
guarantee that thing can still work.
   
   Following is a suggest.
   
   If we `createTableWithLock ` first, and log another operation 
`logChangeTableToColocate`.  And     if the second log failed, we also have 
complete meta, which have a table without colocate property. 
   
   Can this method work and be implemented easily. 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@doris.apache.org
For additional commands, e-mail: dev-h...@doris.apache.org

Reply via email to