Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[fix](binlog) Add tableName to TableAddOrDropInvertedIndicesInfo #45332

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -2914,8 +2914,9 @@ public void modifyTableLightSchemaChange(String rawSql, Database db, OlapTable o

if (alterIndexes != null) {
if (!isReplay) {
TableAddOrDropInvertedIndicesInfo info = new TableAddOrDropInvertedIndicesInfo(rawSql, db.getId(),
olapTable.getId(), indexSchemaMap, indexes, alterIndexes, isDropIndex, jobId);
TableAddOrDropInvertedIndicesInfo info = new TableAddOrDropInvertedIndicesInfo(
rawSql, db.getId(), olapTable.getId(), olapTable.getName(),
indexSchemaMap, indexes, alterIndexes, isDropIndex, jobId);
if (LOG.isDebugEnabled()) {
LOG.debug("logModifyTableAddOrDropInvertedIndices info:{}", info);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -410,6 +410,11 @@ public void addReplaceTable(ReplaceTableOperationLog info, long commitSeq) {
}

public void addModifyTableAddOrDropInvertedIndices(TableAddOrDropInvertedIndicesInfo info, long commitSeq) {
if (StringUtils.isEmpty(info.getTableName())) {
LOG.warn("skip modify table add or drop inverted indices binlog, because tableName is empty. info: {}", info);
return;
}

long dbId = info.getDbId();
List<Long> tableIds = Lists.newArrayList();
tableIds.add(info.getTableId());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2086,15 +2086,11 @@ public void logModifyTableAddOrDropColumns(TableAddOrDropColumnsInfo info) {

public void logModifyTableAddOrDropInvertedIndices(TableAddOrDropInvertedIndicesInfo info) {
long logId = logEdit(OperationType.OP_MODIFY_TABLE_ADD_OR_DROP_INVERTED_INDICES, info);
LOG.info("walter log modify table add or drop inverted indices, infos: {}, json: {}",
info, info.toJson(), new RuntimeException("test"));
Env.getCurrentEnv().getBinlogManager().addModifyTableAddOrDropInvertedIndices(info, logId);
}

public void logIndexChangeJob(IndexChangeJob indexChangeJob) {
long logId = logEdit(OperationType.OP_INVERTED_INDEX_JOB, indexChangeJob);
LOG.info("walter log inverted index job, infos: {}, json: {}",
indexChangeJob, indexChangeJob.toJson(), new RuntimeException("test"));
Env.getCurrentEnv().getBinlogManager().addIndexChangeJob(indexChangeJob, logId);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ public class TableAddOrDropInvertedIndicesInfo implements Writable {
private long dbId;
@SerializedName(value = "tableId")
private long tableId;
@SerializedName(value = "tableName")
private String tableName; // not included in equals, default value is null
@SerializedName(value = "indexSchemaMap")
private Map<Long, LinkedList<Column>> indexSchemaMap;
@SerializedName(value = "indexes")
Expand All @@ -53,13 +55,14 @@ public class TableAddOrDropInvertedIndicesInfo implements Writable {
@SerializedName(value = "rawSql")
private String rawSql;

public TableAddOrDropInvertedIndicesInfo(String rawSql, long dbId, long tableId,
public TableAddOrDropInvertedIndicesInfo(String rawSql, long dbId, long tableId, String tableName,
Map<Long, LinkedList<Column>> indexSchemaMap, List<Index> indexes,
List<Index> alterInvertedIndexes, boolean isDropInvertedIndex,
long jobId) {
this.rawSql = rawSql;
this.dbId = dbId;
this.tableId = tableId;
this.tableName = tableName;
this.indexSchemaMap = indexSchemaMap;
this.indexes = indexes;
this.alterInvertedIndexes = alterInvertedIndexes;
Expand All @@ -75,6 +78,10 @@ public long getTableId() {
return tableId;
}

public String getTableName() {
return tableName;
}

public Map<Long, LinkedList<Column>> getIndexSchemaMap() {
return indexSchemaMap;
}
Expand Down Expand Up @@ -120,7 +127,7 @@ public boolean equals(Object obj) {

TableAddOrDropInvertedIndicesInfo info = (TableAddOrDropInvertedIndicesInfo) obj;

return (dbId == info.dbId && tableId == tableId
return (dbId == info.dbId && tableId == info.tableId
&& indexSchemaMap.equals(info.indexSchemaMap)
&& indexes.equals(info.indexes)
&& alterInvertedIndexes.equals(info.alterInvertedIndexes)
Expand Down
Loading