Reloading Disk-Based Query Table Data

Overview

On the occasion of certain major releases of TIBCO StreamBase®, it becomes necessary to upgrade the on-disk format of disk-based Query Tables to improve performance, or to accommodate changes in third-party software. When this happens, the change is prominently announced on that release's New and Noteworthy page.

When the on-disk Query Table format changes between releases, it is essential that you dump and reload your persisted Query Table contents to preserve those contents. This is done using a CSV File Writer adapter in your old StreamBase release to dump the contents of persisted Query Tables to a CSV file, then using a CSV File Reader adapter in your new StreamBase release to reload the data in the new release.

Important

Before migrating your application to the new StreamBase release, move all files in your Query Table data directory to a backup location. Then proceed as follows, depending on how you use disk-based Query Tables.

Query Table Reload Checklist

Consider the scenarios in this section to determine whether you need to dump and reload your application's Query Table contents.

  • If your application uses disk-based Query Tables for transient storage, such as for counters or sequence numbers, then you do not need to dump and reload them. Instead, move all files out of your Query Table data directory (or specify a new, empty data directory) before migrating your application to the new release. The new StreamBase release will recreate your transient Query Tables in the new format.

  • If your application loads a Query Table from a resource file on startup, perhaps for use as a lookup table, then your table's data is already preserved in the table's source file. In this case, move all files out of your Query Table data directory or specify a new, empty data directory. The new StreamBase release will create empty Query Tables in the new format, which will then be reloaded with data from the resource file by your application.

  • If your application uses persistent data stored in a disk-based Query Table that was created with any StreamBase release older than the new release, then follow the dump and reload procedure in the next section.

Query Table Reload Procedure

If you have determined that you need to dump and reload your disk-based Query Tables, follow these steps:

  1. Open your application in your old StreamBase release.

  2. Add an Input Stream, Query operator, and CSV File Writer adapter.

  3. Connect the Query operator to the Query Table of interest.

  4. Configure the CSV File Writer adapter to accept the stream from the Query operator and to write all rows to disk in CSV format. Make notes on the CSV options used, such as the field delimiter and whether a header row is written.

  5. Still in your old StreamBase release, run the module and send a tuple to the Query operator that triggers a Read operation. This writes all rows of the target Query Table to a CSV file.

  6. Start your new StreamBase release with a new, unused workspace, and configure it to use a new, empty data storage directory using one of the methods described in Setup For On-Disk Query Tables.

  7. Load a copy of your application into the new StreamBase release. Open the module with the target Query Table, and let the new StreamBase release recreate your Query Table.

  8. In the new StreamBase release, use a CSV File Reader adapter and another Query operator to reload the data from the CSV file into the new Query Table. Use the same CSV Reader options you noted for the CSV Writer in step 4.

Preserve an installation of your old StreamBase release so that you can read the old Query Table data and compare it to the newly reloaded Query Table in the new StreamBase release. Keep the old release until you are confident the data has migrated successfully.

Contact TIBCO Support for assistance in implementing this procedure.