Skip to content

Don't reference Commits.BucketId and .StreamId #38

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
11 changes: 5 additions & 6 deletions troubleshooting/current-activity-lag.sql
Original file line number Diff line number Diff line change
@@ -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'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As Pavel mentioned, this should be tested, because without this filters I've seen poor execution plans on allstate db

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

),
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
from A,B
11 changes: 5 additions & 6 deletions troubleshooting/current-webhook-lag.sql
Original file line number Diff line number Diff line change
@@ -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
from A,B