Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes #15372: Missing logs on NodeCompliance archive/deletion #2357

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -363,7 +363,9 @@ class UpdateExpectedReportsJdbcRepository(
val msg ="Could not archive NodeConfigurations in the database, cause is " + ex.getMessage()
logger.error(msg)
Failure(msg, Full(ex), Empty)
case Right(i) => Full(i.sum)
case Right(i) =>
logger.debug(s"Successfully archived ${i.sum} nodeconfigurations before ${dateAt_0000}")
Full(i.sum)
}
}

Expand Down Expand Up @@ -391,7 +393,9 @@ class UpdateExpectedReportsJdbcRepository(
val msg ="Could not delete NodeConfigurations in the database, cause is " + ex.getMessage()
logger.error(msg)
Failure(msg, Full(ex), Empty)
case Right(i) => Full(i.sum)
case Right(i) =>
logger.debug(s"Successfully deleted ${i.sum} nodeconfigurations before ${dateAt_0000}")
Full(i.sum)
}
}

Expand Down Expand Up @@ -427,7 +431,9 @@ class UpdateExpectedReportsJdbcRepository(
val msg ="Could not archive NodeCompliance in the database, cause is " + ex.getMessage()
logger.error(msg)
Failure(msg, Full(ex), Empty)
case Right(i) => Full(i.sum)
case Right(i) =>
logger.debug(s"Successfully archived ${i.sum} Node Compliances before ${dateAt_0000}")
Full(i.sum)
}
}

Expand Down Expand Up @@ -455,7 +461,9 @@ class UpdateExpectedReportsJdbcRepository(
val msg ="Could not delete NodeCompliance in the database, cause is " + ex.getMessage()
logger.error(msg)
Failure(msg, Full(ex), Empty)
case Right(i) => Full(i.sum)
case Right(i) =>
logger.debug(s"Successfully deleted ${i.sum} Node Compliances before ${dateAt_0000}")
Full(i.sum)
}
}

Expand All @@ -480,7 +488,9 @@ class UpdateExpectedReportsJdbcRepository(
val msg ="Could not delete NodeCompliance in the database, cause is " + ex.getMessage()
logger.error(msg)
Failure(msg, Full(ex), Empty)
case Right(i) => Full(i)
case Right(i) =>
logger.debug(s"Successfully deleted ${i} Node Compliances levels before ${dateAt_0000}")
Full(i)
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -187,14 +187,16 @@ class ReportsJdbcRepository(doobie: Doobie) extends ReportsRepository with Logga
_ = logger.debug("Archiving and deleting done, starting to vacuum reports table")
// Vacuum cannot be run in a transaction block, it has to be in an autoCommit block
_ <- (FC.setAutoCommit(true) *> Update0(vacuum, None).run <* FC.setAutoCommit(false)).transact(xa).attempt.unsafeRunSync
_ = logger.debug(s"Successfully vacuumed table ${reports}")
} yield {
i
}) match {
case Left(ex) =>
val msg ="Could not archive entries in the database, cause is " + ex.getMessage()
logger.error(msg)
Failure(msg, Full(ex), Empty)
case Right(i) => Full(i.sum)
case Right(i) =>
Full(i.sum)
}
}
}) match {
Expand Down