Due to a scheduled upgrade to version 14.10, GitLab will be unavailabe on Monday 30.05., from 19:00 until 20:00.

Verified Commit 2f946fa0 authored by Sebastian Schüpbach's avatar Sebastian Schüpbach
Browse files

log more verbosly

parent 79d5be61
Pipeline #37776 passed with stages
in 5 minutes and 26 seconds
......@@ -44,7 +44,7 @@ trait BinaryHandler {
)
.foldLeft[List[String]](List())((errors, x) =>
if (!x._1) {
logger.warn(s"Deletion of file ${x._2} failed!")
logger.warn(s"Deletion of file ${x._2} failed${if (record.dryRun) " (dry-run mode)" else ""}!")
errors :+ s"${x._2} deletion failed"
} else {
errors
......@@ -52,7 +52,7 @@ trait BinaryHandler {
)
if (result.isEmpty) {
logger.debug(
s"Deletion of binaries for record ${record.recordId} successful"
s"Deletion of binaries for record ${record.recordId} successful${if (record.dryRun) " (dry-run mode)" else ""}"
)
record.setBinariesStatus(
ProcessingSuccess,
......@@ -60,7 +60,7 @@ trait BinaryHandler {
)
} else {
logger.warn(
s"Deletion of binaries for record ${record.recordId} failed"
s"Deletion of binaries for record ${record.recordId} failed${if (record.dryRun) " (dry-run mode)" else ""}"
)
record.setBinariesStatus(ProcessingFatal, result.mkString("; "))
}
......
......@@ -51,14 +51,38 @@ trait MariadbClient {
manifestV3Table: Boolean
): String = {
s"$resourceName entry deleted in tables " +
s"${if (entitiesTable) { "entities, " }
else { "" }}" +
s"${if (metadataTable) { "metadata, " }
else { "" }}" +
s"${if (manifestV2Table) { "iiif_manifests_v2, " }
else { "" }}" +
s"${if (manifestV3Table) { "iiif_manifests_v3" }
else { "" }}"
s"${
if (entitiesTable) {
"entities, "
}
else {
""
}
}" +
s"${
if (metadataTable) {
"metadata, "
}
else {
""
}
}" +
s"${
if (manifestV2Table) {
"iiif_manifests_v2, "
}
else {
""
}
}" +
s"${
if (manifestV3Table) {
"iiif_manifests_v3"
}
else {
""
}
}"
}
private def updateDigitalObjectResult(
......@@ -89,7 +113,7 @@ trait MariadbClient {
case Failure(ex) =>
record.setDigitalObjectStatus(
ProcessingFatal,
s"Digital object media DB entries deletion failed: ${ex.getMessage}"
s"Digital object media DB entries deletion failed${if (record.dryRun) " (dry-run mode)" else ""}: ${ex.getMessage}"
)
}
......@@ -106,13 +130,13 @@ trait MariadbClient {
// Something went wrong
record.setThumbnailStatus(
ProcessingFatal,
s"Poster entries deletion failed: ${e.getMessage}"
s"Poster entries deletion failed${if (record.dryRun) " (dry-run mode)" else ""}: ${e.getMessage}"
)
case (_, Failure(e)) =>
// Something went wrong
record.setThumbnailStatus(
ProcessingFatal,
s"Snippet entries deletion failed: ${e.getMessage}"
s"Snippet entries deletion failed${if (record.dryRun) " (dry-run mode)" else ""}: ${e.getMessage}"
)
case (`noRows`, `noRows`) =>
record.setThumbnailStatus(ProcessingIgnore, "No thumbnails found")
......@@ -189,6 +213,7 @@ trait MariadbClient {
Try(connection.commit())
}) match {
case Success(_) =>
logger.debug(s"MariaDB entries for record ${record.recordId} successfully deleted${if (record.dryRun) " (dry-run mode)" else ""}.")
val updatedRecord = updateDigitalObjectResult(
record,
digitalObjectDeletionResult
......@@ -199,6 +224,7 @@ trait MariadbClient {
introDeletionResult
)
case Failure(ex) =>
logger.warn(s"Deletion of MariaDB entries for record ${record.recordId} failed${if (record.dryRun) " (dry-run mode)" else ""}: ${ex.getMessage}.")
val updatedRecord = updateDigitalObjectResult(
record,
Failure(ex)
......@@ -228,6 +254,7 @@ trait MariadbClient {
/**
* Deletes related rows
*
* @param id Record's id
* @return An optional media file URI and success status for each row
*/
......
......@@ -73,23 +73,23 @@ trait MemobaseElasticClient {
}
.map {
case success: RequestSuccess[_] if success.status < 400 =>
logger.debug(s"Deletion of record ${record.recordId} successful")
logger.debug(s"Deletion of record ${record.recordId} successful${if (record.dryRun) " (dry-run mode)" else ""}")
record.setRecordStatus(
ProcessingSuccess,
"Record deletion in Elasticsearch successful"
)
case _: RequestSuccess[_] =>
logger.debug(s"Deletion of record ${record.recordId} failed since record does not exist")
logger.debug(s"Deletion of record ${record.recordId} failed since record does not exist${if (record.dryRun) " (dry-run mode)" else ""}")
record.setRecordStatus(
ProcessingIgnore,
"Record does not exist in Elasticearch"
)
case failure: RequestFailure =>
logger.warn(s"Deletion of record ${record.recordId} failed: ${failure.error.reason}")
logger.warn(s"Deletion of record ${record.recordId} failed${if (record.dryRun) " (dry-run mode)" else ""}: ${failure.error.reason}")
record.setRecordStatus(
ProcessingFatal,
s"Record deletion in Elasticsearch failed: ${failure.error.reason}"
s"Record deletion in Elasticsearch failed${if (record.dryRun) " (dry-run mode)" else ""}: ${failure.error.reason}"
)
}
.await
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment