Skip to content

Commit

Permalink
fix 24h ticket mannut reinit
Browse files Browse the repository at this point in the history
  • Loading branch information
flaming-archer committed Apr 24, 2024
1 parent 86176c4 commit b3758e3
Showing 1 changed file with 14 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,16 @@
import java.io.Closeable;
import java.io.IOException;
import java.net.URI;
import java.security.PrivilegedExceptionAction;
import java.time.Duration;
import java.util.Objects;
import java.util.Random;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicInteger;

import javax.security.sasl.SaslException;

import org.apache.hadoop.hive.conf.HiveConf;
import org.apache.hadoop.hive.conf.HiveConf.ConfVars;
import org.apache.hadoop.hive.conf.HiveConfUtil;
Expand Down Expand Up @@ -216,13 +219,22 @@ void createMetastoreClientAndOpen(String delegationToken, HiveUgiArgs ugiArgs) {
MetaStoreUtils.getMetaStoreSaslProperties(conf, useSsl));
} else {
String principalConfig = conf.getVar(ConfVars.METASTORE_KERBEROS_PRINCIPAL);
transport = KerberosSaslHelper
.getKerberosTransport(principalConfig, store.getHost(), transport,
transport = UserGroupInformation.getLoginUser().doAs(
(PrivilegedExceptionAction<TTransport>) () -> {
try {
return KerberosSaslHelper
.getKerberosTransport(principalConfig, store.getHost(), transport,
MetaStoreUtils.getMetaStoreSaslProperties(conf, useSsl), false);
} catch (SaslException e) {
throw new RuntimeException(e);
}
});
}
} catch (IOException ioe) {
log.error("Couldn't create client transport, URI " + store, ioe);
throw new MetaException(ioe.toString());
} catch (InterruptedException e) {
throw new RuntimeException(e);
}
} else if (useFramedTransport) {
transport = new TFramedTransport(transport);
Expand Down

0 comments on commit b3758e3

Please sign in to comment.