<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: I Has A Hash Table</title>
	<atom:link href="http://jens.mooseyard.com/2009/09/i-has-a-hash-table/feed/" rel="self" type="application/rss+xml" />
	<link>http://jens.mooseyard.com/2009/09/i-has-a-hash-table/</link>
	<description>Little boxes made of words, by Jens Alfke</description>
	<lastBuildDate>Sat, 04 Feb 2012 05:05:18 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
	<item>
		<title>By: Jens Alfke</title>
		<link>http://jens.mooseyard.com/2009/09/i-has-a-hash-table/comment-page-1/#comment-3095</link>
		<dc:creator>Jens Alfke</dc:creator>
		<pubDate>Sun, 06 Sep 2009 16:42:20 +0000</pubDate>
		<guid isPermaLink="false">http://mooseyard.com/Jens/2009/09/i-has-a-hash-table/#comment-3095</guid>
		<description>Joachim — it may not be &lt;i&gt;easy&lt;/i&gt;, but it happens. I saw evidence of several instances during internal testing of Tiger and Leopard.

Problems seem to occur if the kernel panics or, worse, the disk abruptly loses power. Disk controllers have an internal cache, and they re-order sector writes to minimize the amount of head travel. If the controller resets/dies before it can flush its cache, some &lt;i&gt;random&lt;/i&gt; subset of the most recent sector writes will be lost.

I&#039;m reading through the &quot;Atomic Commit In SQLite&quot; document now — it&#039;s very interesting, and I don&#039;t believe it was around when I was working with sqlite in &#039;05-&#039;07. It sounds like current versions of it are more robust to disk power failures ... maybe as a result of the problems we had at Apple ;)

A related problem that came up much more often was denial-of-service to processes accessing the database, due to another process being hung while it holds a lock. On my Leopard system this seemed to happen every few months to PubSub. This is my fault, not sqlite&#039;s, of course, but it does mean that a failure in one process propagates into others, which is bad. Worse, the way to recover from it is to move the database aside and re-create it, just as though it had been corrupted. This makes me appreciate the way that in an append-only file format, readers can never be locked out.</description>
		<content:encoded><![CDATA[<p>Joachim — it may not be <i>easy</i>, but it happens. I saw evidence of several instances during internal testing of Tiger and Leopard.</p>
<p>Problems seem to occur if the kernel panics or, worse, the disk abruptly loses power. Disk controllers have an internal cache, and they re-order sector writes to minimize the amount of head travel. If the controller resets/dies before it can flush its cache, some <i>random</i> subset of the most recent sector writes will be lost.</p>
<p>I&#8217;m reading through the &#8220;Atomic Commit In SQLite&#8221; document now — it&#8217;s very interesting, and I don&#8217;t believe it was around when I was working with sqlite in &#8216;05-&#8216;07. It sounds like current versions of it are more robust to disk power failures &#8230; maybe as a result of the problems we had at Apple ;)</p>
<p>A related problem that came up much more often was denial-of-service to processes accessing the database, due to another process being hung while it holds a lock. On my Leopard system this seemed to happen every few months to PubSub. This is my fault, not sqlite&#8217;s, of course, but it does mean that a failure in one process propagates into others, which is bad. Worse, the way to recover from it is to move the database aside and re-create it, just as though it had been corrupted. This makes me appreciate the way that in an append-only file format, readers can never be locked out.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Joachim Bengtsson</title>
		<link>http://jens.mooseyard.com/2009/09/i-has-a-hash-table/comment-page-1/#comment-3094</link>
		<dc:creator>Joachim Bengtsson</dc:creator>
		<pubDate>Sun, 06 Sep 2009 10:10:14 +0000</pubDate>
		<guid isPermaLink="false">http://mooseyard.com/Jens/2009/09/i-has-a-hash-table/#comment-3094</guid>
		<description>Sqlite does a &lt;em&gt;lot&lt;/em&gt; of &lt;a href=&quot;http://www.sqlite.org/testing.html&quot; rel=&quot;nofollow&quot;&gt;crash testing&lt;/a&gt; -- it has the most comprehensive test suite I&#039;ve ever seen (45 million lines of test code to 64 thousand lines of library code). But you&#039;re saying it&#039;s relatively easy to corrupt with a crash anyway? Not that I don&#039;t believe you, I&#039;m just surprised :)</description>
		<content:encoded><![CDATA[<p>Sqlite does a <em>lot</em> of <a href="http://www.sqlite.org/testing.html" rel="nofollow">crash testing</a> &#8212; it has the most comprehensive test suite I&#8217;ve ever seen (45 million lines of test code to 64 thousand lines of library code). But you&#8217;re saying it&#8217;s relatively easy to corrupt with a crash anyway? Not that I don&#8217;t believe you, I&#8217;m just surprised :)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jens Alfke</title>
		<link>http://jens.mooseyard.com/2009/09/i-has-a-hash-table/comment-page-1/#comment-3092</link>
		<dc:creator>Jens Alfke</dc:creator>
		<pubDate>Sun, 06 Sep 2009 06:20:08 +0000</pubDate>
		<guid isPermaLink="false">http://mooseyard.com/Jens/2009/09/i-has-a-hash-table/#comment-3092</guid>
		<description>I never did — you pretty much can&#039;t make sqlite (or any update-in-place format) robust enough. The PubSub store in OS X has to keep a backup copy of critical stuff like the list of subscriptions, and it has to check the db for corruption when it opens it, and if it&#039;s gone bad, nuke it and restore what it can from the backup. (Mail, Address Book, etc. do the same thing.)

This was a total pain to implement, and is why I really want to write something that won&#039;t have these problems, even if it isn&#039;t otherwise as powerful as sqlite.</description>
		<content:encoded><![CDATA[<p>I never did — you pretty much can&#8217;t make sqlite (or any update-in-place format) robust enough. The PubSub store in OS X has to keep a backup copy of critical stuff like the list of subscriptions, and it has to check the db for corruption when it opens it, and if it&#8217;s gone bad, nuke it and restore what it can from the backup. (Mail, Address Book, etc. do the same thing.)</p>
<p>This was a total pain to implement, and is why I really want to write something that won&#8217;t have these problems, even if it isn&#8217;t otherwise as powerful as sqlite.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Gus Mueller</title>
		<link>http://jens.mooseyard.com/2009/09/i-has-a-hash-table/comment-page-1/#comment-3093</link>
		<dc:creator>Gus Mueller</dc:creator>
		<pubDate>Sun, 06 Sep 2009 03:16:23 +0000</pubDate>
		<guid isPermaLink="false">http://mooseyard.com/Jens/2009/09/i-has-a-hash-table/#comment-3093</guid>
		<description>&quot;The file format should be virtually un-corruptible by crashes, unlike a traditional database such as sqlite.&quot;

So uh, how did you manage to do that with sqlite? :)</description>
		<content:encoded><![CDATA[<p>&#8220;The file format should be virtually un-corruptible by crashes, unlike a traditional database such as sqlite.&#8221;</p>
<p>So uh, how did you manage to do that with sqlite? :)</p>
]]></content:encoded>
	</item>
</channel>
</rss>

