@fluidframework/container-runtime 1.2.3-84921 → 1.2.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/containerRuntime.d.ts.map +1 -1
- package/dist/containerRuntime.js +36 -15
- package/dist/containerRuntime.js.map +1 -1
- package/dist/packageVersion.d.ts +1 -1
- package/dist/packageVersion.d.ts.map +1 -1
- package/dist/packageVersion.js +1 -1
- package/dist/packageVersion.js.map +1 -1
- package/dist/runningSummarizer.d.ts +14 -0
- package/dist/runningSummarizer.d.ts.map +1 -1
- package/dist/runningSummarizer.js +25 -0
- package/dist/runningSummarizer.js.map +1 -1
- package/dist/summarizer.d.ts.map +1 -1
- package/dist/summarizer.js +33 -3
- package/dist/summarizer.js.map +1 -1
- package/lib/containerRuntime.d.ts.map +1 -1
- package/lib/containerRuntime.js +36 -15
- package/lib/containerRuntime.js.map +1 -1
- package/lib/packageVersion.d.ts +1 -1
- package/lib/packageVersion.d.ts.map +1 -1
- package/lib/packageVersion.js +1 -1
- package/lib/packageVersion.js.map +1 -1
- package/lib/runningSummarizer.d.ts +14 -0
- package/lib/runningSummarizer.d.ts.map +1 -1
- package/lib/runningSummarizer.js +25 -0
- package/lib/runningSummarizer.js.map +1 -1
- package/lib/summarizer.d.ts.map +1 -1
- package/lib/summarizer.js +35 -5
- package/lib/summarizer.js.map +1 -1
- package/package.json +14 -14
- package/src/containerRuntime.ts +60 -32
- package/src/packageVersion.ts +1 -1
- package/src/runningSummarizer.ts +33 -1
- package/src/summarizer.ts +46 -10
package/lib/containerRuntime.js
CHANGED
|
@@ -1647,16 +1647,19 @@ export class ContainerRuntime extends TypedEventEmitter {
|
|
|
1647
1647
|
const summaryNumberLogger = ChildLogger.create(summaryLogger, undefined, {
|
|
1648
1648
|
all: { summaryNumber },
|
|
1649
1649
|
});
|
|
1650
|
+
let latestSnapshotVersionId;
|
|
1650
1651
|
if (refreshLatestAck) {
|
|
1651
|
-
const
|
|
1652
|
-
|
|
1652
|
+
const latestSnapshotInfo = await this.refreshLatestSummaryAckFromServer(ChildLogger.create(summaryNumberLogger, undefined, { all: { safeSummary: true } }));
|
|
1653
|
+
const latestSnapshotRefSeq = latestSnapshotInfo.latestSnapshotRefSeq;
|
|
1654
|
+
latestSnapshotVersionId = latestSnapshotInfo.latestSnapshotVersionId;
|
|
1655
|
+
if (latestSnapshotRefSeq > this.deltaManager.lastSequenceNumber) {
|
|
1653
1656
|
// We need to catch up to the latest summary's reference sequence number before pausing.
|
|
1654
1657
|
await PerformanceEvent.timedExecAsync(summaryNumberLogger, {
|
|
1655
1658
|
eventName: "WaitingForSeq",
|
|
1656
1659
|
lastSequenceNumber: this.deltaManager.lastSequenceNumber,
|
|
1657
|
-
targetSequenceNumber:
|
|
1660
|
+
targetSequenceNumber: latestSnapshotRefSeq,
|
|
1658
1661
|
lastKnownSeqNumber: this.deltaManager.lastKnownSeqNumber,
|
|
1659
|
-
}, async () => waitForSeq(this.deltaManager,
|
|
1662
|
+
}, async () => waitForSeq(this.deltaManager, latestSnapshotRefSeq), { start: true, end: true, cancel: "error" });
|
|
1660
1663
|
}
|
|
1661
1664
|
}
|
|
1662
1665
|
try {
|
|
@@ -1755,18 +1758,35 @@ export class ContainerRuntime extends TypedEventEmitter {
|
|
|
1755
1758
|
if (!continueResult.continue) {
|
|
1756
1759
|
return Object.assign(Object.assign({ stage: "generate" }, generateSummaryData), { error: continueResult.error });
|
|
1757
1760
|
}
|
|
1761
|
+
// It may happen that the lastAck it not correct due to missing summaryAck in case of single commit
|
|
1762
|
+
// summary. So if the previous summarizer closes just after submitting the summary and before
|
|
1763
|
+
// submitting the summaryOp then we can't rely on summaryAck. So in case we have
|
|
1764
|
+
// latestSnapshotVersionId from storage and it does not match with the lastAck ackHandle, then use
|
|
1765
|
+
// the one fetched from storage as parent as that is the latest.
|
|
1758
1766
|
const lastAck = this.summaryCollection.latestAck;
|
|
1759
|
-
|
|
1760
|
-
|
|
1767
|
+
let summaryContext;
|
|
1768
|
+
if ((lastAck === null || lastAck === void 0 ? void 0 : lastAck.summaryAck.contents.handle) !== latestSnapshotVersionId
|
|
1769
|
+
&& latestSnapshotVersionId !== undefined) {
|
|
1770
|
+
summaryContext = {
|
|
1771
|
+
proposalHandle: undefined,
|
|
1772
|
+
ackHandle: latestSnapshotVersionId,
|
|
1773
|
+
referenceSequenceNumber: summaryRefSeqNum,
|
|
1774
|
+
};
|
|
1775
|
+
}
|
|
1776
|
+
else if (lastAck === undefined) {
|
|
1777
|
+
summaryContext = {
|
|
1761
1778
|
proposalHandle: undefined,
|
|
1762
1779
|
ackHandle: (_c = this.context.getLoadedFromVersion()) === null || _c === void 0 ? void 0 : _c.id,
|
|
1763
1780
|
referenceSequenceNumber: summaryRefSeqNum,
|
|
1764
|
-
}
|
|
1765
|
-
|
|
1781
|
+
};
|
|
1782
|
+
}
|
|
1783
|
+
else {
|
|
1784
|
+
summaryContext = {
|
|
1766
1785
|
proposalHandle: lastAck.summaryOp.contents.handle,
|
|
1767
1786
|
ackHandle: lastAck.summaryAck.contents.handle,
|
|
1768
1787
|
referenceSequenceNumber: summaryRefSeqNum,
|
|
1769
1788
|
};
|
|
1789
|
+
}
|
|
1770
1790
|
let handle;
|
|
1771
1791
|
try {
|
|
1772
1792
|
handle = await this.storage.uploadSummaryWithContext(summarizeResult.summary, summaryContext);
|
|
@@ -2012,12 +2032,13 @@ export class ContainerRuntime extends TypedEventEmitter {
|
|
|
2012
2032
|
/** Implementation of ISummarizerInternalsProvider.refreshLatestSummaryAck */
|
|
2013
2033
|
async refreshLatestSummaryAck(proposalHandle, ackHandle, summaryRefSeq, summaryLogger) {
|
|
2014
2034
|
const readAndParseBlob = async (id) => readAndParse(this.storage, id);
|
|
2015
|
-
const
|
|
2035
|
+
const { snapshotTree } = await this.fetchSnapshotFromStorage(ackHandle, summaryLogger, {
|
|
2016
2036
|
eventName: "RefreshLatestSummaryGetSnapshot",
|
|
2017
2037
|
ackHandle,
|
|
2018
2038
|
summaryRefSeq,
|
|
2019
2039
|
fetchLatest: false,
|
|
2020
|
-
})
|
|
2040
|
+
});
|
|
2041
|
+
const result = await this.summarizerNode.refreshLatestSummary(proposalHandle, summaryRefSeq, async () => snapshotTree, readAndParseBlob, summaryLogger);
|
|
2021
2042
|
// Notify the garbage collector so it can update its latest summary state.
|
|
2022
2043
|
await this.garbageCollector.latestSummaryStateRefreshed(result, readAndParseBlob);
|
|
2023
2044
|
}
|
|
@@ -2028,16 +2049,16 @@ export class ContainerRuntime extends TypedEventEmitter {
|
|
|
2028
2049
|
* @returns downloaded snapshot's reference sequence number
|
|
2029
2050
|
*/
|
|
2030
2051
|
async refreshLatestSummaryAckFromServer(summaryLogger) {
|
|
2031
|
-
const
|
|
2052
|
+
const { snapshotTree, versionId } = await this.fetchSnapshotFromStorage(null, summaryLogger, {
|
|
2032
2053
|
eventName: "RefreshLatestSummaryGetSnapshot",
|
|
2033
2054
|
fetchLatest: true,
|
|
2034
2055
|
});
|
|
2035
2056
|
const readAndParseBlob = async (id) => readAndParse(this.storage, id);
|
|
2036
|
-
const
|
|
2037
|
-
const result = await this.summarizerNode.refreshLatestSummary(undefined,
|
|
2057
|
+
const latestSnapshotRefSeq = await seqFromTree(snapshotTree, readAndParseBlob);
|
|
2058
|
+
const result = await this.summarizerNode.refreshLatestSummary(undefined, latestSnapshotRefSeq, async () => snapshotTree, readAndParseBlob, summaryLogger);
|
|
2038
2059
|
// Notify the garbage collector so it can update its latest summary state.
|
|
2039
2060
|
await this.garbageCollector.latestSummaryStateRefreshed(result, readAndParseBlob);
|
|
2040
|
-
return
|
|
2061
|
+
return { latestSnapshotRefSeq, latestSnapshotVersionId: versionId };
|
|
2041
2062
|
}
|
|
2042
2063
|
async fetchSnapshotFromStorage(versionId, logger, event) {
|
|
2043
2064
|
return PerformanceEvent.timedExecAsync(logger, event, async (perfEvent) => {
|
|
@@ -2050,7 +2071,7 @@ export class ContainerRuntime extends TypedEventEmitter {
|
|
|
2050
2071
|
assert(!!maybeSnapshot, 0x138 /* "Failed to get snapshot from storage" */);
|
|
2051
2072
|
stats.getSnapshotDuration = trace.trace().duration;
|
|
2052
2073
|
perfEvent.end(stats);
|
|
2053
|
-
return maybeSnapshot;
|
|
2074
|
+
return { snapshotTree: maybeSnapshot, versionId: versions[0].id };
|
|
2054
2075
|
});
|
|
2055
2076
|
}
|
|
2056
2077
|
notifyAttaching(snapshot) {
|