3030import com .google .edwmigration .dumper .application .dumper .task .TaskRunContextOps ;
3131import com .google .edwmigration .dumper .application .dumper .task .TaskSetState ;
3232import com .google .edwmigration .dumper .application .dumper .task .TaskState ;
33+ import java .io .IOException ;
3334import java .nio .charset .StandardCharsets ;
3435import java .sql .SQLException ;
3536import java .time .Duration ;
@@ -123,6 +124,9 @@ private void logProgress() {
123124 PROGRESS_LOG .info (progressMessage );
124125 }
125126
127+ private static final String ACCESS_CONTROL_EXCEPTION_MSG_SUFFIX =
128+ ".AccessControlException: SIMPLE authentication is not enabled. Available:[TOKEN, KERBEROS]" ;
129+
126130 private <T > T runTask (Task <T > task ) throws MetadataDumperUsageException {
127131 try {
128132 CHECK :
@@ -152,10 +156,16 @@ private <T> T runTask(Task<T> task) throws MetadataDumperUsageException {
152156 if (e instanceof MetadataDumperUsageException ) throw (MetadataDumperUsageException ) e ;
153157 if (e instanceof SQLException && e .getCause () instanceof MetadataDumperUsageException )
154158 throw (MetadataDumperUsageException ) e .getCause ();
159+ if (e instanceof IOException // is it a org.apache.hadoop.security.AccessControlException?
160+ && e .getMessage ().endsWith (ACCESS_CONTROL_EXCEPTION_MSG_SUFFIX )) {
161+ if (!task .handleException (e ))
162+ logger .warn ("Task failed due to access denied: {}: {}" , task , e .getMessage ());
163+ }
155164 // TaskGroup is an attempt to get rid of this condition.
156165 // We might need an additional TaskRunner / TaskSupport with an overrideable handleException
157166 // method instead of this runTask() method.
158- if (!task .handleException (e )) logger .warn ("Task failed: " + task + ": " + e , e );
167+ else if (!task .handleException (e ))
168+ logger .warn ("Task failed: {}: {}" , task , e .getMessage (), e );
159169 state .setTaskException (task , TaskState .FAILED , e );
160170 try {
161171 OutputHandle sink = context .newOutputFileHandle (task .getTargetPath () + ".exception.txt" );
@@ -166,7 +176,7 @@ private <T> T runTask(Task<T> task) throws MetadataDumperUsageException {
166176 "******************************" ,
167177 String .valueOf (new DumperDiagnosticQuery (e ).call ())));
168178 } catch (Exception f ) {
169- logger .warn ("Exception-recorder failed: " + f , f );
179+ logger .warn ("Exception-recorder failed: {}" , f . getMessage () , f );
170180 }
171181 }
172182 return null ;
0 commit comments