Tanya-W commented on code in PR #16371: URL: https://github.com/apache/doris/pull/16371#discussion_r1098264968
########## fe/fe-core/src/main/java/org/apache/doris/alter/SchemaChangeHandler.java: ########## @@ -2367,4 +2403,212 @@ public void replayModifyTableAddOrDropColumns(TableAddOrDropColumnsInfo info) th olapTable.writeUnlock(); } } + + // the invoker should keep table's write lock + public void modifyTableAddOrDropInvertedIndices(Database db, OlapTable olapTable, + Map<Long, LinkedList<Column>> indexSchemaMap, Map<String, String> propertyMap, + List<Index> indexes, List<Index> alterInvertedIndexes, + boolean isDropInvertedIndex, List<Index> oriIndexes, + long jobId, boolean isReplay) throws UserException { + LOG.info("begin to modify table's meta for add or drop inverted index. table: {}, job: {}", + olapTable.getName(), jobId); + LOG.info("indexSchemaMap:{}, indexes:{}, alterInvertedIndexes:{}, isDropInvertedIndex: {}", + indexSchemaMap, indexes, alterInvertedIndexes, isDropInvertedIndex); + if (olapTable.getState() == OlapTableState.ROLLUP) { + throw new DdlException("Table[" + olapTable.getName() + "]'s is doing ROLLUP job"); + } + + // for now table's state can only be NORMAL + Preconditions.checkState(olapTable.getState() == OlapTableState.NORMAL, olapTable.getState().name()); + + boolean hasInvertedIndexChange = false; + if (!alterInvertedIndexes.isEmpty()) { + hasInvertedIndexChange = true; + } + + // begin checking each table + // ATTN: DO NOT change any meta in this loop + Map<Long, List<Column>> changedIndexIdToSchema = Maps.newHashMap(); + for (Long alterIndexId : indexSchemaMap.keySet()) { + if (!hasInvertedIndexChange) { Review Comment: yes, updated -- 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. To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org 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