From 584ad71084b8e59aded917a3cb9a012a804086b4 Mon Sep 17 00:00:00 2001 From: David Whittington Date: Tue, 25 Jul 2023 17:22:05 -0500 Subject: [PATCH] feat(bundles debug): add more bundle timestamps to debug output PE-4212 Adds 'MAX' of 'last' timestamps on 'bundles' to help diagnose where the unbundling pipeline is getting stuck when there are issues. --- src/database/sql/bundles/stats.sql | 10 +++++++--- src/database/standalone-sqlite.ts | 12 ++++++++++-- 2 files changed, 17 insertions(+), 5 deletions(-) diff --git a/src/database/sql/bundles/stats.sql b/src/database/sql/bundles/stats.sql index 7dac0dfc..d083114f 100644 --- a/src/database/sql/bundles/stats.sql +++ b/src/database/sql/bundles/stats.sql @@ -2,15 +2,19 @@ SELECT COUNT(*) AS count, IFNULL(SUM(data_item_count), 0) AS data_item_count, - IFNULL(SUM(matched_data_item_count), 0) AS matched_data_item_count + IFNULL(SUM(matched_data_item_count), 0) AS matched_data_item_count, + IFNULL(MAX(last_queued_at), -1) AS max_queued_at, + IFNULL(MAX(last_skipped_at), -1) AS max_skipped_at, + IFNULL(MAX(last_unbundled_at), -1) AS max_unbundled_at, + IFNULL(MAX(last_fully_indexed_at), -1) AS max_fully_indexed_at FROM bundles -- selectDataItemStats SELECT SUM(data_item_count) AS data_item_count, SUM(nested_data_item_count) AS nested_data_item_count, - MAX(max_new_indexed_at) AS last_new_indexed_at, - MAX(max_stable_indexed_at) AS last_stable_indexed_at + MAX(max_new_indexed_at) AS max_new_indexed_at, + MAX(max_stable_indexed_at) AS max_stable_indexed_at FROM ( SELECT COUNT(*) AS data_item_count, diff --git a/src/database/standalone-sqlite.ts b/src/database/standalone-sqlite.ts index 957a3756..ee653a04 100644 --- a/src/database/standalone-sqlite.ts +++ b/src/database/standalone-sqlite.ts @@ -322,6 +322,10 @@ type DebugInfo = { }; timestamps: { now: number; + maxBundleQueuedAt: number; + maxBundleSkippedAt: number; + maxBundleUnbundledAt: number; + maxBundleFullyIndexedAt: number; maxStableDataItemIndexedAt: number; maxNewDataItemIndexedAt: number; }; @@ -946,8 +950,12 @@ export class StandaloneSqliteDatabaseWorker { }, timestamps: { now: currentUnixTimestamp(), - maxNewDataItemIndexedAt: dataItemStats.last_new_indexed_at, - maxStableDataItemIndexedAt: dataItemStats.last_stable_indexed_at, + maxBundleQueuedAt: bundleStats.max_queued_at, + maxBundleSkippedAt: bundleStats.max_skipped_at, + maxBundleUnbundledAt: bundleStats.max_unbundled_at, + maxBundleFullyIndexedAt: bundleStats.max_fully_indexed_at, + maxNewDataItemIndexedAt: dataItemStats.max_new_indexed_at, + maxStableDataItemIndexedAt: dataItemStats.max_stable_indexed_at, }, }; }