Internals of the Technology - Firebird

When any request invokes a stored procedure, the current definition for that stored procedure is copied at that moment to a metadata cache. On Classic server, this copy persists for the lifetime of the user’s connection. On Superserver, it stays “live” until the last connection is logged out.

A request comes from one of the following:

  • A client application that executes the stored procedure directly.
  • A trigger that executes the stored procedure. This includes system triggers that are part of referential integrity or check constraints.
  • Another stored procedure that executes the stored procedure.

Effects of Changes

Once invoked, a trigger or stored procedure request persists in the metadata cache while there are clients connected to the database, regardless of whether any connected client makes use of the trigger or stored procedure. There is no mechanism to force these outstanding requests to update their metadata cache. For this reason, changes to PSQL modules are “deferred” to a greater or lesser extent in most cases. The ability of clients to see changes is different for Superserver than for Classic server.

Superserver

Because existing requests are emptied from the metadata cache only when the last client disconnects from the database, they simply may never update on a 24/7 system. The only way to guarantee that all copies of stored procedures and triggers are purged from the metadata cache is for all connections to the database to terminate. When users log in again, they will all see the newest version of the stored procedure.

Classic Server

Altering or dropping a stored procedure takes effect immediately for new connections made after the change is committed. New connections that invoke the stored procedure will see the latest version. However, other connections continue to see the version of the stored procedure that they first saw. In practical terms, it makes sense to disconnect clients before you commit your changed module.


All rights reserved © 2018 Wisdom IT Services India Pvt. Ltd DMCA.com Protection Status

Firebird Topics