forked from lsmyrnaios/UrlsController
- When the Controller cannot retrieve any assignments from Impala (without an error), return an HTTP-"MULTI_STATUS" with an empty "AssignmentsResponse", instead of an "INTERNAL_SERVER_ERROR".
- Fix an error-message.
This commit is contained in:
parent
577ea983e8
commit
b0c57d79a5
|
@ -177,10 +177,12 @@ public class UrlController {
|
||||||
String errorMsg = "No results retrieved from the \"findAssignmentsQuery\" for worker with id: " + workerId + ". Will increase the \"maxAttempts\" to " + maxAttemptsPerRecordAtomic.incrementAndGet() + " for the next requests.";
|
String errorMsg = "No results retrieved from the \"findAssignmentsQuery\" for worker with id: " + workerId + ". Will increase the \"maxAttempts\" to " + maxAttemptsPerRecordAtomic.incrementAndGet() + " for the next requests.";
|
||||||
logger.error(errorMsg);
|
logger.error(errorMsg);
|
||||||
String tmpErrMsg = dropCurrentAssignmentTable();
|
String tmpErrMsg = dropCurrentAssignmentTable();
|
||||||
if ( tmpErrMsg != null )
|
|
||||||
errorMsg += "\n" + tmpErrMsg;
|
|
||||||
ImpalaConnector.databaseLock.unlock();
|
ImpalaConnector.databaseLock.unlock();
|
||||||
|
if ( tmpErrMsg != null ) {
|
||||||
|
errorMsg += "\n" + tmpErrMsg; // The additional error-msg is already logged.
|
||||||
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body(errorMsg);
|
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body(errorMsg);
|
||||||
|
} else
|
||||||
|
return ResponseEntity.status(HttpStatus.MULTI_STATUS).body(new AssignmentsResponse((long) -1, null));
|
||||||
} else if ( assignmentsSize < assignmentsLimit ) {
|
} else if ( assignmentsSize < assignmentsLimit ) {
|
||||||
logger.warn("The retrieved results were fewer (" + assignmentsSize + ") than the \"assignmentsLimit\" (" + assignmentsLimit + "), for worker with id: " + workerId + ". Will increase the \"maxAttempts\" to " + maxAttemptsPerRecordAtomic.incrementAndGet() + " for the next requests.");
|
logger.warn("The retrieved results were fewer (" + assignmentsSize + ") than the \"assignmentsLimit\" (" + assignmentsLimit + "), for worker with id: " + workerId + ". Will increase the \"maxAttempts\" to " + maxAttemptsPerRecordAtomic.incrementAndGet() + " for the next requests.");
|
||||||
}
|
}
|
||||||
|
@ -374,7 +376,7 @@ public class UrlController {
|
||||||
jdbcTemplate.execute(dropCurrentAssignmentsQuery);
|
jdbcTemplate.execute(dropCurrentAssignmentsQuery);
|
||||||
return null; // All good. No error-message.
|
return null; // All good. No error-message.
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
return ImpalaConnector.handleQueryException("dropCurrentAssignmentsQuery", dropCurrentAssignmentsQuery, e);
|
return ImpalaConnector.handleQueryException("dropCurrentAssignmentsQuery", dropCurrentAssignmentsQuery, e); // The error is already logged inside.
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -417,7 +417,7 @@ public class ParquetFileUtils {
|
||||||
// See: https://docs.cloudera.com/documentation/enterprise/latest/topics/impala_load_data.html
|
// See: https://docs.cloudera.com/documentation/enterprise/latest/topics/impala_load_data.html
|
||||||
|
|
||||||
} catch (Throwable e) {
|
} catch (Throwable e) {
|
||||||
String errorMsg = "Error while importing parquet data into the Impala Database, through WebHDFS!\n" + e;
|
String errorMsg = "Error while uploading parquet file \"" + parquetFileFullLocalPath + "\" to HDFS!\n" + e;
|
||||||
logger.error(errorMsg);
|
logger.error(errorMsg);
|
||||||
return errorMsg;
|
return errorMsg;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue