@@ -88,7 +88,6 @@ public class DataWriter {
8888 private HiveMetaStore hiveMetaStore ;
8989 private HiveUtil hive ;
9090 private Queue <Future <Void >> hiveUpdateFutures ;
91- private Thread ticketRenewThread ;
9291 private volatile boolean isRunning ;
9392
9493 public DataWriter (
@@ -269,16 +268,10 @@ private void configureKerberosAuthentication(Configuration hadoopConfiguration)
269268
270269 UserGroupInformation .setConfiguration (hadoopConfiguration );
271270 // replace the _HOST specified in the principal config to the actual host
272- String principal = SecurityUtil .getServerPrincipal (
273- connectorConfig .connectHdfsPrincipal (),
274- hostname
275- );
276- UserGroupInformation .loginUserFromKeytab (principal , connectorConfig .connectHdfsKeytab ());
277271 final UserGroupInformation ugi = UserGroupInformation .getLoginUser ();
278272 log .info ("Login as: " + ugi .getUserName ());
279273
280274 isRunning = true ;
281- ticketRenewThread = new Thread (() -> renewKerberosTicket (ugi ));
282275 } catch (UnknownHostException e ) {
283276 throw new ConnectException (
284277 String .format (
@@ -293,12 +286,6 @@ private void configureKerberosAuthentication(Configuration hadoopConfiguration)
293286 e
294287 );
295288 }
296-
297- log .info (
298- "Starting the Kerberos ticket renew thread with period {} ms." ,
299- connectorConfig .kerberosTicketRenewPeriodMs ()
300- );
301- ticketRenewThread .start ();
302289 }
303290
304291 private void initializeHiveServices (Configuration hadoopConfiguration ) {
@@ -511,13 +498,6 @@ public void stop() {
511498 }
512499
513500 storage .close ();
514-
515- if (ticketRenewThread != null ) {
516- synchronized (this ) {
517- isRunning = false ;
518- this .notifyAll ();
519- }
520- }
521501 }
522502
523503 public Partitioner getPartitioner () {
@@ -666,26 +646,4 @@ private Map<String, Object> copyConfig(HdfsSinkConnectorConfig config) {
666646 map .put (PartitionerConfig .TIMEZONE_CONFIG , config .getString (PartitionerConfig .TIMEZONE_CONFIG ));
667647 return map ;
668648 }
669-
670- private void renewKerberosTicket (UserGroupInformation ugi ) {
671- synchronized (DataWriter .this ) {
672- while (isRunning ) {
673- try {
674- DataWriter .this .wait (connectorConfig .kerberosTicketRenewPeriodMs ());
675- if (isRunning ) {
676- log .debug ("Attempting re-login from keytab for user: {}" , ugi .getUserName ());
677- ugi .reloginFromKeytab ();
678- }
679- } catch (IOException e ) {
680- // We ignore this exception during relogin as each successful relogin gives
681- // additional 24 hours of authentication in the default config. In normal
682- // situations, the probability of failing relogin 24 times is low and if
683- // that happens, the task will fail eventually.
684- log .error ("Error renewing the ticket" , e );
685- } catch (InterruptedException e ) {
686- // ignored
687- }
688- }
689- }
690- }
691649}
0 commit comments