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

PROPOSAL Plan for fixing Cassandra inconsistencies #3125

Closed
wants to merge 9 commits into from

Conversation

chibenwa
Copy link
Member

No description provided.

@chibenwa chibenwa added this to the Sprint 15 - Robusta Beans milestone Feb 19, 2020
@chibenwa chibenwa self-assigned this Feb 19, 2020

This plan makes the following assumption:

- We are not willing to rewrite mailbox/cassandra with event sourcing

Choose a reason for hiding this comment

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

"because we think we can find solutions that are cheaper that, without being perfect, would allow reduce inconsistency"

That's it?

Copy link
Member Author

Choose a reason for hiding this comment

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

That's it.

I would complete:

  • because I think event sourcing with a cassandra tooling don't allow to realistically implement mailbox/cassandra.

Choose a reason for hiding this comment

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

because I think event sourcing with a cassandra tooling don't allow to realistically implement mailbox/cassandra.

It would be an valid argument if we had a realistic plan B.

BTW, It's not because you don't know yet how to implement it with Event Sourcing that it's not realistic. Given the complexity of problems we have to face without Event Sourcing, I'm confident to say that it would probably be easier (but less incremental) to jump in the ES boat.

Let's see if that plan works

Copy link
Member Author

@chibenwa chibenwa Feb 20, 2020

Choose a reason for hiding this comment

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

It would be an valid argument if we had a realistic plan B.

I'm trying to propose a realistic (incremental) plan B given that no plan A is well specified.

Choose a reason for hiding this comment

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

Of course.

I just want to document why we didn't consider ES so that we can challenge those reasons later.

This plan makes the following assumption:

- We are not willing to rewrite mailbox/cassandra with event sourcing
- We will rather identify projections and how to heal them

Choose a reason for hiding this comment

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

what does "identify projections" mean?

Copy link
Member Author

Choose a reason for hiding this comment

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

I adopted a broad definition: "data is duplicated across 2 tables"

Choose a reason for hiding this comment

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

I can't understand the sentence: "instead of doing ES we will rather identify data that are duplicated accross at least 2 tables and how to heal them"

You probably mean "try to identify possibly inconsistent duplicated information"? Don't you?


This plan makes the following assumption:

- We are not willing to rewrite mailbox/cassandra with event sourcing

Choose a reason for hiding this comment

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

because I think event sourcing with a cassandra tooling don't allow to realistically implement mailbox/cassandra.

It would be an valid argument if we had a realistic plan B.

BTW, It's not because you don't know yet how to implement it with Event Sourcing that it's not realistic. Given the complexity of problems we have to face without Event Sourcing, I'm confident to say that it would probably be easier (but less incremental) to jump in the ES boat.

Let's see if that plan works

This plan makes the following assumption:

- We are not willing to rewrite mailbox/cassandra with event sourcing
- We will rather identify projections and how to heal them

Choose a reason for hiding this comment

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

I can't understand the sentence: "instead of doing ES we will rather identify data that are duplicated accross at least 2 tables and how to heal them"

You probably mean "try to identify possibly inconsistent duplicated information"? Don't you?


(prioritized) this section present the conclusion of this studu which details can be found below.

## Grooming

Choose a reason for hiding this comment

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

Does that mean "we still have to figure out what are performance characteristics of LWT and counters"?

Copy link
Member Author

Choose a reason for hiding this comment

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

More: does the performance cost of LWT have a real impact for us.

Copy link
Member

Choose a reason for hiding this comment

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

LWT -> "lightweight transactions" right? (tried to catch up on those^^)


# Details

## mailbox/mailboxPath

Choose a reason for hiding this comment

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

Could we have a classical structured analysis:

  • problem statement "tables X, used to get x from y, and table Y, used to get x from z, are written in the following ordering ... that could lead to entries written in ... but not ... The impacts are ..."
  • solutions: "we can use ... as a source of truth to fix ... assuming ... limitations are ..."
  • implementation: ...

Copy link
Member Author

@chibenwa chibenwa Feb 20, 2020

Choose a reason for hiding this comment

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

I will rework the form tommorrow if you wish.

Hopefully we'll have a debate on the merits.

Copy link
Member

@Arsnael Arsnael left a comment

Choose a reason for hiding this comment

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

Thank you for this analysis, it was a good read about our Cassandra tables and inconsistencies that could emerge from our code with it


(prioritized) this section present the conclusion of this studu which details can be found below.

## Grooming
Copy link
Member

Choose a reason for hiding this comment

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

LWT -> "lightweight transactions" right? (tried to catch up on those^^)

inconsistencies.md Outdated Show resolved Hide resolved
inconsistencies.md Outdated Show resolved Hide resolved
`mailbox` (op1) to remove it from `mailboxPathV2` (op2) and finally we update the `mailbox` to reference it with
new path (op3). If op1, op2 or op3 fails, we have an entry conflict that might require merging the mailboxes.
- Delete: We remove the `mailbox` entry, and finally the `mailboxPathV2`. If partially applied,
then we can have an orphan `mailboxPathV2`. The corresponding mailbox don't exist, but can't either be created.

Choose a reason for hiding this comment

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

don't we have a design issue here? mailboxPathV2 should be a projection but keep the truth about the existence of the mailbox. While mailbox is the main table which can be used to rebuild the projection(s) but is not seen as the table of truth.

Copy link
Member Author

Choose a reason for hiding this comment

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

That's a specificity here yes. Sounds like the source of truth is mailbox as it contains the UID_VALIDITY. Also an immutable identifier sounds like also a desirable property from a source of truth.

Nevertheless we have an invariant on the name that we need to apply. That's why all of this looks a bit brittle.

But the good news is that's it is a behavior that only happen for mailboxes.

Choose a reason for hiding this comment

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

now that we see there are issues related, see https://issues.apache.org/jira/browse/JAMES-3074 what about having UID_VALIDITY in the mailboxPath table instead?

Copy link
Member Author

@chibenwa chibenwa Feb 25, 2020

Choose a reason for hiding this comment

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

Also an immutable identifier sounds like also a desirable property from a source of truth

(you won't solve all the issues).

Choose a reason for hiding this comment

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

Putting another domain object into the mailboxPath table, then I wonder is this still be mailboxPath or something else? like mailbox metadata....

Copy link
Member Author

Choose a reason for hiding this comment

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

Naming here is the least of my concerns ;-)

@chibenwa chibenwa closed this Aug 31, 2021
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.

5 participants