Ouch you'd think I would learn...

Brian Kelley <[email protected]>
Newsgroups gmane.comp.db.metakit
Message-ID <[email protected]>
I just traced down a nasty crash bug with one of my clients that I
really should have known about.  I'm just posting this as a helpful
reminder to other's out there.  This is using the python interface:

My web service is a little too generous in allowing users to change
column types in metakit.  Essentially the following was happening:

stock[shelf:S] was being changed to stock[shelf:I].  The commit
happened just peachy, but the database was essentially corrupt at that
point.  On windows an error message occurs but on OS/X the program
throws a seg fault.

metakit should probably throw a sensible error when you try to change
the type of a column.  This logic seems buried pretty deep in mk so it
might be hard to fix.  If you want to change the type of a column,
look at the recipe I posted a week or so ago.

Anyway, here is a stupid little python script to check for this type
of corruption in a table, I call this after every commit, you don't
have to close the database to run this btw:

def check(db, table):
    code = '"import metakit, sys;st = metakit.storage(\'%s\',0);'\
           'v=st.view(\'%s\');print \'OK\'"'%(db, table)
    r,w = popen2.popen2("python -c %s "%code)
    w.close()
    t = r.read()
    if t.strip() == "OK":
        return True
    return False
_____________________________________________
Metakit mailing list  -  [email protected]
http://www.equi4.com/mailman/listinfo/metakit
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.