Skip to content

Commit

Permalink
Revert "Empty compression messages" (microsoft#14370)
Browse files Browse the repository at this point in the history
Reverts microsoft#14261

The change surfaced a bug related to the compressed message metadata and
fired an incident in our stress tests.
  • Loading branch information
andre4i committed Mar 1, 2023
1 parent c58c54a commit a51cda1
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -45,16 +45,7 @@ export class OpCompressor {
});

for (const message of batch.content.slice(1)) {
// Add an empty placeholder message to reserve the sequence numbers
messages.push({
deserializedContent: {
contents: undefined,
type: message.deserializedContent.type,
},
localOpMetadata: undefined,
metadata: undefined,
referenceSequenceNumber: message.referenceSequenceNumber,
});
messages.push({ ...message, contents: undefined });
}

const compressedBatch: IBatch = {
Expand Down
10 changes: 5 additions & 5 deletions packages/runtime/container-runtime/src/opLifecycle/outbox.ts
Original file line number Diff line number Diff line change
Expand Up @@ -233,12 +233,12 @@ export class Outbox {
if (this.params.containerContext.submitBatchFn === undefined) {
// Legacy path - supporting old loader versions. Can be removed only when LTS moves above
// version that has support for batches (submitBatchFn)
assert(
batch.content[0].compression === undefined,
"Compression should not have happened if the loader does not support it",
);

for (const message of batch.content) {
// Legacy path doesn't support compressed payloads and will submit uncompressed payload anyways
if (message.metadata?.compressed) {
delete message.metadata.compressed;
}

this.params.containerContext.submitFn(
MessageType.Operation,
message.deserializedContent,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,12 +59,6 @@ describe("OpCompressor", () => {
if (compressedBatch.content.length > 1) {
assert.strictEqual(compressedBatch.content[1].contents, undefined);
assert.strictEqual(compressedBatch.content[1].compression, undefined);
assert.strictEqual(compressedBatch.content[1].metadata, undefined);
assert.strictEqual(compressedBatch.content[1].localOpMetadata, undefined);
assert.strictEqual(
compressedBatch.content[1].deserializedContent.contents,
undefined,
);
}
});
}));
Expand Down

0 comments on commit a51cda1

Please sign in to comment.