Skip to content
Merged
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 @@ -427,7 +427,7 @@ public void handleFinishAlterTask(AlterReplicaTask task) throws MetaNotFoundExce
if (replica == null) {
throw new MetaNotFoundException("replica " + task.getNewReplicaId() + " does not exist");
}

LOG.info("before handle alter task tablet {}, replica: {}, task version: {}-{}",
task.getSignature(), replica, task.getVersion(), task.getVersionHash());
boolean versionChanged = false;
Expand All @@ -445,7 +445,7 @@ public void handleFinishAlterTask(AlterReplicaTask task) throws MetaNotFoundExce
replica.getLastSuccessVersion(), replica.getLastSuccessVersionHash());
Catalog.getCurrentCatalog().getEditLog().logUpdateReplica(info);
}

LOG.info("after handle alter task tablet: {}, replica: {}", task.getSignature(), replica);
} finally {
tbl.writeUnlock();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -706,7 +706,7 @@ private void replayCreateJob(SchemaChangeJobV2 replayedJob) {

this.watershedTxnId = replayedJob.watershedTxnId;
jobState = JobState.WAITING_TXN;
LOG.info("replay pending schema change job: {}", jobId);
LOG.info("replay pending schema change job: {}, table id: {}", jobId, tableId);
}

/**
Expand Down Expand Up @@ -735,7 +735,7 @@ private void replayPendingJob(SchemaChangeJobV2 replayedJob) {
// should still be in WAITING_TXN state, so that the alter tasks will be resend again
this.jobState = JobState.WAITING_TXN;
this.watershedTxnId = replayedJob.watershedTxnId;
LOG.info("replay waiting txn schema change job: {}", jobId);
LOG.info("replay waiting txn schema change job: {} table id: {}", jobId, tableId);
}

/**
Expand Down
38 changes: 33 additions & 5 deletions fe/fe-core/src/main/java/org/apache/doris/catalog/Catalog.java
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,7 @@
import org.apache.doris.load.LoadChecker;
import org.apache.doris.load.LoadErrorHub;
import org.apache.doris.load.LoadJob;
import org.apache.doris.load.StreamLoadRecordMgr;
import org.apache.doris.load.loadv2.LoadEtlChecker;
import org.apache.doris.load.loadv2.LoadJobScheduler;
import org.apache.doris.load.loadv2.LoadLoadingChecker;
Expand All @@ -155,7 +156,6 @@
import org.apache.doris.load.routineload.RoutineLoadManager;
import org.apache.doris.load.routineload.RoutineLoadScheduler;
import org.apache.doris.load.routineload.RoutineLoadTaskScheduler;
import org.apache.doris.load.StreamLoadRecordMgr;
import org.apache.doris.master.Checkpoint;
import org.apache.doris.master.MetaHelper;
import org.apache.doris.meta.MetaContext;
Expand Down Expand Up @@ -225,14 +225,10 @@
import com.google.common.collect.Multimap;
import com.google.common.collect.Queues;
import com.google.common.collect.Sets;
import com.sleepycat.je.rep.InsufficientLogException;
import com.sleepycat.je.rep.NetworkRestore;
import com.sleepycat.je.rep.NetworkRestoreConfig;

import org.apache.commons.collections.CollectionUtils;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.codehaus.jackson.map.ObjectMapper;

import java.io.BufferedInputStream;
import java.io.BufferedReader;
Expand Down Expand Up @@ -262,6 +258,11 @@
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.concurrent.atomic.AtomicLong;

import com.sleepycat.je.rep.InsufficientLogException;
import com.sleepycat.je.rep.NetworkRestore;
import com.sleepycat.je.rep.NetworkRestoreConfig;
import org.codehaus.jackson.map.ObjectMapper;

public class Catalog {
private static final Logger LOG = LogManager.getLogger(Catalog.class);
// 0 ~ 9999 used for qe
Expand Down Expand Up @@ -4523,6 +4524,13 @@ private void unprotectUpdateReplica(ReplicaPersistInfo info) {
public void replayAddReplica(ReplicaPersistInfo info) {
Database db = getDb(info.getDbId());
OlapTable olapTable = (OlapTable) db.getTable(info.getTableId());
if (olapTable == null) {
/**
* Same as replayUpdateReplica()
*/
LOG.warn("Olap table is null when the add replica log is replayed, {}", info);
return;
}
olapTable.writeLock();
try {
unprotectAddReplica(info);
Expand All @@ -4534,6 +4542,19 @@ public void replayAddReplica(ReplicaPersistInfo info) {
public void replayUpdateReplica(ReplicaPersistInfo info) {
Database db = getDb(info.getDbId());
OlapTable olapTable = (OlapTable) db.getTable(info.getTableId());
if (olapTable == null) {
/**
* In the following cases, doris may record metadata modification information for a table that no longer exists.
* 1. Thread 1: get TableA object
* 2. Thread 2: lock db and drop table and record edit log of the dropped TableA
* 3. Thread 1: lock table, modify table and record edit log of the modified TableA
* **The modified edit log is after the dropped edit log**
* Because the table has been dropped, the olapTable in here is null when the modified edit log is replayed.
* So in this case, we will ignore the edit log of the modified table after the table is dropped.
*/
LOG.warn("Olap table is null when the update replica log is replayed, {}", info);
return;
}
olapTable.writeLock();
try {
unprotectUpdateReplica(info);
Expand All @@ -4554,6 +4575,13 @@ public void unprotectDeleteReplica(ReplicaPersistInfo info) {
public void replayDeleteReplica(ReplicaPersistInfo info) {
Database db = getDb(info.getDbId());
OlapTable tbl = (OlapTable) db.getTable(info.getTableId());
if (tbl == null) {
/**
* Same as replayUpdateReplica()
*/
LOG.warn("Olap table is null when the delete replica log is replayed, {}", info);
return;
}
tbl.writeLock();
try {
unprotectDeleteReplica(info);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -433,7 +433,7 @@ public Table getTable(long tableId) {
*/
public Table getTableOrThrowException(long tableId, TableType tableType) throws MetaNotFoundException {
Table table = idToTable.get(tableId);
if(table == null) {
if (table == null) {
throw new MetaNotFoundException("unknown table, tableId=" + tableId);
}
if (table.getType() != tableType) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -392,7 +392,6 @@ public String toString() {
sb.append("table id: ").append(tableId);
sb.append(" partition id: ").append(partitionId);
sb.append(" index id: ").append(indexId);
sb.append(" index id: ").append(indexId);
sb.append(" tablet id: ").append(tabletId);
sb.append(" backend id: ").append(backendId);
sb.append(" replica id: ").append(replicaId);
Expand Down