[Bug] Fix bug that failed to write meta image of load job (#5029)

In #4863, we add userInfo in load job, but the userInfo must be analyzed
so that it can be written to the image.
This commit is contained in:
Mingyu Chen
2020-12-08 10:00:42 +08:00
committed by GitHub
parent eb0cb04a70
commit 2dbcb726ac
3 changed files with 14 additions and 11 deletions

View File

@ -48,12 +48,15 @@ public class UserIdentity implements Writable {
public static final UserIdentity ROOT;
public static final UserIdentity ADMIN;
public static final UserIdentity UNKNOWN;
static {
ROOT = new UserIdentity(PaloAuth.ROOT_USER, "%");
ROOT.setIsAnalyzed();
ADMIN = new UserIdentity(PaloAuth.ADMIN_USER, "%");
ADMIN.setIsAnalyzed();
UNKNOWN = new UserIdentity(PaloAuth.UNKNOWN_USER, "%");
UNKNOWN.setIsAnalyzed();
}
private UserIdentity() {

View File

@ -45,14 +45,14 @@ import org.apache.doris.qe.SqlModeHelper;
import org.apache.doris.transaction.TabletCommitInfo;
import org.apache.doris.transaction.TransactionState;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import com.google.common.base.Strings;
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import com.google.common.collect.Sets;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import java.io.DataInput;
import java.io.DataOutput;
import java.io.IOException;
@ -340,8 +340,10 @@ public abstract class BulkLoadJob extends LoadJob {
if (Catalog.getCurrentCatalogJournalVersion() >= FeMetaVersion.VERSION_93) {
userInfo = UserIdentity.read(in);
// must set is as analyzed, because when write the user info to meta image, it will be checked.
userInfo.setIsAnalyzed();
} else {
userInfo = new UserIdentity("","");
userInfo = UserIdentity.UNKNOWN;
}
if (Catalog.getCurrentCatalogJournalVersion() >= FeMetaVersion.VERSION_66) {
int size = in.readInt();
@ -359,8 +361,4 @@ public abstract class BulkLoadJob extends LoadJob {
public UserIdentity getUserInfo() {
return userInfo;
}
public void setUserInfo(UserIdentity userInfo) {
this.userInfo = userInfo;
}
}

View File

@ -45,14 +45,14 @@ import org.apache.doris.qe.ConnectContext;
import org.apache.doris.thrift.TFetchResourceResult;
import org.apache.doris.thrift.TPrivilegeStatus;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import com.google.common.base.Joiner;
import com.google.common.base.Preconditions;
import com.google.common.collect.Lists;
import com.google.common.collect.Sets;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import java.io.DataInput;
import java.io.DataOutput;
import java.io.IOException;
@ -68,6 +68,8 @@ public class PaloAuth implements Writable {
// each Palo system has only one root user.
public static final String ROOT_USER = "root";
public static final String ADMIN_USER = "admin";
// unknown user does not have any privilege, this is just to be compatible with old version.
public static final String UNKNOWN_USER = "unknown";
private UserPrivTable userPrivTable = new UserPrivTable();
private DbPrivTable dbPrivTable = new DbPrivTable();