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

Put channels in .channels subtrees in summary #5280

Merged
merged 47 commits into from
Mar 23, 2021

Conversation

arinwt
Copy link
Contributor

@arinwt arinwt commented Feb 26, 2021

Fixes #4706 by writing in new format version.
Actually need to leave the writing disabled. It turns out the prior PR to read in the new format was incomplete. Will want to aggressively turn this one as soon as possible.

Also rename some types and file from "snapshot" to "summary", i.e. snapshot.ts becomes summaryFormat.ts.

  • Add tests once Expose summarize with GC for tests #5242 goes in.
  • Figure out snapshot tests...
  • Fix other broken tests
  • Disable by default
  • Add more tests once we get summary handle testing in (after this PR).

@arinwt arinwt force-pushed the summary-name-collisions-write branch from 7eb03eb to d0f932a Compare February 26, 2021 09:14
@markfields
Copy link
Member

Side note...

Also rename some types and file from "snapshot" to "summary", i.e. snapshot.ts becomes summaryFormat.ts.

These two terms cause me a lot of confusion - is there a README or something that defines/contrasts them? Or is one just defunct and should be removed?

@arinwt
Copy link
Contributor Author

arinwt commented Mar 2, 2021

Side note...

Also rename some types and file from "snapshot" to "summary", i.e. snapshot.ts becomes summaryFormat.ts.

These two terms cause me a lot of confusion - is there a README or something that defines/contrasts them? Or is one just defunct and should be removed?

The short answer is that "snapshot" is defunct and should be removed. Summary is the term we use for the serialized state at a given sequence number, commonly referred to as a "snapshot" or point in time. The term "summary" comes from the idea that it is a summary of the op log, it just consolidates it into a single structure.

There is sort of an unintentional(?) distinction in the code: the snapshot types are used to represent the downloaded format, and the summary types for the uploaded format. So we upload an ISummaryTree and we download an ISnapshotTree. There will probably always be a difference between the download/upload types, because we can upload a handle and maybe some other "operation" information like GC flags, but I still think we should rename at some point though.

@arinwt arinwt force-pushed the summary-name-collisions-write branch from e3827a8 to 791c9ab Compare March 3, 2021 02:25
@arinwt arinwt marked this pull request as ready for review March 8, 2021 20:27
export type WriteFluidDataStoreAttributes = IFluidDataStoreAttributes2;

export function getAttributesFormatVersion(attributes: ReadFluidDataStoreAttributes): number {
if ("summaryFormatVersion" in attributes) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Is if (attributes.summaryFormatVersion) a more definitive check here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Do you mean in case it's undefined? Typescript won't allow that check by default, but I can change it to also verify that it is not undefined.

Copy link
Contributor

Choose a reason for hiding this comment

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

My question was more around the pattern - property in object vs object.property !== undefined. I am not sure if it makes a difference or if one is better than the other.

@@ -337,7 +341,7 @@ describe("Data Store Context Tests", () => {
it("can correctly initialize and generate attributes", async () => {
dataStoreAttributes = {
pkg: JSON.stringify(["TestDataStore1"]),
snapshotFormatVersion: "0.1",
summaryFormatVersion: 2,
isRootDataStore: true,
Copy link
Contributor

Choose a reason for hiding this comment

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

I was thinking of tests where these attributes in the initial snapshot for the data store has disableIsolatedChannels as true / false. And make sure we can read and process the snapshot accordingly.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I've made changes, let me know if this is what you're looking for. It now runs the initialization tests on all 8x combinations.

Read x4: v0, v1, v2, v2 + disableIsolatedChannels
Write x2: v1, v2

Copy link
Contributor

Choose a reason for hiding this comment

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

This looks good!

commits: {},
trees: {},
};
it("reading from latest without isolated channels", async () => testGenerateAttributesCore({
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you add another test case with disableIsolatedChannels: false. I understand that this attributes not being there means its false. But since this is a boolean and can accept false, we should have a test case to make sure we don't break this scenario.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It is typed as true | undefined.

Copy link
Contributor

Choose a reason for hiding this comment

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

oh okay! I looked at the one in IContainerRuntimeOptions and got confused :-).

@arinwt arinwt merged commit b692fe0 into microsoft:main Mar 23, 2021
DLehenbauer pushed a commit that referenced this pull request Apr 6, 2021
* Update lock-files

* Expose summarize function which returns tree

* Add simple summaries end-to-end test

* Increment summary format version and put data stores/dds under .channels subtrees

* Fix some tests

* Update basic summary test for subtrees

* Write in new format in all places

* Add runtime option to disable isolated channels

* Fix handling initial summary from attach op

* Strip out new format version features from snapshots in comparison

* Fix all broken tests and places where summaryFormatVersion matters

* Final fixes

* Update tests

* Add back missing skip

* Disable by default

* UseContainerRuntime for checking if disabled  on write; use helper functions when reading

* Fix tests

* Fix summaries test

* Snapshot should always include metadata blob

* Random lerna fix

* Do not modify snapshots for comparison

* Remove extra constructor arg

* only expose disableIsolatedChannels instead of entire ContainerRuntime

* Point to updated generated snapshot test data

* Inline formMetadata calls

* Switch datastore attributes to summaryFormatVersion

* Use undefined for metadata

* Small PR changes

* Add a few more tests

* Do not write in new format version unless isolated channels are enabled

* Revert snapshot test generation

* Fix summaries test

* Run all 8 combinations for intiialization

* PR comments

* Fix build
DLehenbauer pushed a commit that referenced this pull request Apr 6, 2021
* Update lock-files

* Expose summarize function which returns tree

* Add simple summaries end-to-end test

* Increment summary format version and put data stores/dds under .channels subtrees

* Fix some tests

* Update basic summary test for subtrees

* Write in new format in all places

* Add runtime option to disable isolated channels

* Fix handling initial summary from attach op

* Strip out new format version features from snapshots in comparison

* Fix all broken tests and places where summaryFormatVersion matters

* Final fixes

* Update tests

* Add back missing skip

* Disable by default

* UseContainerRuntime for checking if disabled  on write; use helper functions when reading

* Fix tests

* Fix summaries test

* Snapshot should always include metadata blob

* Random lerna fix

* Do not modify snapshots for comparison

* Remove extra constructor arg

* only expose disableIsolatedChannels instead of entire ContainerRuntime

* Point to updated generated snapshot test data

* Inline formMetadata calls

* Switch datastore attributes to summaryFormatVersion

* Use undefined for metadata

* Small PR changes

* Add a few more tests

* Do not write in new format version unless isolated channels are enabled

* Revert snapshot test generation

* Fix summaries test

* Run all 8 combinations for intiialization

* PR comments

* Fix build
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Summary Name Collisions - Write in New Format
5 participants