On Tue, 15 Apr 2008 16:08:21 -0700
Scott Baker <[EMAIL PROTECTED]> wrote:

> I just had a major Berkelely DB data corruption that caused me all
> kinds of headaches. I've had it with Berkeley DB it's old and
> decrepit and I'm tired of dealing with it! It's 2008 and time for a
> real backend. I'd really like to migrate my authreg and storage from
> BDB to another backend. Preferably SQLite. Are there any scripts out
> there that do this already? Any documentation about the format of the
> data in the BDB files?

Yeah, wherever you see a berkeley db, convert it.

Now about the format (this is sm storage only):
The DB contains multiple sub DBs (active, queue, roster-items, etc.).
The key of each field is usually the collection-owner (i.e. JID). The
field content itself contains sub-fields (this format is jabberd2
specific): the first sub-field is a string, naming the field, the second
is an integer denoting the field type, and the third is the content
in an encoding specific to the field type. The sub-fields are delimited
by a 0 value.

Field types (from sm/sm.h):
typedef enum {
    os_type_BOOLEAN,            /**< boolean (0 or 1) */
    os_type_INTEGER,            /**< integer */
    os_type_STRING,             /**< string */
    os_type_NAD,                /**< XML */
    os_type_UNKNOWN             /**< unknown */
} os_type_t;

The content can only be an integer or a string (I think).

About authreg: I'm not really sure, but I think that there's a sub-DB
for each realm, and the key for each field is just the username, while
the value is the password.

Now you should be able to dump sm storage with the dumpdb.pl script.
The "unsupported hash version" error you mentioned in another mail is
usually caused by a wrong BDB version. I'm not sure, how RH does it,
but in Debian I have version specific BDB tools (like db4.2_dump). To
find out, which version is used by jabberd, just do
"ldd /usr/lib/jabberd/storage_db.so" (for your version you probably
have to do it on /usr/bin/sm) and you should get a line like
"libdb-4.2.so => /usr/lib/libdb-4.2.so (0xb7d25000)", so that would be
BDB 4.2. Then you can try the version specific dbx.x_dump tool.
dumpdb.pl should work equally well, however I don't know how to tell
the BerkeleyDB perl module which BDB version to use.

Another thing: when I had DB corruptions, db_recover usually didn't
work. db_dump and db_load did the trick.

Oh, and your jabberd version is stone old and not
supported any more.

Cheers,
harry

Attachment: signature.asc
Description: PGP signature

Reply via email to