flightaware / speedtables

Speed tables is a high-performance memory-resident database. The speed table compiler reads a table definition and generates a set of C access routines to create, manipulate and search tables containing millions of rows. Currently oriented towards Tcl.
https://flightaware.github.io/speedtables/
BSD 3-Clause "New" or "Revised" License
66 stars 15 forks source link

More than one call to stapi::init can confuse existing speedtables #53

Open mutability opened 8 years ago

mutability commented 8 years ago

(I hesitate to call this a bug, but it causes very non-obvious failures)

If you call stapi::init twice with different -dir values, then any ctables managed by stapi that were created between the two calls get confused because they can no longer find their working files (as [workname $ctable foo] starts returning a different value)

It might make sense to store the build dir used during init_ctable per ctable, so that later changes to build_root do not make things fail.

resuna commented 8 years ago

What's the use case for calling stapi::init with different directories? I don't think that should be necessary.

mutability commented 8 years ago

Packages that want to use stapi that are not aware of each other.

resuna commented 8 years ago

There is an attempted fix for this in the stapi-fixes branch. It keeps track of the directory associated with each base filename, and keeps using it.

I'm also pondering whether ignoring subsequent calls to init would be better.

Can you see if this fix works for your use case?

resuna commented 8 years ago

I have rebased the stapi-fixes branch up to master. Can you please verify that it fixes this problems so I can merge it back?

resuna commented 8 years ago

Should be fixed with merge of stapi-fixes. @mutability - could you check?