DSQL, the Universe, and All That

From Jim Starkey on the Firebird Development List 19th December 2003

The current DSQL implementation is a little schizoid. The remote subsystem handles DSQL requests but the "jrd" data manager doesn't, letting/making the Y-valve drive the SQL calls which then loop back through the Y-valve for OSRI level calls.

This architecture has to change if DSQL is to be pushed into the engine where it belongs. It doesn't make sense for me to integrate DSQL into the engine right now, but since I'm doing a major revamp of the Y-valve, it does make sense to change the architecture to pass DSQL calls through the Y-valve to the engine(s), disentangling the Y-valve from DSQL.

The Vulcan Y-valve architecture revolves around a C++ class "Subsystem" which contains virtual methods for each formal call (attach, start_transaction, dsql_prepare, etc) plus a couple of methods to return the interface version (for future expansion) and a text description of what the beast is). The basic idea is that each subsystem (engine, remote interface, gateway, etc) lives in a separate shared library. Each library has a canonical function to return a Subsystem object, which in turn defines all other entrypoints. (Maybe it should return a vector of objects?). All virtual methods in Subsystem return an "unavailable" error as a convenience to developers.

An argument can be made that if server engines are present (say ods9 and the current ods8 for backwards compatibility) it's a waste to have two copies of DSQL. On the other hand, once integration with the engine starts in earnest, DSQL ceases to be DSQL and effectively becomes the native SQL for the engine. Whether or not it generates BLR becomes an internal engine artifact of interest only to engineers.

So what might otherwise be considered as a minor code reorganization is, in fact, a major milestone in the evolution of the Firebird product, and as such should be subject to some deliberation. Not that I'm particularly willing to reasonable, you understand, just that I'm willing to listen to differing opinions.