aboutsummaryrefslogtreecommitdiffstats
path: root/sql/dump_reingest_weekly.sql
diff options
context:
space:
mode:
Diffstat (limited to 'sql/dump_reingest_weekly.sql')
-rw-r--r--sql/dump_reingest_weekly.sql81
1 files changed, 15 insertions, 66 deletions
diff --git a/sql/dump_reingest_weekly.sql b/sql/dump_reingest_weekly.sql
index e7cd553..65800eb 100644
--- a/sql/dump_reingest_weekly.sql
+++ b/sql/dump_reingest_weekly.sql
@@ -3,11 +3,19 @@ COPY (
SELECT row_to_json(ingest_request.*) FROM ingest_request
LEFT JOIN ingest_file_result ON ingest_file_result.base_url = ingest_request.base_url
WHERE ingest_request.ingest_type = 'pdf'
- AND ingest_file_result.ingest_type = 'pdf'
+ AND ingest_file_result.hit = false
AND ingest_request.created < NOW() - '8 hour'::INTERVAL
AND ingest_request.created > NOW() - '8 day'::INTERVAL
- AND ingest_file_result.hit = false
- AND ingest_file_result.status like 'spn2-%'
+ AND (ingest_request.ingest_request_source = 'fatcat-changelog'
+ OR ingest_request.ingest_request_source = 'fatcat-ingest')
+ AND (
+ ingest_file_result.status like 'spn2-%'
+ -- OR ingest_file_result.status like 'cdx-error'
+ -- OR ingest_file_result.status like 'wayback-error'
+ -- OR ingest_file_result.status like 'wayback-content-error'
+ OR ingest_file_result.status like 'petabox-error'
+ -- OR ingest_file_result.status like 'gateway-timeout'
+ )
AND ingest_file_result.status != 'spn2-error:invalid-url-syntax'
AND ingest_file_result.status != 'spn2-error:filesize-limit'
AND ingest_file_result.status != 'spn2-error:not-found'
@@ -15,68 +23,9 @@ COPY (
AND ingest_file_result.status != 'spn2-error:too-many-redirects'
AND ingest_file_result.status != 'spn2-error:network-authentication-required'
AND ingest_file_result.status != 'spn2-error:unknown'
-) TO '/srv/sandcrawler/tasks/reingest_weekly_spn2-error_current.rows.json';
+) TO '/srv/sandcrawler/tasks/reingest_weekly_current.rows.json';
-COPY (
- SELECT row_to_json(ingest_request.*) FROM ingest_request
- LEFT JOIN ingest_file_result ON ingest_file_result.base_url = ingest_request.base_url
- WHERE ingest_request.ingest_type = 'pdf'
- AND ingest_file_result.ingest_type = 'pdf'
- AND ingest_file_result.hit = false
- AND ingest_file_result.status like 'cdx-error'
- AND ingest_request.created < NOW() - '8 hour'::INTERVAL
- AND ingest_request.created > NOW() - '8 day'::INTERVAL
- AND (ingest_request.ingest_request_source = 'fatcat-changelog'
- OR ingest_request.ingest_request_source = 'fatcat-ingest')
-) TO '/srv/sandcrawler/tasks/reingest_weekly_cdx-error_current.rows.json';
-
-COPY (
- SELECT row_to_json(ingest_request.*) FROM ingest_request
- LEFT JOIN ingest_file_result ON ingest_file_result.base_url = ingest_request.base_url
- WHERE ingest_request.ingest_type = 'pdf'
- AND ingest_file_result.ingest_type = 'pdf'
- AND ingest_file_result.hit = false
- AND ingest_file_result.status like 'cdx-error'
- AND ingest_request.created < NOW() - '8 hour'::INTERVAL
- AND ingest_request.created > NOW() - '8 day'::INTERVAL
- AND (ingest_request.ingest_request_source != 'fatcat-changelog'
- AND ingest_request.ingest_request_source != 'fatcat-ingest')
-) TO '/srv/sandcrawler/tasks/reingest_weekly_cdx-error_bulk_current.rows.json';
-
-COPY (
- SELECT row_to_json(ingest_request.*) FROM ingest_request
- LEFT JOIN ingest_file_result ON ingest_file_result.base_url = ingest_request.base_url
- WHERE ingest_request.ingest_type = 'pdf'
- AND ingest_file_result.ingest_type = 'pdf'
- AND ingest_file_result.hit = false
- AND ingest_file_result.status like 'wayback-error'
- AND ingest_request.created < NOW() - '8 hour'::INTERVAL
- AND ingest_request.created > NOW() - '8 day'::INTERVAL
-) TO '/srv/sandcrawler/tasks/reingest_weekly_wayback-error_current.rows.json';
-
-COPY (
- SELECT row_to_json(ingest_request.*) FROM ingest_request
- LEFT JOIN ingest_file_result ON ingest_file_result.base_url = ingest_request.base_url
- WHERE ingest_request.ingest_type = 'pdf'
- AND ingest_file_result.ingest_type = 'pdf'
- AND ingest_file_result.hit = false
- AND ingest_file_result.status like 'gateway-timeout'
- AND ingest_request.created < NOW() - '8 hour'::INTERVAL
- AND ingest_request.created > NOW() - '8 day'::INTERVAL
- AND (ingest_request.ingest_request_source = 'fatcat-changelog'
- OR ingest_request.ingest_request_source = 'fatcat-ingest')
-) TO '/srv/sandcrawler/tasks/reingest_weekly_gateway-timeout.rows.json';
-
-COPY (
- SELECT row_to_json(ingest_request.*) FROM ingest_request
- LEFT JOIN ingest_file_result ON ingest_file_result.base_url = ingest_request.base_url
- WHERE ingest_request.ingest_type = 'pdf'
- AND ingest_file_result.ingest_type = 'pdf'
- AND ingest_file_result.hit = false
- AND ingest_file_result.status like 'petabox-error'
- AND ingest_request.created < NOW() - '8 hour'::INTERVAL
- AND ingest_request.created > NOW() - '8 day'::INTERVAL
- AND (ingest_request.ingest_request_source = 'fatcat-changelog'
- OR ingest_request.ingest_request_source = 'fatcat-ingest')
-) TO '/srv/sandcrawler/tasks/reingest_weekly_petabox-error_current.rows.json';
+-- bulk re-tries would be:
+-- AND (ingest_request.ingest_request_source != 'fatcat-changelog'
+-- AND ingest_request.ingest_request_source != 'fatcat-ingest')