Berkeley DB

共 4 篇文章。

网址缩短服务

Development

前一段时间帮一个朋友做了一个非常简单的网址缩短服务,已经上线运行了一段时间,这里把当时设计的一些想法分享出来,等有时间我会把代码也发布出来,程序很简单,用 web.py 做的。

阅读全文… ( 本文约 866 字,阅读大致需要 2 分钟 )

Overhaul of libc Berkeley DB has been committed

Development

First of all, thanks goes to all people who has helped me on this project, especially Pav (portmgr@) who gave it a twist on pointyhat.

It seems that this has taken me almost a month and 20 commits to get into the tree, after the code is ready. At the beginning, the changeset was ~200KB, and I believe it’s not good to just go ahead and commit it in one time, since it makes reviewing hard. Instead, I manually split it into smaller, functional related chunks, and commit it part-by-part.

阅读全文… ( 本文约 250 字,阅读大致需要 2 分钟 )

为什么FreeBSD没有CIRCLEQ_*

Development

最近在看 Berkeley DB,发现一套 FreeBSD 上没有的宏, CIRCLEQ_*

看了一下,这组宏是来自 4.4BSD 的,因此 FreeBSD 曾经有过这个宏;后来, phk 在 2000 年 12 月 29 日从 FreeBSD 里面把它拿掉了(SVN revision 70469),当时的说明如下:

阅读全文… ( 本文约 324 字,阅读大致需要 1 分钟 )

BerkeleyDB使用中的cache同步问题

Development

今天被一个程序折腾了很久。大致的流程是这样:

事件处理:

  • 打开db文件,如果已经打开,直接使用该handle
  • 获得排他锁,并读某一key对应的value
  • 根据value和一些环境信息以及事件所附带的输入计算新的value
  • 更新value,并同步文件、释放排他锁

锁的机制没有大毛病,可是数据死活不对。

阅读全文… ( 本文约 166 字,阅读大致需要 1 分钟 )