wangbo commented on issue #5390: URL: https://github.com/apache/incubator-doris/issues/5390#issuecomment-785557036
> @wangbo > > > 4 Master request the same create table request twice, the second request create a new table, but didn't write table to Edit log. And `ColocatePersistInfo` write to Edit log twice. > > According to the fourth step you said, the edit log was not written when the table was built, and ColocatePersistInfo write to Edit log twice. > Doesn't this cause the table to be lost directly after fe restarts? ``` public boolean createTableWithLock(Table table, boolean isReplay, boolean setIfNotExist) { boolean result = true; writeLock(); try { String tableName = table.getName(); if (nameToTable.containsKey(tableName)) { result = setIfNotExist; } else { idToTable.put(table.getId(), table); nameToTable.put(table.getName(), table); if (!isReplay) { // Write edit log CreateTableInfo info = new CreateTableInfo(fullQualifiedName, table); Catalog.getCurrentCatalog().getEditLog().logCreateTable(info); } if (table.getType() == TableType.ELASTICSEARCH) { Catalog.getCurrentCatalog().getEsRepository().registerTable((EsTable)table); } } return result; } finally { writeUnlock(); } } ``` The first request has already create the table successfully, which means the table info is written in edit log and memory. But the second request won't write tablet info into memory and edit log if use specify ```if not exists``` in create stmt, because the table is already created successfully. So the table won't be lost when restart. ---------------------------------------------------------------- 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: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org For additional commands, e-mail: commits-h...@doris.apache.org