HNHacker News
TopNewBestAskShowJobs

aphyr

9,565 karma · joined January 15, 2010

https://aphyr.com

Hacker, physics geek, clojurer, rubyist, aikidoist, photographer.

submissionscomments
aphyr··on Jepsen: PostgreSQL 12.3
It's like HN is trying to get me in legal trouble today. Y'all are exhausting. Stop.
aphyr··on Jepsen: PostgreSQL 12.3
I don't use it often. In general, I've found the number of bugs I catch with core.typed doesn't justify the time investment in convincing things to typecheck--my tests generally (not always, of course!) find type issues first. I also tend to do a lot of weird performance-oriented stateful stuff with java interop, which brings me into untyped corners of the library.

That said, I've found core.typed helpful in managing complex state transformations, especially in namespaces which have, say, five or six similar representations of the same logical thing. What do you do when a "node" is a hostname, a logical identifier in Jepsen, an identifier in the database itself, a UID, and a UID+signature pair? Managing those names can be tricky, and having a type system really helps.

aphyr··on Jepsen: PostgreSQL 12.3
I think so, yeah. You could theoretically have a G2-item anomaly on a single key, but in PostgreSQL's case, the usual write-set conflict checking seems to prevent them.
aphyr··on Jepsen: PostgreSQL 12.3
Normally I'm a core.typed person, but static type constraints don't quite make sense here. We want heterogeneity in some cases (e.g. you want to be able to mix nils and ints), but not in others (e.g. this short and int mixing, which could be intentional, but also, might not be)

I've considered spec as well, but spec has a weird insistence that a keyword has exactly one meaning in a given namespace, which is emphatically not the case in pretty much any code I've tried to verify. Also its errors are... not exactly helpful.

aphyr··on Jepsen: PostgreSQL 12.3
Yeah, it was relatively infrequent in that particular workload--dramatically less than PostgreSQL's "repeatable read" exhibited. These histories are roughly 15K successful transactions long--see the stats field in results.edn. I'm hesitant to make strong statements about frequency, because I suspect this kind of thing depends strongly on workload, but I would hazard a gueesssss that it's not super common.
aphyr··on Jepsen: PostgreSQL 12.3
For legal reasons, Jepsen, the series on distributed database safety, has nothing to do with any other thing, place, person, or concept.
aphyr··on Jepsen: PostgreSQL 12.3
You can test pretty much any kind of concurrent system using Jepsen: in-memory data structures, filesystems, databases, queues, APIs, services, etc. Not all the tooling is applicable to every situation, but it's pretty darn general.
aphyr··on Jepsen: PostgreSQL 12.3
Er, again, the docs say "it is still possible to lose transactions even when using synchronous_mode_strict". I've talked about this with some of the Stolon folks on Twitter, and we're not exactly sure how that manifests--possibly an SI or SSI violation.
aphyr··on Jepsen: PostgreSQL 12.3
Yeah, the PostgreSQL team really knocked it out of the park on this one. It was a pleasure working with them. :)
aphyr··on Jepsen: PostgreSQL 12.3
Fun story: after the last report which called them out for not talking about write loss by default, MongoDB updated their Jepsen page to say that the analysis didn't observe lost writes. I guess they assumed that people wouldn't... read the abstract? Let alone the report?
aphyr··on Jepsen: PostgreSQL 12.3
Patroni's documentation also seems to suggest that even with the strongest settings, it can lose transactions; Stolon makes stronger claims.
aphyr··on Jepsen: PostgreSQL 12.3
I started this analysis intending to do just that--it's been difficult, however, to figure out which of the dozens of replication/HA configurations to actually test. I settled on Stolon, since it seemed to make the strongest safety claims. However, I found bugs which turned out to be PostgreSQL's fault, so I backed off to investigate those first.
aphyr··on Jepsen: PostgreSQL 12.3
Yes. Jepsen and Hypothesis both descend from a long line of property-based testing systems--mostly notably, Haskell & Erlang's QuickCheck. Jepsen makes a number of unusual choices specific to testing concurrent distributed systems: notably, we don't do much shrinking (real-world systems are staggeringly nondeterministic). Jepsen also includes tooling for automated deploys, fault injection, a language for specifying complex concurrent schedules, visualizations, storage, and an array of sophisticated property checkers.
aphyr··on Jepsen: MongoDB 4.2.6
I've actually written a little mini-Jepsen workbench for folks who want to practice implementing a distributed key-value store. Might be worth a spin! https://github.com/jepsen-io/maelstrom
aphyr··on Jepsen: MongoDB 4.2.6
I've invested seven years of my life into this brand, and my choices are carefully considered.
aphyr··on Jepsen: MongoDB 4.2.6
I'm not convinced it is false--IIRC their claim is specifically w.r.t other Kafka side effects, and those they can control.
aphyr··on Jepsen: MongoDB 4.2.6
I think this is a good way to look at things, and there are vendors who do this! VoltDB, for instance, changed their defaults to be strict serializable even though it imposed a performance hit, following their Jepsen analysis. https://www.voltdb.com/blog/2016/07/voltdb-6-4-passes-offici...
aphyr··on Jepsen: MongoDB 4.2.6
I'm kind of impressed any distributed system gets off the ground. These things are hard to write!
aphyr··on Jepsen: MongoDB 4.2.6
E.g. when each read should return the whole register's history the size of history grows O(n^2) compared to the case when the reads return just the head.

