HDFS-14140. JournalNodeSyncer authentication is failing in secure cluster. Contributed by Surendra Singh Lilhore.
Signed-off-by: Wei-Chiu Chuang <weichiu@apache.org> (cherry picked from commit4be87353e3
) (cherry picked from commit2501fcd26b
)
This commit is contained in:
parent
49d54633e0
commit
1f4be45ef6
|
@ -38,6 +38,7 @@ import org.apache.hadoop.hdfs.util.DataTransferThrottler;
|
||||||
import org.apache.hadoop.ipc.ProtobufRpcEngine;
|
import org.apache.hadoop.ipc.ProtobufRpcEngine;
|
||||||
import org.apache.hadoop.ipc.RPC;
|
import org.apache.hadoop.ipc.RPC;
|
||||||
import org.apache.hadoop.security.SecurityUtil;
|
import org.apache.hadoop.security.SecurityUtil;
|
||||||
|
import org.apache.hadoop.security.UserGroupInformation;
|
||||||
import org.apache.hadoop.util.Daemon;
|
import org.apache.hadoop.util.Daemon;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
@ -439,17 +440,25 @@ public class JournalNodeSyncer {
|
||||||
File tmpEditsFile = jnStorage.getTemporaryEditsFile(
|
File tmpEditsFile = jnStorage.getTemporaryEditsFile(
|
||||||
log.getStartTxId(), log.getEndTxId());
|
log.getStartTxId(), log.getEndTxId());
|
||||||
|
|
||||||
|
if (!SecurityUtil.doAsLoginUser(() -> {
|
||||||
|
if (UserGroupInformation.isSecurityEnabled()) {
|
||||||
|
UserGroupInformation.getCurrentUser().checkTGTAndReloginFromKeytab();
|
||||||
|
}
|
||||||
try {
|
try {
|
||||||
Util.doGetUrl(url, ImmutableList.of(tmpEditsFile), jnStorage, false,
|
Util.doGetUrl(url, ImmutableList.of(tmpEditsFile), jnStorage, false,
|
||||||
logSegmentTransferTimeout, throttler);
|
logSegmentTransferTimeout, throttler);
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
LOG.error("Download of Edit Log file for Syncing failed. Deleting temp " +
|
LOG.error("Download of Edit Log file for Syncing failed. Deleting temp "
|
||||||
"file: " + tmpEditsFile);
|
+ "file: " + tmpEditsFile, e);
|
||||||
if (!tmpEditsFile.delete()) {
|
if (!tmpEditsFile.delete()) {
|
||||||
LOG.warn("Deleting " + tmpEditsFile + " has failed");
|
LOG.warn("Deleting " + tmpEditsFile + " has failed");
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
return true;
|
||||||
|
})) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
LOG.info("Downloaded file " + tmpEditsFile.getName() + " of size " +
|
LOG.info("Downloaded file " + tmpEditsFile.getName() + " of size " +
|
||||||
tmpEditsFile.length() + " bytes.");
|
tmpEditsFile.length() + " bytes.");
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue