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

Replication of operations on nested collections #6658

Merged
merged 3 commits into from
May 26, 2023

Conversation

jedelbo
Copy link
Contributor

@jedelbo jedelbo commented May 23, 2023

What, How & Why?

Make sure nested collections can be replicated through our legacy test framework.

☑️ ToDos

  • 📝 Changelog update
  • 🚦 Tests (or not relevant)
  • C-API, if public C++ API changed.

Copy link
Contributor

@kspangsege kspangsege left a comment

Choose a reason for hiding this comment

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

Looks good to me

else if (type == type_List) {
// throw IllegalOperation("Cannot sync nested list");
return Instruction::Payload(Instruction::Payload::List());
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Did you intend to keep the commented out throw statements?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We need to disallow syncing of nested collections until this is supported by the server. So at some point we should throw here,

Copy link
Contributor

Choose a reason for hiding this comment

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

Oh, I see 👍

Copy link
Collaborator

@danieltabacaru danieltabacaru May 26, 2023

Choose a reason for hiding this comment

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

Shouldn't we throw now and then update it to return the payload when we have server support? Edit: I guess we want it this way so we can test with the legacy sync server right? When will we want to throw then?

@danieltabacaru
Copy link
Collaborator

Some tests in the SyncTests suite are failing. You should run them locally to debug them easier.

@jedelbo
Copy link
Contributor Author

jedelbo commented May 24, 2023

@danieltabacaru fixed error.

@danieltabacaru
Copy link
Collaborator

@danieltabacaru fixed error.

Nice. There also seems to be a linting error.

@@ -345,6 +370,7 @@ struct Payload {
switch (lhs.type) {
case Type::Erased:
return true;
case Type::List:
Copy link
Collaborator

Choose a reason for hiding this comment

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

nit: [[fallthrough]];

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We don't use [[fallthrough]]; when the labels point to the same code. I collapsed even more cases.

@@ -185,6 +199,9 @@ struct Payload {
/// Note: For Mixed columns (including typed links), no separate value is required, because the
/// instruction set encodes the type of each value in the instruction.
enum class Type : int8_t {
// Special value indicating that a list should be created at the position.
List = -5,
Copy link
Collaborator

@danieltabacaru danieltabacaru May 24, 2023

Choose a reason for hiding this comment

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

Please update the comment at line 194. Do we also need an ErasedList option? Or if Erased should be used in both cases, then consider updation the comment as well.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Comment updated. We just use the normal Instruction::ArrayErase instruction.

@jedelbo jedelbo force-pushed the je/nested-collection-path branch from 6491145 to d2a07a9 Compare May 25, 2023 14:55
Base automatically changed from je/nested-collection-path to next-major May 25, 2023 14:56
@jedelbo jedelbo force-pushed the je/nested-collection-replication branch from ac41eaf to ec740cf Compare May 26, 2023 06:33
struct ObjectValue {
};
struct ObjectValue {};
/// Create an empty list in-place (does not clear an existing lsit).
Copy link
Collaborator

Choose a reason for hiding this comment

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

lsit -> list

{
ReadTransaction read_1{db_1};
ReadTransaction read_2{db_2};
// tr.get_group().to_json(std::cout);
Copy link
Collaborator

Choose a reason for hiding this comment

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

you should remove this. same below


{
ReadTransaction read_1{db_1};
ReadTransaction read_2{db_2};
Copy link
Collaborator

Choose a reason for hiding this comment

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

we could check both realms have the same data, i.e,:
CHECK(compare_groups(rt_1, rt_2));

Copy link
Contributor Author

Choose a reason for hiding this comment

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

👍

Copy link
Collaborator

@danieltabacaru danieltabacaru left a comment

Choose a reason for hiding this comment

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

Nice work

@jedelbo jedelbo force-pushed the je/nested-collection-replication branch from be93b1a to 2223b6d Compare May 26, 2023 13:46
@jedelbo jedelbo merged commit cd04591 into next-major May 26, 2023
1 of 2 checks passed
@jedelbo jedelbo deleted the je/nested-collection-replication branch May 26, 2023 13:46
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 21, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants