From b76630806d43427ddcdef8cd6efd110c731668a5 Mon Sep 17 00:00:00 2001
From: Bryan Newbold <bnewbold@archive.org>
Date: Tue, 8 Feb 2022 16:57:16 -0800
Subject: sql: script to reingest recent spn2 lookup failure in bulk mode

---
 sql/dump_reingest_bulk.sql | 25 +++++++++++++++++++++++++
 1 file changed, 25 insertions(+)
 create mode 100644 sql/dump_reingest_bulk.sql

(limited to 'sql/dump_reingest_bulk.sql')

diff --git a/sql/dump_reingest_bulk.sql b/sql/dump_reingest_bulk.sql
new file mode 100644
index 0000000..403fb20
--- /dev/null
+++ b/sql/dump_reingest_bulk.sql
@@ -0,0 +1,25 @@
+
+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'
+            OR ingest_request.ingest_type = 'html')
+        AND ingest_file_result.hit = false
+        AND ingest_request.created < NOW() - '24 hour'::INTERVAL
+        AND ingest_request.created > NOW() - '181 day'::INTERVAL
+        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 'petabox-error'
+        )
+        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'
+        AND ingest_file_result.status != 'spn2-error:blocked-url'
+        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_bulk_current.rows.json';
-- 
cgit v1.2.3

