Thursday, April 11, 2024

ZooKeeper ZOO_SEQUENCE ZNONODE

How's that for putting the search terms right there in the post title?

I wrote a little ZooKeeper program, very simple, basically just the lock recipe out of the ZooKeeper examples. You know, the one where you create a sequenced child node inside the parent container node, and your child node represents your position in the line of tasks waiting to acquire the lock.

My program seemed to be working quite well, I was pleased. But once in a long while it would fail, with an error message stating that it got a "no node" error when trying to create a sequenced child node.

Impossible! I said, for I knew that I had successfully created such a node just a few moments earlier, and I definitely hadn't run any of my own code which deleted the lock container node. So why wasn't it there?

After a while, I found a line in my ZooKeeper leader's log:

[ContainerManagerTask:o.a.z.s.ContainerManager@135] - Attempting to delete candidate container: /path/to/lock/node

That led me to the ContainerManager documentation, which in turn reminded me to check this note in the ZooKeeper documentation, which described my mistake precisely:

Container Nodes
Added in 3.5.3

ZooKeeper has the notion of container znodes. Container znodes are special purpose znodes useful for recipes such as leader, lock, etc. When the last child of a container is deleted, the container becomes a candidate to be deleted by the server at some point in the future.

Given this property, you should be prepared to get KeeperException.NoNodeException when creating children inside of container znodes. i.e. when creating child znodes inside of container znodes always check for KeeperException.NoNodeException and recreate the container znode when it occurs.

On my system, ContainerManager seems to make this check about once a minute, which meant that every so often, after enough minutes and enough use of my program, ContainerManager would delete the lock node just when I was about to try to create a new sequenced child node.

Voila!

Thursday, April 4, 2024

I love this quote about the xz compression utilities event

From Did One Guy Just Stop a Huge Cyberattack? :

In the cybersecurity world, a database engineer inadvertently finding a backdoor in a core Linux feature is a little like a bakery worker who smells a freshly baked loaf of bread, senses something is off and correctly deduces that someone has tampered with the entire global yeast supply. It’s the kind of intuition that requires years of experience and obsessive attention to detail, plus a healthy dose of luck.

Ah yes, database engineers.

Yes, that's a profession that definitely involves "years of experience and obsessive attention to detail, plus a healthy dose of luck". Spot on!

There are still a lot of mysteries left about what exactly happened with xz, and this article is just a high-level summary.

But this database engineer loved that quote!

Wednesday, April 3, 2024

Why does housing cost so much?

Here's a very interesting article on the underlying costs of building a single family home. Well-researched, clearly-written, lots of detail about why it costs to much to build a new house.

Because of the enormous costs of housing, it's worth understanding where, specifically, those costs come from, and what sort of interventions would be needed to reduce these costs. Discussions of housing policy often focus on issues of zoning, regulation, and other supply restrictions which manifest as increased land prices, but for most American housing, the largest cost comes from building the physical structure itself. However, in dense urban areas — the places where building new housing is arguably most important — this changes, and high land prices driven by regulatory restrictions become the dominant factor.

I really enjoyed the entire article, lots of fascinating observations and lots of additional links to chase for those who want to learn more. So I wanted to share it.

Sunday, March 17, 2024

Sweet Thursday: a very short review

One day, on a trip from somewhere to somewhere else, we happened to stop at the National Steinbeck Center in Salinas, California. If you've never been to the Steinbeck Center, but you happen to be in Salinas and can spare a bit of time, you should definitely visit; it's a very interesting place.

While we were there, I stopped by the gift shop and picked up a copy of Sweet Thursday, a Steinbeck work that I wasn't familiar with.

Sweet Thursday is a sequel to the much more famous Cannery Row, and returns to the same setting and the same characters, for the most part. Cannery Row was set before WWII, Sweet Thursday was set after WWII, and there are many other ways to compare and contrast the two.

I think that if you liked or loved Cannery Row, you'll probably like or love Sweet Thursday just about as much. And, possibly, if it's been a while since you read Cannery Row, you might like Sweet Thursday even a bit more, since it will bring nostalgia and reminiscing about those earlier stories and how much you liked them and how nice it is to read some more about all those kooky characters.

Of course, the converse is true: if you found Cannery Row to be gimmicky and shallow, you probably won't enjoy Sweet Thursday

Happily for me, I was in the first camp, and I enjoyed Sweet Thursday very much.

It helps that I have always loved reading Steinbeck, and it also helps that the format of Sweet Thursday, with its three to eight page mini-chapters, is pretty much ideal for a commute-time reader, who has a scant 15 minutes of uninterrupted ferry-boat time for the occasional read. It was wonderful to carry Sweet Thursday around in my backpack, and pick it up when I had a few spare minutes, and read just one chapter, or maybe two.

Stretching it out this way may have even made me like Sweet Thursday better; I don't know. I think although it is quite short and easy to read, it was not actually meant to be rushed through, but rather to be sipped and savored, reflecting on those earlier times.

Wednesday, March 6, 2024

Kinda super Wednesday

So California joined Super Tuesday, hoping that would bring more enthusiasm for primary elections and for elections in general in these parts.

Our county's website has a quick take on the answer to that question.

More practice needed.

Saturday, March 2, 2024

Bone: a very short review

My holiday gift from my sister-in-law was the marvelous Bone: The Complete Cartoon Epic in One Volume, Jeff Smith's career-defining work.

Bone is quite the gift to receive. It's almost one thousand four hundred pages long, and it's big enough that you can lose your coffee cup behind it. I have to confess: at first it was a little intimidating.

But a nice quiet day happened along, and there it was, waiting for me, and so I dove in.

Well, there went 2.5 months!

Bone is everything you could want from a fantasy epic. It has demons, dragons, monsters and villains galore. It has the lovely Princess Thorn and her force-of-nature grandmother. It has cow races!

But most of all, it has Fone Bone, the most lovable and approachable hero in many a year.

It takes a while to read a 1400 page book, even if it is a graphic novel.

But it was worth every page and I enjoyed it through to the end.

I hope Bone is read for generations to come, it's definitely got staying power.

Confession time: the dragon was the best, but Ted the cricket was superb, and I really liked Roque Ja.

Wednesday, February 21, 2024

Ted Chiang on AI

Have you read Ted Chiang's Silicon Valley Is Turning Into Its Own Worst Fear ?

It's beyond remarkable that this essay is more than six years old at this point, it's still astonishingly accurate and insightful.

Elon Musk spoke to the National Governors Association and told them that “AI is a fundamental risk to the existence of human civilization.”

...

... in its pursuit of a seemingly innocuous goal, an AI could bring about the extinction of humanity purely as an unintended side effect.

But as Chiang observes, this really isn't a discussion about runaway superintelligence, it's a discussion about modern capitalism.

Consider: Who pursues their goals with monomaniacal focus, oblivious to the possibility of negative consequences? Who adopts a scorched-earth approach to increasing market share? This hypothetical strawberry-picking AI does what every tech startup wishes it could do — grows at an exponential rate and destroys its competitors until it’s achieved an absolute monopoly. The idea of superintelligence is such a poorly defined notion that one could envision it taking almost any form with equal justification: a benevolent genie that solves all the world’s problems, or a mathematician that spends all its time proving theorems so abstract that humans can’t even understand them. But when Silicon Valley tries to imagine superintelligence, what it comes up with is no-holds-barred capitalism.

Chiang's essay is extremely important, even more important now than when he wrote it more than six years ago.

I hope more people will go back and rediscover this under-acknowledged gem, and read it all the way through, and re-read it some more, and go and tell everyone they know about it.