Skip to content

Commit

Permalink
fix bugs
Browse files Browse the repository at this point in the history
Signed-off-by: shuming.li <[email protected]>
  • Loading branch information
LiShuMing committed Aug 27, 2024
1 parent 49e6fe6 commit c004596
Show file tree
Hide file tree
Showing 2 changed files with 372 additions and 248 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,6 @@
import com.starrocks.common.Pair;
import com.starrocks.common.profile.Timer;
import com.starrocks.common.profile.Tracers;
import com.starrocks.common.util.concurrent.lock.LockType;
import com.starrocks.common.util.concurrent.lock.Locker;
import com.starrocks.privilege.SecurityPolicyRewriteRule;
import com.starrocks.qe.ConnectContext;
import com.starrocks.server.GlobalStateMgr;
Expand Down Expand Up @@ -1217,7 +1215,6 @@ public Table resolveTable(TableRelation tableRelation) {
}

MetaUtils.checkDbNullAndReport(db, dbName);
Locker locker = new Locker();

Table table = null;
if (tableRelation.isSyncMVQuery()) {
Expand All @@ -1228,17 +1225,11 @@ public Table resolveTable(TableRelation tableRelation) {
Table mvTable = materializedIndex.first;
Preconditions.checkState(mvTable != null);
Preconditions.checkState(mvTable instanceof OlapTable);
try {
// Add read lock to avoid concurrent problems.
locker.lockDatabase(db, LockType.READ);
OlapTable mvOlapTable = new OlapTable();
((OlapTable) mvTable).copyOnlyForQuery(mvOlapTable);
// Copy the necessary olap table meta to avoid changing original meta;
mvOlapTable.setBaseIndexId(materializedIndex.second.getIndexId());
table = mvOlapTable;
} finally {
locker.unLockDatabase(db, LockType.READ);
}
OlapTable mvOlapTable = new OlapTable();
((OlapTable) mvTable).copyOnlyForQuery(mvOlapTable);
// Copy the necessary olap table meta to avoid changing original meta;
mvOlapTable.setBaseIndexId(materializedIndex.second.getIndexId());
table = mvOlapTable;
}
}
} else {
Expand Down
Loading

0 comments on commit c004596

Please sign in to comment.