Skip to content

Commit

Permalink
ImportAuditConsumerWorker: fixed new audit PK violation detection
Browse files Browse the repository at this point in the history
Previously the checked string accidentally implied default partition,
now it works with any partition as expected.
  • Loading branch information
virgo47 committed Dec 17, 2021
1 parent d3fbcf6 commit e3efeb8
Showing 1 changed file with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,8 @@ public void run() {
} catch (Exception ex) {
Throwable cause = ExceptionUtil.findRootCause(ex);
// Short message for existing audit event conflict, but only for new repo
if (cause.toString().contains("duplicate key value violates unique constraint \"ma_audit_event_default_pkey\"")) {
if (cause.toString().contains("duplicate key value violates unique constraint \"ma_audit_event_")
&& cause.toString().contains("Detail: Key (id, \"timestamp\")")) {
context.getLog().info("Audit already exists, skipping ({}, {})",
auditRecord.getRepoId(), auditRecord.getTimestamp());
operation.incrementSkipped(); // TODO: skipped or still error? also, info or error?
Expand Down

0 comments on commit e3efeb8

Please sign in to comment.