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

Investigate otto vs diamond types divergence #8

Open
amascolo opened this issue Aug 24, 2022 · 1 comment
Open

Investigate otto vs diamond types divergence #8

amascolo opened this issue Aug 24, 2022 · 1 comment

Comments

@amascolo
Copy link
Contributor

We have run diamond types' fuzzing test, comparing otto and diamond types side-by-side.

Otto agents converge to a common state. Diamond types agents converge to a common state.

In some cases, however, this common state isn't the same for otto and diamond types.

Even on unordered document contents – i.e. excluding cases where the changes appear in reverse order.

It would be interesting to see if we can tweak otto's behaviour to match diamond types' exactly.


Test case:

#[test]
#[ignore] // TODO investigate why otto and diamond types diverge on unordered contents
fn oplog_merge_fuzz_once() {
oplog_merge_fuzz::<3, true>(4197);

Raw dump:

i 0
random operations at agent: 0
Operation { loc: RangeRev { span: T 0..1, fwd: true }, kind: Ins, content: Some("a") }
random operations at agent: 2
Operation { loc: RangeRev { span: T 0..1, fwd: true }, kind: Ins, content: Some("a") }
syncing agents: 0 ↔ 2
diamond types (before): a
diamond types (before): a
diamond types (after): aa
otto (before): a
otto (before): a
otto (after): aa


i 1
random operations at agent: 1
Operation { loc: RangeRev { span: T 0..1, fwd: true }, kind: Ins, content: Some("a") }
random operations at agent: 0
Operation { loc: RangeRev { span: T 1..2, fwd: true }, kind: Del, content: Some("a") }
syncing agents: 1 ↔ 2
diamond types (before): a
diamond types (before): aa
diamond types (after): aaa
otto (before): a
otto (before): aa
otto (after): aaa


i 2
random operations at agent: 2
Operation { loc: RangeRev { span: T 0..2, fwd: true }, kind: Del, content: Some("aa") }
random operations at agent: 1
Operation { loc: RangeRev { span: T 2..3, fwd: true }, kind: Del, content: Some("a") }
syncing agents: 0 ↔ 2
diamond types (before): a
diamond types (before): a
diamond types (after): 
otto (before): a
otto (before): a
otto (after): a

Diagrams showing otto's behaviour:

┌────0────┐    ┌────1────┐    ┌────2────┐
└────∅────┘    └────∅────┘    └────∅────┘

random operations at agent: 0

┌────0────┐    ┌────1────┐    ┌────2────┐
│ 0 ins a │    └────∅────┘    └────∅────┘
└────a────┘

random operations at agent: 2

┌────0────┐    ┌────1────┐    ┌────2────┐
│ 0 ins a │    └────∅────┘    │ 2 ins a │
└────a────┘                   └────a────┘

syncing agents: 0 ↔ 2

     ┌ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ┐
     |                             ▼
┌────0────┐    ┌────1────┐    ┌────2────┐
│ 0 ins a │    └────∅────┘    │ 2 ins a │
│ 2 ins a │                   │ 0 ins a │
└────aa───┘                   └────aa───┘
     ▲                             |
     └ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ┘



random operations at agent: 1

┌────0────┐    ┌────1────┐    ┌────2────┐
│ 0 ins a │    │ 1 ins a │    │ 2 ins a │
│ 2 ins a │    └────a────┘    │ 0 ins a │
└────aa───┘                   └────aa───┘

random operations at agent: 0

┌────0────┐    ┌────1────┐    ┌────2────┐
│ 0 ins a │    │ 1 ins a │    │ 2 ins a │
│ 2 ins a │    └────a────┘    │ 0 ins a │
│ 0 del a │                   └────aa───┘
└────a────┘

syncing agents: 1 ↔ 2

                    ┌ ─ ─ ─ ─ ─ ─ ─┐
                    |              ▼
┌────0────┐    ┌────1────┐    ┌────2────┐
│ 0 ins a │    │ 1 ins a │    │ 2 ins a │
│ 2 ins a │    │ 2 ins a │    │ 0 ins a │
│ 0 del a │    │ 0 ins a │    │ 1 ins a │
└────a────┘    └───aaa───┘    └───aaa───┘
                    ▲              |
                    └─ ─ ─ ─ ─ ─ ─ ┘



random operations at agent: 2

┌────0────┐    ┌────1────┐    ┌────2────┐
│ 0 ins a │    │ 1 ins a │    │ 2 ins a │
│ 2 ins a │    │ 2 ins a │    │ 0 ins a │
│ 0 del a │    │ 0 ins a │    │ 1 ins a │
└────a────┘    └───aaa───┘    │ 2 del aa│
                              └────a────┘

random operations at agent: 1

┌────0────┐    ┌────1────┐    ┌────2────┐
│ 0 ins a │    │ 1 ins a │    │ 2 ins a │
│ 2 ins a │    │ 2 ins a │    │ 0 ins a │
│ 0 del a │    │ 0 ins a │    │ 1 ins a │
└────a────┘    │ 1 del a │    │ 2 del aa│
               └────aa───┘    └────a────┘

syncing agents: 0 ↔ 2

     ┌ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ┐
     |                             ▼
┌────0────┐    ┌────1────┐    ┌────2────┐
│ 0 ins a │    │ 1 ins a │    │ 2 ins a │
│ 2 ins a │    │ 2 ins a │    │ 0 ins a │
│ 0 del a │    │ 0 ins a │    │ 1 ins a │
│ 1 ins a │    │ 1 del a │    │ 2 del aa│
│ 2 del aa│    └────aa───┘    │ 0 del a │
└────∅────┘                   └────∅────┘
     ▲                             |
     └ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ┘
@tablyinc tablyinc deleted a comment from amascolo Aug 24, 2022
@amascolo
Copy link
Contributor Author

amascolo commented Sep 2, 2022

Experimented with assigning each instruction a unique ID, but no change in behaviour main@{ac7c412}...unique-ids

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

No branches or pull requests

1 participant