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

Deduplicate reports over (domain, org, reportid), not just over reportid #113

Merged
merged 1 commit into from
Jul 15, 2023
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
2 changes: 1 addition & 1 deletion dbx_Pg.pl
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
additional_definitions => "PRIMARY KEY (serial)",
table_options => "",
indexes => [
"CREATE UNIQUE INDEX report_uidx_domain ON report (domain, reportid);"
"CREATE UNIQUE INDEX report_uidx_domain ON report (domain, org, reportid);"
],
},
"rptrecord" => {
Expand Down
2 changes: 1 addition & 1 deletion dbx_mysql.pl
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
"policy_pct" , "tinyint" , "unsigned",
"raw_xml" , "mediumtext" , "",
],
additional_definitions => "PRIMARY KEY (serial), UNIQUE KEY domain (domain, reportid)",
additional_definitions => "PRIMARY KEY (serial), UNIQUE KEY domain (domain, org, reportid)",
table_options => "ROW_FORMAT=COMPRESSED",
indexes => [],
},
Expand Down
4 changes: 2 additions & 2 deletions dmarcts-report-parser.pl
Original file line number Diff line number Diff line change
Expand Up @@ -813,8 +813,8 @@ sub storeXMLInDatabase {
}

# see if already stored
my $sth = $dbh->prepare(qq{SELECT org, serial FROM report WHERE reportid=?});
$sth->execute($id);
my $sth = $dbh->prepare(qq{SELECT org, serial FROM report WHERE reportid=? AND org=? AND domain=?});
$sth->execute($id, $org, $domain);
while ( my ($xorg,$sid) = $sth->fetchrow_array() )
{
if ($reports_replace) {
Expand Down