diff --git a/redundant-history/remove-redundant-commit-activity-activitystream-history.sql b/redundant-history/remove-redundant-commit-activity-activitystream-history.sql index 21525eb..6c2dcb9 100644 --- a/redundant-history/remove-redundant-commit-activity-activitystream-history.sql +++ b/redundant-history/remove-redundant-commit-activity-activitystream-history.sql @@ -29,8 +29,7 @@ set nocount on; begin tran; save tran TX declare @Commits table(CommitId char(36) collate Latin1_General_BIN2 not null) INSERT INTO @Commits SELECT CommitId FROM Commits WHERE - BucketId='Meta' - AND cast(Payload as varchar(max)) LIKE '%"EventType":"Changed"%' + cast(Payload as varchar(max)) LIKE '%"EventType":"Changed"%' AND cast(Payload as varchar(max)) LIKE '%"Changes":\[]%' ESCAPE '\'; DELETE FROM Commits WHERE CommitId IN (SELECT CommitId FROM @Commits) diff --git a/troubleshooting/current-activity-lag.sql b/troubleshooting/current-activity-lag.sql index 901e973..89b5865 100644 --- a/troubleshooting/current-activity-lag.sql +++ b/troubleshooting/current-activity-lag.sql @@ -1,19 +1,18 @@ ;with M as ( select Now=GETUTCDATE(), MaxSequence=cast(JSON_VALUE(Value, '$.MaxSequence') as int) - from Config + from Config where Instance='MetaStreamSubscription' and Type='CatchupSubscriptionManager' ), ActivityStreamCommits as ( select cast(CommitStamp as datetime) CommitStamp, CheckpointNumber, CommitSequence from Commits - where BucketId = 'Meta' and StreamId = '1EE3982777943C1BD64B154C4B5008DC0C3815A0' ), A as (select top 1 CommitStamp from ActivityStreamCommits order by CheckpointNumber desc), B as (select CommitStamp, Now from ActivityStreamCommits join M on M.MaxSequence=CommitSequence) -select +select Now, - Latest=A.CommitStamp, - Processed=B.CommitStamp, + Latest=A.CommitStamp, + Processed=B.CommitStamp, Behind_Min=CONVERT(FLOAT,A.CommitStamp - B.CommitStamp) * 24 * 60, --Decimal Minutes Lag_Min=CONVERT(FLOAT, Now - B.CommitStamp) * 24 * 60 --Decimal Minutes -from A,B \ No newline at end of file +from A,B diff --git a/troubleshooting/current-webhook-lag.sql b/troubleshooting/current-webhook-lag.sql index c085177..6e135ff 100644 --- a/troubleshooting/current-webhook-lag.sql +++ b/troubleshooting/current-webhook-lag.sql @@ -1,19 +1,18 @@ ;with M as ( select Now=GETUTCDATE(), MaxSequence=cast(JSON_VALUE(Value, '$.MaxSequence') as int) - from Config + from Config where Instance='MatcherSubscription' and Type='CatchupSubscriptionManager' ), ActivityStreamCommits as ( select cast(CommitStamp as datetime) CommitStamp, CheckpointNumber, CommitSequence from Commits - where BucketId = 'Meta' and StreamId = '1EE3982777943C1BD64B154C4B5008DC0C3815A0' ), A as (select top 1 CommitStamp from ActivityStreamCommits order by CheckpointNumber desc), B as (select CommitStamp, Now from ActivityStreamCommits join M on M.MaxSequence=CommitSequence) -select +select Now, - Latest=A.CommitStamp, - Processed=B.CommitStamp, + Latest=A.CommitStamp, + Processed=B.CommitStamp, Behind_Min=CONVERT(FLOAT,A.CommitStamp - B.CommitStamp) * 24 * 60, --Decimal Minutes Lag_Min=CONVERT(FLOAT, Now - B.CommitStamp) * 24 * 60 --Decimal Minutes -from A,B \ No newline at end of file +from A,B