If you look at Elle's transaction generators, you can cap the size of any individual key, and use an uneven (e.g. exponential) distribution of key choices to get various frequencies. That way keys stay reasonably small (I use 1-10K writes/key), some keys are updated frequently to catch race conditions, and others last hundreds of seconds to catch long-lasting errors.

So I'm curios how would you have described the ability of finding violations with Elle using read-write registers with unique values vs the append-only lists?

RW registers are significantly weaker, though I don't know how to quantify the difference. I've still caught errors with registers, but the grounds for inferring anomalies are a.) less powerful and b.) can only be applied in certain circumstances--we talk about some of these details in the paper.

aphyr··on Jepsen: MongoDB 4.2.6
Not sure how many ways I can say this: the titles are already "Jepsen: X". HN's got a policy in place that means sometimes mods change the title to just "X". That's not something I have control over, sorry.
aphyr··on Jepsen: MongoDB 4.2.6
I think there are open possibilities in making leaderless single-round-trip consensus systems for log-oriented FSMs, which is what pretty much everyone WANTS.

This is based on her presentation and some dinner conversation at HPTS 2019, so I don't know if there's actually a paper I can point to. The gist of is that Paxos normally involves an arbitration phase where there are conflicting proposals, which adds a second pair of message delays. But if you relax the consensus problem to agreement on a set of proposals, rather than a single proposal, you don't need the arbitration phase. Instead of "who won", it becomes "everyone wins". Then you can impose an order on that set via, say, sorting, and iterate to get a replicated log.

I read over bits of Elle; the documentation in it is absolutely top-notch. You and Peter Alvaro knocked it out of the park!

Thank you! Could I... hang on, just let me grab reviewer #1 quickly, I'd like them to hear this. ;-)

aphyr··on Jepsen: MongoDB 4.2.6
Pretty much, yeah. There are some cases where Jepsen reaches into the guts of a database or lies to it via LD_PRELOAD shims, but generally these are Just Plain Old Binaries provided by vendors; no instrumentation required.
aphyr··on Jepsen: MongoDB 4.2.6
I'd like this too, but I'm not sure how to do fault injection against an Amazon-controlled service.
aphyr··on Jepsen: MongoDB 4.2.6
This... usually happens on Jepsen HN threads. The full title, as in the page metadata, and as originally submitted, is "Jepsen: MongoDB 4.2.6. At some point a mod drops the "Jepsen:" part, then we have this discussion, and it comes back. :)

"Why don't you put Jepsen:" on the same line as the database name and version?"

Space concerns, and also, it's immediately above the DB name in giant letters.

"Why don't you give them more creative names?"

Clients love to argue about the titles of these analyses; having a concise, predictable policy for titling is how I get past those discussions.

