Skip to content
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

Add the Fix for Missing Ops Log, and telemetry for the Ops from the Last Service Summary #12295

Merged
merged 12 commits into from
Oct 13, 2022
34 changes: 22 additions & 12 deletions server/routerlicious/packages/lambdas/src/scribe/summaryWriter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -280,11 +280,11 @@ export class SummaryWriter implements ISummaryWriter {
uploadHandle = commit.sha;

await (existingRef ? requestWithRetry(
async () => this.summaryStorage.upsertRef(this.documentId, uploadHandle),
"writeClientSummary_upsertRef",
this.lumberProperties,
shouldRetryNetworkError,
this.maxRetriesOnError) : requestWithRetry(
async () => this.summaryStorage.upsertRef(this.documentId, uploadHandle),
"writeClientSummary_upsertRef",
this.lumberProperties,
shouldRetryNetworkError,
this.maxRetriesOnError) : requestWithRetry(
async () => this.summaryStorage.createRef(this.documentId, uploadHandle),
"writeClientSummary_createRef",
this.lumberProperties,
Expand Down Expand Up @@ -515,16 +515,20 @@ export class SummaryWriter implements ISummaryWriter {
logTail;

// Check the missing operations in the fullLogTail
if (fullLogTail.length !== (to - from - 1)) {
const fullLogTailSequenceNumbers = fullLogTail?.map((ms) => ms.sequenceNumber);
const isSameSNInterval = fullLogTailSequenceNumbers &&
tianzhu007 marked this conversation as resolved.
Show resolved Hide resolved
fullLogTailSequenceNumbers.length > 0 &&
fullLogTailSequenceNumbers.length === (to - from - 1) &&
from === fullLogTailSequenceNumbers[0] - 1 &&
to === fullLogTailSequenceNumbers[fullLogTailSequenceNumbers.length - 1] + 1;
if (!isSameSNInterval) {
const missingOpsSequenceNumbers: number[] = [];
const fullLogTailSequenceNumbers = fullLogTail.map((ms) => ms.sequenceNumber);
let j = 0;
const fullLogTailSequenceNumbersSet = new Set();
fullLogTailSequenceNumbers.forEach((op) => fullLogTailSequenceNumbersSet.add(op));
for (let i = from + 1; i < to; i++) {
if (i === fullLogTailSequenceNumbers[j]) {
j++;
continue;
if (!fullLogTailSequenceNumbersSet.has(i)) {
tianzhu007 marked this conversation as resolved.
Show resolved Hide resolved
missingOpsSequenceNumbers.push(i);
}
missingOpsSequenceNumbers.push(i);
}
Lumberjack.error(`Missing ops in the fullLogTail: ${JSON.stringify(missingOpsSequenceNumbers)}`
, this.lumberProperties);
Expand Down Expand Up @@ -557,6 +561,12 @@ export class SummaryWriter implements ISummaryWriter {
logTail.forEach((ms) => logtailSequenceNumbers.add(ms.sequenceNumber));
const missingOps = lastSummaryMessages?.filter((ms) =>
!(logtailSequenceNumbers.has(ms.sequenceNumber)));
const missingOpsSN: number[] = [];
missingOps?.forEach((op) => missingOpsSN.push(op.sequenceNumber));
if (missingOpsSN.length > 0) {
Lumberjack.info(`Fetched ops from last summary logtail: ${JSON.stringify(missingOpsSN)}`
, this.lumberProperties);
}
return missingOps;
}

Expand Down