News for hackers. Stuff that matters.
Re:Cassandra at Apple: 1000s of Clusters, 300k Nodes, 100 PB by _benedict on Saturday October 08, 2022 @07:07PM (#33136906)
Your statement about data propagation in that linked comment is at least misleading. A write at quorum will always be visible instantly to a read at quorum.
Re:Cassandra at Apple: 1000s of Clusters, 300k Nodes, 100 PB by GauntletWizard on Saturday October 08, 2022 @09:34PM (#33137578)
And nobody does reads at quorum, they're slow. People do reads at closest, even when they really need quorum.
Re:Cassandra at Apple: 1000s of Clusters, 300k Nodes, 100 PB by jjirsa on Saturday October 08, 2022 @09:53PM (#33137663)
Except they definitely do use it and many actually need it
Re:Cassandra at Apple: 1000s of Clusters, 300k Nodes, 100 PB by YZF on Sunday October 09, 2022 @12:36AM (#33138308)
I don't think that's true. Can't speak for everybody but for the stuff I worked on. Quorum reads at RF=3 are only twice as slow as reading a single node and it's pretty practical, if you care about it, to write and read using quorum writes/reads. It's true there's many applications where you're ok with some time not reading your latest data, and for those you can get somewhere better performance/latency for a given scale by going CL=ONE...
Re:Cassandra at Apple: 1000s of Clusters, 300k Nodes, 100 PB by mping on Sunday October 09, 2022 @02:48AM (#33138759)
Unless they want "read your writes", otherwise bugs start appearing "why isn't the data i just put showing"?
Re:Cassandra at Apple: 1000s of Clusters, 300k Nodes, 100 PB by staticassertion on Sunday October 09, 2022 @12:52AM (#33138359)
What happens if you send the 'write' to 3 nodes but only 2 are up?
Re:Cassandra at Apple: 1000s of Clusters, 300k Nodes, 100 PB by _benedict on Sunday October 09, 2022 @01:53AM (#33138569)
Nothing bad? That’s the whole point of quorum reads and writes. You write to at least two, and read from at least two (one typically being a digest-only to corroborate the result).

This is all done for you by Cassandra

Re:Cassandra at Apple: 1000s of Clusters, 300k Nodes, 100 PB by alanfranz on Sunday October 09, 2022 @02:43AM (#33138747)
It depends on the consistency level you set for writing.

If you have 3 nodes, set quorum cl, the write will succeed, because quorum of 3 is at least 2.

If you explicitly require cl of three, and only two nodes answer, write will fail.

Re:Cassandra at Apple: 1000s of Clusters, 300k Nodes, 100 PB by Luker88 on Sunday October 09, 2022 @04:50AM (#33139199)
"write will fail"...but the data will still be there (you can SELECT it normally) and will be replicated to the node that was down once it is up again.

Unless the node was down too much and could not fully catch up before a set time (DB TTL if I remember correctly), in which case the data might be propagated or not, and old deleted data might come up again and be repropagated by a cluster repair.

So much fun to maintain

Re:Cassandra at Apple: 1000s of Clusters, 300k Nodes, 100 PB by ChrisMarshallNY on Sunday October 09, 2022 @05:10AM (#33139284)
> and old deleted data might come up again and be repropagated

That pretty much describes iCloud.

Argh! Zombies!

iCloud has terrible syncing. Here’s an example. Synced bookmarks in Safari:

I use three devices, regularly; my laptop (really a desktop, most of the time), my iPad (I’m on it, now), and my iPhone.

On any one of these devices, I may choose to “favorite” a page, and add it to a fairly extensive hierarchy of bookmarks, that I prefer to keep in a Bookmarks Bar.

Each folder can have a lot of bookmarks. Most are ones that I hardly ever need to use, and I generally access them via a search.

I like to keep the “active” ones at the top of the folder. This is especially important for my iPhone, which has an extremely limited screen (it’s an iPhone 13 Mini -Alas, poor Mini. I knew him well).

The damn bookmarks keep changing order. If I drag one to the top of the menu, I do that, because it’s the most important one, and I don’t want to scroll the screen.

The issue is that the order of bookmarks changes, between devices. In fact, I just noticed that a bookmark that I dragged to the top of one of my folders, yesterday, is now back down, several notches.

Don’t get me started on deleting contacts, or syncing Messages.

I assume that this is a symptom of DB dysfunction.

Re:Cassandra at Apple: 1000s of Clusters, 300k Nodes, 100 PB by rfoo on Sunday October 09, 2022 @05:45AM (#33139456)
This is a symptom of DB dysfunction only if you are using just one device.

Otherwise it's far more likely to be faulty sync algorithm.

Re:Cassandra at Apple: 1000s of Clusters, 300k Nodes, 100 PB by _benedict on Sunday October 09, 2022 @06:25AM (#33139679)
You can only SELECT at QUORUM if you are guaranteed to be able to SELECT it again at QUORUM, ie it must be durable (and the QUORUM read will ensure it if the prior write did not).

If you are selecting at ONE then yes, you can expect stale replies if you contact a different node. That is what the consistency level means; that just one node has seen the write.

Re:Cassandra at Apple: 1000s of Clusters, 300k Nodes, 100 PB by alanfranz on Sunday October 09, 2022 @06:53AM (#33139833)
At application level, you’ll probably retry, and you’ll probably select with the same cl you’ve written with.

The other behaviour you’re talking about is hinted handoff.

“So much fun to maintain” -> cassandra has very specific use cases. And hosted versions exist.

Disclosure: I work at Aiven, which has an hosted cassandra offer.

Re:Cassandra at Apple: 1000s of Clusters, 300k Nodes, 100 PB by jjirsa on Sunday October 09, 2022 @08:31AM (#33140396)
You’re wrong again here, in basically every single comment

If you have 3 and you for CL 3 instead of quorum, and only 2 are up, it won’t partially write - it’ll throw an unavailable exception instead of attempting it

If you have 3 and specify quorum and 1 is down, it’ll write to the two, and propagate to the third in one of three ways:

- via hints (the timed thing you describe),

- via active repair (times and tombstones don’t matter at all, and data can’t magically come back to life with reasonable config settings), or

- or via read repair when you read from a quorum that overlaps the down node, again, regardless of pretty much anything else, this always happens.

Re:Cassandra at Apple: 1000s of Clusters, 300k Nodes, 100 PB by pmcf on Sunday October 09, 2022 @11:45AM (#33142299)
I know this is HN and people love to troll, but it makes me sad when I see you using falsehoods to take a steaming dump on a group of engineers that are obsessed with building a database that can scale while maintaining the highest level of correctness possible. All in Open Source... for free! Spend some time on the Cassandra mailing list and you'll walk away feeling much differently. Instead of complaining, participate. Some examples of the projects obsession with quality and correctness:

https://cassandra.apache.org/_/blog/The-Path-to-Green-CI.htm...

https://cassandra.apache.org/_/blog/Finding-Bugs-in-Cassandr...

https://cassandra.apache.org/_/blog/Testing-Apache-Cassandra...

https://cassandra.apache.org/_/blog/Introducing-Apache-Cassa...

Re:Cassandra at Apple: 1000s of Clusters, 300k Nodes, 100 PB by skyde on Sunday October 09, 2022 @12:44PM (#33142844)
sorry to disappoint you but there is a reason Cassandra tried to add LWT using paxos.

it mostly work but it’s extremely slow and still have many bugs.

https://www.datastax.com/blog/lightweight-transactions-cassa...

Re:Cassandra at Apple: 1000s of Clusters, 300k Nodes, 100 PB by _benedict on Sunday October 09, 2022 @01:12PM (#33143129)
LWTs were added for a very simple reason: stronger isolation where the performance trade-off makes sense. Nothing to do with the GP comment.

Until recently they were indeed slow over the WAN, and they remain slow under heavy contention. They are now faster than peer features for WAN reads.

However, the claim that they have many bugs needs to be backed up. I just finished overhauling Paxos in Cassandra and it is now one of the most thoroughly tested distributed consensus implementations around.

Re:Cassandra at Apple: 1000s of Clusters, 300k Nodes, 100 PB by skyde on Sunday October 09, 2022 @07:00PM (#33146122)
LWT is still the only way to guarantee your write don’t random disappear and that conditional update are really conditional.

LWT still have awful performance compared to a write request with same guarantee in any other database.

Re:Cassandra at Apple: 1000s of Clusters, 300k Nodes, 100 PB by pmcf on Sunday October 09, 2022 @02:35PM (#33143978)
That blog was posted 9 years ago. Needless to say, a lot of improvement and engineering has happened since then. The limited use cases of LWTs will soon be replaced with general, ACID transactions.

https://thenewstack.io/an-apache-cassandra-breakthrough-acid...

Re:Cassandra at Apple: 1000s of Clusters, 300k Nodes, 100 PB by skyde on Sunday October 09, 2022 @07:40PM (#33146354)
This new « accord » thing look very promising! If this get merged into Cassandra this change everything!

A prototype has been developed that has demonstrated its correctness against Jepsen.io’s Maelstrom tool

Re:Cassandra at Apple: 1000s of Clusters, 300k Nodes, 100 PB by Luker88 on Sunday October 09, 2022 @04:34AM (#33139128)
I only wrote that quorum is not a transaction (no transactions in cassandra), and that is not a consensus.

While quorum looks a lot like consensus, it is not since what is returned to the client is the latest timestamp. Different nodes could have and return different data. So Quorum write+local_quorum read might fail even if you are in the datacenter that accepted the write. Quorum is also on the total copies of the data, not a quorum of DC, so in certain (weird) multi-DC setups you could have a quorum in a single DC.

In general though I think that the data consistency options of cassandra (quorum/local/N) are a good idea but underdeveloped.

Anyway my point was: cassandra has too many pitfalls and eliminating those restricts the use case by a lot more than people realize. Plus the naming of all features look designed to trick you into thinking soewthing else

Re:Cassandra at Apple: 1000s of Clusters, 300k Nodes, 100 PB by _benedict on Sunday October 09, 2022 @06:21AM (#33139649)
No, you wrote that you have to write and wait several minutes for data to replicate. This is straight-up false.

Yes, if you mix consistency levels incorrectly you will do it wrong and maybe get stale data, but that is a different criticism. I agree that it is easy for unsophisticated users to incorrectly use consistency levels in complex topologies, and I hope we will introduce mechanisms to prevent users making such mistakes in future. But that was not your claim, and in my experience users do understand consistency levels just fine.

There are lots of valid criticisms to point at various use cases with Cassandra, but this was just incorrect.

Re:Cassandra at Apple: 1000s of Clusters, 300k Nodes, 100 PB by skyde on Sunday October 09, 2022 @12:40PM (#33142799)
it’s worse than waiting actually. Because client A might write value « 1 » and after client B write value « 2 ». Then client C can read Value 2 for 5 minute and then cassandra internal read-repair eventually put value 1 on all replica and value 2 is lost forever.
Re:Cassandra at Apple: 1000s of Clusters, 300k Nodes, 100 PB by _benedict on Sunday October 09, 2022 @12:46PM (#33142858)
No, that is literally impossible.

If value 2 is newer than value 1, value 1 will never overwrite value 2. If a client reads value 2 at QUORUM then it will always be seen by all future queries.

Re:Cassandra at Apple: 1000s of Clusters, 300k Nodes, 100 PB by skyde on Sunday October 09, 2022 @07:08PM (#33146166)
Client À write value 1 on 2 of 3 node with timestamp=3

then later client B write value 2 on 2 of the 3 node with timestamp=1

then read repair happen and (value=1 timestamp=3) is written to all 3 nodes.

this is only one of many scenarios where this stupid design fail.

Re:Cassandra at Apple: 1000s of Clusters, 300k Nodes, 100 PB by _benedict on Monday October 10, 2022 @01:42AM (#33148162)
Client B’s write will only be successfully read from 1 of the nodes it wrote to, and read-repair only runs on QUORUM reads. So, no, it will not be possible to read value 2 for 5m - it will never be visible to operations at QUORUM.

This would have been a valid criticism of LWW.

Re:Cassandra at Apple: 1000s of Clusters, 300k Nodes, 100 PB by skyde on Monday October 10, 2022 @02:24PM (#33154785)
Since "client B write" was successfully written on 2 of the 3 nodes. Any read request that read only from 2 of the 3 nodes instead of using quorum read, will be able to see what Client B wrote until it magically disappears.

Quorum Read-repair is only one reason for why the value would randomly disappear. Another one is periodic anti Entropy repair!

Re:Cassandra at Apple: 1000s of Clusters, 300k Nodes, 100 PB by _benedict on Monday October 10, 2022 @03:52PM (#33155720)
No, it won’t. Successfully written does not mean what you think it means. If there is “newer” (by timestamp) data on disk or in memtable then it will not be returned to a client, regardless of which order that data arrived. It is unlikely even to be written to disk (except the commit log).

Since at least one of those nodes has the “newer” value, only one node can serve this “older” value

Re:Cassandra at Apple: 1000s of Clusters, 300k Nodes, 100 PB by pkolaczk on Sunday October 09, 2022 @09:24AM (#33140732)
> Different nodes could have and return different data.

Only if they miss some writes, and eventually they will converge. But if you do quorum writes and quorum reads (or local quorum W + local quorum R), this guarantees you'll read from at last one node that received all the writes issued before the read, so you get the converged value immediately, regardless of which node you ask. All nodes will eventually agree on the value, because timestamps are assigned by the coordinator or by the application, not at the replica. A single write will get the same timestamp across all replicas.

Incorrect timestamps can cause a different problem - a write that happened at physical time T2 > T1 might be considered to be older than T1 by the cluster, if it was accepted by the coordinator whose clock was set in the past. Such write might simply not take any effect, as old updates would be considered newer. However, again, the resolution would be consistent on all replicas once they get all updates.

Re:Cassandra at Apple: 1000s of Clusters, 300k Nodes, 100 PB by skyde on Sunday October 09, 2022 @12:41PM (#33142814)
eventually they will converge on a « random » value! that’s why we say it’s write quorum is not consensus it’s offer very weak guarantee
Re:Cassandra at Apple: 1000s of Clusters, 300k Nodes, 100 PB by pkolaczk on Sunday October 09, 2022 @03:59PM (#33144663)
No, they will converge on a value with higher timestamp. And timestamps are controllable by your app, so you can guarantee they are monotonic.
Re:Cassandra at Apple: 1000s of Clusters, 300k Nodes, 100 PB by skyde on Sunday October 09, 2022 @07:05PM (#33146142)
timestamp is coming from the operating system where the client library is running. so unless all your write request are issued by the same machine then

you are guaranteed to face the problem where the client machine clocks are not in sync.

just comparing timestamp is obviously a design from someone that didn’t review the academic literature on distributed transaction and consensus

Re:Cassandra at Apple: 1000s of Clusters, 300k Nodes, 100 PB by wpaladin on Monday October 10, 2022 @12:56AM (#33147914)
>> timestamp is coming from the operating system where the client library is running.

The client can set the timestamp to any value of its choice. It does not have to correspond to clock time.

>> so unless all your write request are issued by the same machine then you are guaranteed to face the problem where the client machine clocks are not in sync.

It's not about all writes. It's about ensuring that all writes to a single partition (specifically, a single column within a single partition) are done using a source of monotonic integers to ensure ordering.

Re:Cassandra at Apple: 1000s of Clusters, 300k Nodes, 100 PB by skyde on Monday October 10, 2022 @02:28PM (#33154835)
You are correct that if you have a singleton server returning monotonic time to clients this would work.

But this Monotonic time server is not part of Cassandra itself and for this reason majority of the people using Cassandra will use the OS time without knowing this is silently corrupting the database.