aphyr··on Jepsen: MongoDB 4.2.6
I'd like to, but I don't have any way to do fault injection on a system someone else owns. :(
aphyr··on Jepsen: MongoDB 4.2.6
I like to keep in mind that MongoDB's existing feature set is maturing--occasional regressions may happen, but by and large they're making progress. The problems in this analysis were in a transaction system that's only been around for a couple years, so it's had less time to have rough edges sanded off.
aphyr··on Jepsen: MongoDB 4.2.6
It's been on my list for a long time, but I've also struggled to find out like... what, exactly, is the right way to do postgres replication? Every time I go into the docs I wind up with a laundry list of different mechanisms for replication and failover, and no idea which one would be most appropriate for a test. I gotta get on this!
aphyr··on Jepsen: MongoDB 4.2.6
That is, a table on the jepsen.io frontpage, or at least on each product's review page, with database products and configuration on rows and consistency properties on columns, and a nice "Yay!" or "Nope!" mark in the cell, plus links on how to achieve the database configurations in the table (esp. how to configure each database to have the most guarantees).

This is a wonderful idea, and I've got no idea how to actually do it in a standardized, rigorous way. Vendor claims are often contradictory, it's hard to get a good idea of anomaly frequency, availability is... a rabbithole, and it's hard to come up with a standard taxonomy of anomalies--most of the analyses I do wind up finding something I've never really seen before, haha. With that in mind, I've wound up letting the reports speak for themselves.

Also, ideally the analyses should be rerun automatically (or possibly after being paid, but making it easy for the company to do so) every time a new major release happens rather than being done once and then being stale.

I don't know a good way to do this either. Each report is typically the product of months of experimental work; it's not like Jepsen is a pass-fail test suite that gives immediately accurate results. There is, unfortunately, a lot of subtle interpretive work that goes into figuring out if a test is doing something meaningful, and a lot of that work needs to be repeated on each test run. Think, like... staring at the logs and noticing that a certain class of exception is being caught more often than you might have expected, and realizing that a certain type of transaction now triggers a new conflict detection mechanism which causes higher probabilities of aborts; those aborts reduce the frequency with which you can observe database state, allowing a race condition to go un-noticed. That kinda thing.

If I'm lucky and the API/setup process haven't changed, I can re-run an analysis in about a week or so. If I'm unlucky, there's been drift in the OS, setup process, APIs, client libraries, error handling, etc. It's not uncommon for a repeat analysis to take months. :-(

aphyr··on Jepsen: MongoDB 4.2.6
Have you ever tried distributed transactions with relational databases?

I am delighted to say that yes: checking safety properties of distributed systems, including those of relational databases, is literally my job. See https://jepsen.io/analyses for a comprehensive list of prior work, or http://jepsen.io/analyses/tidb-2.1.7, http://jepsen.io/analyses/yugabyte-db-1.1.9, http://jepsen.io/analyses/yugabyte-db-1.3.1, or http://jepsen.io/analyses/voltdb-6-3 for recent examples of Jepsen analyses on relational databases.

aphyr··on Jepsen: MongoDB 4.2.6
Chief, it does not have to be this hard. 3.4 clearly states:

This anomaly occurred even with read concern snapshot and write concern majority

3.5: In this case, a test running with read concern snapshot and write concern majority executed a trio of transactions with the following dependency graph

3.6: Worse yet, transactions running with the strongest isolation levels can exhibit G1c: cyclic information flow.

3.7: It’s even possible for a single transaction to observe its own future effects. In this test run, four transactions, all executed at read concern snapshot and write concern majority, append 1, 2, 3, and 4 to key 586—but the transaction which wrote 1 observed [1 2 3 4] before it appended 1.

Like... if you had read any of these sections--or even their very first sentences--you wouldn't be in this position. They're also summarized both in the abstract and discussion sections, in case you skipped the results.

4.0: Finally, even with the strongest levels of read and write concern for both single-document and transactional operations, we observed cases of G-single (read skew), G1c (cyclic information flow), duplicated writes, and a sort of retrocausal internal consistency anomaly: within a single transaction, reads could observe that transaction’s own writes from the future. MongoDB appears to allow transactions to both observe and not observe prior transactions, and to observe one another’s writes. A single write could be applied multiple times, suggesting an error in MongoDB’s automatic retry mechanism. All of these behaviors are incompatible with MongoDB’s claims of snapshot isolation.

It's OK to stop digging now!

← PreviousPage 5 of 26Next →