MP trunk sql.c COLLATE VERSION

Bradley Giesbrecht pixilla at macports.org
Fri Dec 23 11:44:20 PST 2011


On Dec 23, 2011, at 9:41 AM, Rainer Müller wrote:

> On 2011-12-23 17:38 , Bradley Giesbrecht wrote:
>> sqlite> pragma integrity_check;
>> ok
> 
> Okay, this means the registry itself was alright. Then the issue is
> probably really in the schema upgrade in the rev-upgrade branch.
> 
>> Unfortunately I failed to make a backup of my registry after my new
>> install and am now pondering how to create a new registry manually. I
>> really can't afford to rebuild everything right now. This is PPC so
>> no binaries here.
> 
> Maybe it is still possible to recover the database, try this in sqlite3:
> 
> # dump database
> $ sqlite3 /opt/local/var/macports/registry.db
> sqlite> .load /Users/.../macports.sqlext
> sqlite> .output dump.sql
> sqlite> .dump %
> sqlite> .exit
> 
> $ sqlite3 registry-new.db
> sqlite> .load /Users/.../macports.sqlext
> sqlite> .read dump.sql
> sqlite> .exit
> 
> Then swap the registry with the new created database file. I don't know
> if this will work, but could be worth a try.
> 
>> One thing I do not understand is how we could define and use our own
>> collation but not load the extension that defines it. Is the
>> definition in a MacPorts lib, aside from the macports.sqlext file?
> 
> Yes, the registry code defines this collation with
> sqlite3_create_collation() when initializing the database connection.
> This is the same what the macports.sqlext does.

I am not that familiar with sqlite but thank goodness I kept copies of registry.db-journal :)
Not that I know it's for rollbacks I was able to recover my registry.db.
What was not obvious to me when I opened the registry after the crash with sqlite3 was that the disk I/O errors for things like ".tables" as sqlite3 trying to use the journal to recover my db and I did not have write permissions. As so as I started using sudo dp recovery was automatic in sqlite3 :)

So this also means sqlite is crashing, right?

I have confirmed the db crash/corruption multiple times on PPC and in different prefixes so completely different registry.db files.
Interestingly, on Intel I had no issue. Does sqlite have endian issues with our collation or function extensions?

Can someone CAREFULLY try rev-upgrade on PPC? Make a backup of your registry !!! Or be in a prefix you do not care about.


Regards,
Bradley Giesbrecht (pixilla)





More information about the macports-dev mailing list