RTI_Recording_Service_UsersManual RTI Recording Service Users Manual
User Manual: Pdf
Open the PDF directly: View PDF .
Page Count: 126
Download | ![]() |
Open PDF In Browser | View PDF |
RTI Recording Service User’s Manual Version 5.2.3 © 2007-2016 Real-Time Innovations, Inc. All rights reserved. Printed in U.S.A. First printing. April 2016. Trademarks Real-Time Innovations, RTI, NDDS, RTI Data Distribution Service, DataBus, Connext, Micro DDS, the RTI logo, 1RTI and the phrase, “Your Systems. Working as one,” are registered trademarks, trademarks or service marks of Real-Time Innovations, Inc. All other trademarks belong to their respective owners. Copy and Use Restrictions No part of this publication may be reproduced, stored in a retrieval system, or transmitted in any form (including electronic, mechanical, photocopy, and facsimile) without the prior written permission of RealTime Innovations, Inc. The software described in this document is furnished under and subject to the RTI software license agreement. The software may be used or copied only under the terms of the license agreement. Third-Party Copyright Notices Portions of this product include software derived from Fnmatch, (c) 1989, 1993, 1994, The Regents of the University of California. All rights reserved. The Regents and contributors provide this software "as is" without warranty. Technical Support Real-Time Innovations, Inc. 232 E. Java Drive Sunnyvale, CA 94089 Phone: (408) 990-7444 Email: support@rti.com Website: http://www.rti.com/support Contents 1 Welcome to RTI Recording Service 1.1 2 3 4 Paths Mentioned in Documentation ................................................................................................ 1-2 Using Recording Console 2.1 Starting and Stopping the Console .................................................................................................. 2-1 2.2 Using the Information Panel ............................................................................................................. 2-2 2.3 Configuring Recording Console....................................................................................................... 2-2 2.3.1 Configuring From an External File ..................................................................................... 2-3 2.4 Recording Data ................................................................................................................................... 2-6 2.4.1 Using the Pause/Resume Button During Recording ....................................................... 2-7 2.4.2 Troubleshooting Recording Problems ................................................................................ 2-7 2.5 Replaying Data.................................................................................................................................... 2-7 2.5.1 Using the Play Button ........................................................................................................... 2-8 2.5.2 Using the Fast-Forward Button ........................................................................................... 2-8 2.5.3 Using the Pause/Resume Button ........................................................................................ 2-8 2.5.4 Advanced Configuration...................................................................................................... 2-8 2.5.5 Restricting the Time Range to be Replayed ....................................................................... 2-9 2.6 Viewing Recorded Topics .................................................................................................................. 2-9 2.7 Scheduling Recording and Replay Tasks ...................................................................................... 2-10 2.8 Troubleshooting .................................................................................................................................2-11 Using the Record Tool 3.1 Starting the Record Tool .................................................................................................................... 3-1 3.2 Stopping the Record Tool .................................................................................................................. 3-2 3.3 Format of the Recorded Data ............................................................................................................ 3-2 3.3.1 Discovery Data....................................................................................................................... 3-2 3.3.2 User Data ................................................................................................................................ 3-3 Configuring the Record Tool 4.1 How to Load the XML Configuration ............................................................................................. 4-1 4.2 General Format ................................................................................................................................... 4-2 4.2.1 Configuration File Syntax..................................................................................................... 4-3 4.2.2 Supported Data Types........................................................................................................... 4-3 4.3 General Properties for the Record Tool ........................................................................................... 4-6 iii 4.4 Remote Access Properties ................................................................................................................. 4-6 4.4.1 Enabling RTI Distributed Logger in the Record Tool ....................................................... 4-6 4.5 Database (Output File) Properties.................................................................................................... 4-8 4.5.1 Choosing Which SampleInfo and Discovery Fields to Record ..................................... 4-14 4.6 Domain Type Configuration ........................................................................................................... 4-22 4.7 Domain Properties............................................................................................................................ 4-24 4.7.1 Enabling Monitoring Library in the Record Tool............................................................ 4-26 4.7.2 Recording Large User Data Types..................................................................................... 4-26 4.8 TopicGroup Properties..................................................................................................................... 4-27 4.8.1 ‘Create Index’ Syntax .......................................................................................................... 4-30 4.8.2 Indexing and Performance in SQLite: Tips and Tricks................................................... 4-32 4.9 RecordGroup Properties .................................................................................................................. 4-34 4.10 Recording Service Integration with Extensible Types................................................................. 4-36 4.10.1 Selecting a Type Version For a Topic “T” In a Recording Domain ............................... 4-36 4.10.2 Recording Two Versions of a Type in Different Tables in Same Database .................. 4-40 5 6 7 Accessing the Record Tool from a Remote Location 5.1 Overview ............................................................................................................................................. 5-1 5.2 Establishing a Connection with the Record Tool ........................................................................... 5-2 5.3 Remote Control Messages ................................................................................................................. 5-4 5.3.1 Updating the Record Tool’s Partition QoS Policy............................................................. 5-5 5.4 Using the Example Remote-Access Application—Record Shell ................................................5-11 5.4.1 Record Shell’s Commands.................................................................................................. 5-12 5.4.2 Running Multiple Record Tools in the Same Domain.................................................... 5-15 Using the Replay Tool 6.1 Recording Data for Replay ................................................................................................................ 6-1 6.2 Starting the Replay Tool..................................................................................................................... 6-1 6.3 Stopping the Replay Tool .................................................................................................................. 6-2 6.4 Performance and Indexing ................................................................................................................ 6-3 Configuring the Replay Tool 7.1 How to Load Replay’s XML Configuration File ............................................................................ 7-1 7.2 General Format ................................................................................................................................... 7-2 7.3 General Properties for Replay........................................................................................................... 7-3 7.4 Database (Input File) Properties....................................................................................................... 7-4 7.4.1 Enabling Monitoring Library with Replay ........................................................................ 7-6 7.5 Session Properties ............................................................................................................................... 7-6 7.6 Replay Topic Properties ..................................................................................................................... 7-7 7.6.1 Type Selection......................................................................................................................... 7-8 7.7 Time Control Properties..................................................................................................................... 7-9 7.8 Remote Administration Properties .................................................................................................. 7-9 7.8.1 Enabling RTI Distributed Logger in the Replay Tool ......................................................7-11 7.9 Type Configuration .......................................................................................................................... 7-13 iv 7.10 Recording Service Integration with Extensible Types................................................................. 7-14 7.10.1 Selecting the Type Version to use when Replaying a Topic........................................... 7-15 7.10.2 Replaying Topics with Different Type Versions Stored in Different Tables ................ 7-16 8 Accessing the Replay Tool from a Remote Location 9 Viewing Recorded Data 10 Converting and Exporting Recorded Data 10.1 Exporting Data .................................................................................................................................. 10-1 10.2 Deserializing Serialized Tables ....................................................................................................... 10-3 10.3 Handling Data Types ....................................................................................................................... 10-3 10.4 Selecting Output Files ...................................................................................................................... 10-4 10.5 Exporting Discovery Tables ............................................................................................................ 10-4 10.6 Filtering User Topic Tables .............................................................................................................. 10-4 11 Example Configuration Files 11.1 How to Record All Topics in a Single Domain..............................................................................11-1 11.2 How To Record a Subset of Data from Multiple Domains ..........................................................11-2 11.3 How To Record Data to Multiple Files ...........................................................................................11-3 11.4 How To Record Serialized Data.......................................................................................................11-3 11.5 How To Record Using Best-Effort Reliability ................................................................................11-4 11.6 How To Enable Remote Access .......................................................................................................11-4 A Fields Available for Recording A.1 User Topic Tables ............................................................................................................................... A-1 A.2 DCPSParticipant Table (Discovery) ................................................................................................ A-2 A.3 DCPSPublication Table (Discovery)................................................................................................ A-3 A.4 DCPSSubscription Table (Discovery) ............................................................................................. A-5 v Chapter 1 Welcome to RTI Recording Service RTI® Recording Service includes: ❏ Recording Console, a simple graphical user interface (GUI) for using the Record and Replay tools. This interface significantly reduces Recording Service configuration time and complexity, and does not require any programming. The Recording Console makes it easy to use Recording Service for testing algorithms and other processing logic against prerecorded test data, conducting regression testing from 'golden' data inputs, or recording live data from the field for post-mission analysis. See Chapter 2: Using Recording Console. ❏ Record, an RTI Connext™ DDS application that records both RTI Connext DDS discovery and topic data. All recorded data is stored in one or more SQL database files. See Chapter 3: Using the Record Tool. ❏ Replay, a tool that can ‘play back’ the recorded data. You even have the option of replaying the data with different data rates or QoS settings. See Chapter 6: Using the Replay Tool. ❏ Convert, a utility that enables serialized or deserialized data recorded with Record to be exported to CSV, HTML, SQL, or XML formats. See Chapter 10: Converting and Exporting Recorded Data. Recording Features ❏ Records data from applications in multiple domains. ❏ Records entire Topics, or specific Topic fields, based on POSIX file-name matching expressions. ❏ Records all data types except bit-fields. ❏ Records to multiple files with configurable file-size limits. Optionally overwrites the oldest file when the maximum number of files has been reached. ❏ Records the DDS SampleInfo structure and a timestamp for both discovery data and user data. ❏ Records using either Best Effort or Reliable communications. ❏ Optionally can be configured to record from all partitions or from only specified partitions. ❏ Supports remote operation. Replay Features ❏ Publishes data samples that were recorded in serialized format. ❏ Highly configurable—you can: 1-1 Paths Mentioned in Documentation • Choose which serialized topics to replay • Set the replay rate (faster or slower) or use the original rate • Change the QoS of the publications • Configure the QoS for the tool itself • Dynamically control the replay (start, stop, pause) and single-step through the data samples This document assumes you have a basic understanding of DDS terms such as DomainParticipants, Publishers, DataWriters, Topics, and Quality of Service (QoS) policies. For an overview of DDS terms, please see the RTI Connext DDS Core Libraries User’s Manual. 1.1 Paths Mentioned in Documentation The documentation refers to: ❏This refers to the installation directory for Connext DDS. The default installation paths are: • Mac OS X systems: /Applications/rti_connext_dds-version • UNIX-based systems, non-root user: /home/your user name/rti_connext_dds-version • UNIX-based systems, root user: /opt/rti_connext_dds-version • Windows systems, user without Administrator privileges: \rti_connext_dds-version • Windows systems, user with Administrator privileges: C:\Program Files\rti_connext_dds-version (for 64-bits machines) or C:\Program Files (x86)\rti_connext_dds-version (for 32-bit machines) You may also see $NDDSHOME or %NDDSHOME%, which refers to an environment variable set to the installation path. Wherever you see used in a path, replace it with your installation path. Note for Windows Users: When using a command prompt to enter a command that includes the path C:\Program Files (or any directory name that has a space), enclose the path in quotation marks. For example: “C:\Program Files\rti_connext_dds-version\bin\rtiddsgen” or if you have defined the NDDSHOME environment variable: “%NDDSHOME%\bin\rtiddsgen” 1-2 Paths Mentioned in Documentation ❏ Examples are copied into your home directory the first time you run RTI Launcher or any script in /bin. This document refers to the location of these examples as . Wherever you see , replace it with the appropriate path. By default, the examples are copied here: • Mac OS X systems: /Users/your user name/rti_workspace/version/examples • UNIX-based systems: /home/your user name/rti_workspace/version/examples • Windows systems: your Windows documents folder\rti_workspace\version\examples Where 'your Windows documents folder' depends on your version of Windows. For example, on Windows 7, the folder is C:\Users\your user name\Documents; on Windows Server 2003, the folder is C:\Documents and Settings\your user name\Documents. You can specify a different location for the rti_workspace directory. You can also specify that you do not want the examples copied to the workspace. See the RTI Connext DDS Core Libraries Getting Started Guide. 1-3 Chapter 2 Using Recording Console This chapter describes how to use Recording Console, which provides an easy way to record and replay data. 2.1 Starting and Stopping the Console Recording Console’s executable is in /bin. The tool should always be run using the executable script (rtirecordingconsole.bat for Windows, rtirecordingconsole for Linux). For Mac OS X systems, Recording Console includes a .app directory which includes a script to run the tool. On Linux systems: 1. Open a command prompt and change to the /bin directory 2. Start the Console by entering: > rtirecordingconsole 3. Set a Domain ID as described in Section 2.3. On Mac OS X systems: 1. Go to the /bin directory. 2. Execute the RTI Recording Console.app application by double-clicking on it or using Mac's open command. 3. If the Connext DDS bundle was installed under the Mac "Applications" directory, Mac's LaunchPad will also show the RTI Recording Console application in the /bin directory. Click on the application to run it. On Windows systems: 1. From the Start menu, navigate to RTI Recording Service , and select Recording Console. 2. Set a Domain ID as described in Section 2.3. Table 2.1 Console’s Controls Record Stop Pause/Resume Single Step (Press Pause first) Play Fast Forward 2-1 Using the Information Panel Figure 2.1 Console at Startup File Management Display area Configure Start here to set a Domain ID 2.2 Topics (see Section 2.6) Schedule (see Section 2.7) Controls (see Table 2.1) Information (see Section 2.2) Using the Information Panel To open the Information panel, click on the in the Console’s lower-right corner. From this panel, seen in Figure 2.2, you can access documentation, contact RTI Support, or view the most recent log file. Note: Log files are automatically deleted when the Console shuts down, unless errors were reported. Figure 2.2 Information Panel The information panel provides links to documentation, RTI Support, and the Console’s log file. 2.3 Configuring Recording Console Before you can use Recording Console to record or replay data, you must specify a domain ID in the Configuration panels. The default domain ID is 0. 2-2 Configuring Recording Console ❏ To record data, specify the domain in which the data you want to record is being published. ❏ To replay data, specify the domain that you want to publish the previously recorded data into. By default, Recording Console records and replays data using the default DomainParticipant QoS settings described in the Connext DDS documentation. If your Connext DDS applications use default DomainParticipant QoS settings (including transport settings), you can record and replay data ‘out of the box’—with no QoS changes. If your system uses any DomainParticipant QoS settings that would be incompatible with the default settings, you need to write a configuration file that can be used by Recording Console when recording or replaying the data. There are two ways to configure Recording Console’s recording and playback parameters: ❏ Specify values in the Configuration panels shown below. ❏ Specify a file and a configuration within that file. This method is described in Section 2.3.1. Click here to open these Configuration Panels 2.3.1 Configuring From an External File If you have a use case that is not covered by the default configuration generated by Recording Console, you can use an external configuration file as the basis of the settings to record or replay. Recording Console can load any configuration file that is supported by the Record or Replay tools. These files are described in Chapter 4: Configuring the Record Tool and Chapter 7: Configuring the Replay Tool. Note: Not all configuration settings are taken from the selected external file; see Section 2.3.1.1 and Section 2.3.1.3. 2-3 Configuring Recording Console 2.3.1.1 Configuring Recording from an External File To use an external configuration file for recording: 1. Press to open the Recording and Playback Configuration panels. 2. In the Recording configuration panel, select Configured by file. 3. Select a configuration file to use for recording either by pressing the Open Folder button or by dragging-and-dropping a file from your file explorer window into the Recording configuration panel. 4. Select one of the configurations in the file by choosing from the drop-down listbox. 1. Select “Configured by file” 2. Select a file 3. Select a configuration Only parts of the configuration file are used, while other settings are taken from Recording Console: ❏ : The name attribute will be used for the launched service. ❏ : This will be used for the administration domain ID. ❏ : Many of the settings from this element are used, except as noted below: • : The domain ID is used, but all other settings are replaced so that they are compatible with Recording Console's settings. • : This is replaced with the database file specified in Recording Console. Note: To stop using the configuration file and go back to the previous QoS settings, select Configured without a File. Return to prior configuration 2.3.1.2 Using Domain 99 in External File Configurations By default, Recording Console monitors and controls the Record and Replay services on domain 99. 2-4 Configuring Recording Console When configuring either the Record or Replay services from a file, if you happen to be using domain 99 as your recording or playback domain, we recommend that you change the administration domain from 99 to a different domain ID, by either specifying it in the configuration file or by editing the file, settings.ini, which should be located in your home directory: ❏ On Windows Systems: C:\Users\ \Documents\rti_workspace\ \user_config\ recording_service\settings.ini ❏ On Linux and OS X systems: ~/rti_workspace/ /user_config/recording_service/settings.ini Again, this recommendation only applies if the domain in your configuration file is domain 99. Note: Except for the specific changes described in this document, avoid making other changes in the settings.ini file. 2.3.1.3 Configuring Replay from an External File To use an external configuration file for replay: 1. Press to open the Recording and Playback Configuration panels. 2. In the Playback configuration panel, select Configured by file. 3. Press the Open Folder button to select a configuration file for playback. 4. Select one of the configurations in the file by choosing from the drop-down listbox. 5. Select a QoS profile from the drop-down listbox. 1. Select “Configured by file” 2. Select a file 3. Select a configuration Here again, only parts of the configuration file are used, while other settings are taken from Recording Console. These configuration elements from the file are used: ❏ : The name attribute will be used for the launched service. ❏ : This will be used for the administration domain ID. The rest of the element is replaced to ensure runtime compatibility with Recording Console. ❏ : Many of the settings will be used from this element, except for: • Only the first from the first will be used. • The will be replaced with the file specified in Recording Console. 2-5 Recording Data Note: To stop using the configuration file and go back to the previous QoS settings, select Configure without a File. Return to prior configuration 2.4 Recording Data To record data: 1. Make sure you have set the domain ID in the Record Configuration panel (see Section 2.3). 2. Choose where to save the recorded data. You can create a new file or choose an existing one: • To create a new file: Press the New Recording button in the upper-right corner and specify a file name and location for the new recording. Then click on Create File. • To record over an existing file: • Press the Open Folder button that you want to record into. in the upper-right corner and locate the file • Another way to open a recording file is simply to drag the file from your file explorer window and drop it into the long black rectangle at the top of the Console. Note: If you specify an existing file, the file will be overwritten with new data. New data is not appended to the end of the existing file contents. 3. Press the Record button to start recording. File size grows as data is recorded Begin time Stop Pause/ End time 2-6 Replaying Data 2.4.1 Using the Pause/Resume Button During Recording To pause recording, press the Pause/Resume button . To resume recording, either press Pause/Resume again or press Record 2.4.2 . Troubleshooting Recording Problems Problem—You pressed the Record button, but the recording file size stays at zero. Solution—Make sure that: ❏ The Recording Domain ID matches the domain ID used by the source (the application from which you want to record data). ❏ Data is coming in from the source, by using tools such as rtiddsspy (provided with Connext DDS in its /bin directory). ❏ You have access rights to create files in the directory where the recording file is to be created. 2.5 Replaying Data You can use the Console to replay data that was recorded using the Console or the Record tool. You may replay data recorded with an older version of Recording Service. Note: If you recorded the data using the sqlite_ pragmas functionality described in Section 4.5, the resulting database cannot be replayed by Recording Console; use the Replay tool instead (see Chapter 6). To replay data: 1. Make sure you have set the domain ID in the Playback Configuration panel (see Section 2.3). 2. Press the Open Folder button to be replayed, then click Open. in the upper-right corner, locate the file whose data is • Another way to open a recorded data file is simply to drag the file from your file explorer window and drop it into the long black rectangle at the top of the Console. When the file is loaded, you will see the time of the original recording: Original recording time and date 3. Press Play to begin replaying the data. 2-7 Replaying Data The display will show you the elapsed time since the start of the replay. Slider controls replay speed Elapsed time Replay rate. For example. x1 = original rate, x2 = twice the original rate. 2.5.1 Using the Play Button To begin replaying data, press Play 2.5.2 . Using the Fast-Forward Button The Fast-Forward button will replay at a higher rate as long as the button is pressed. “Higher rate” means the next highest option from the list of playback speed choices in the dropdown menu. For example, if you were replaying at normal speed, fast-forward will replay at x2 (double) speed. If you were replaying at double speed, fast-forward will replay at x10 speed. If replay is paused when you press Fast-Forward button, it will replay at the higher rate as long as the button is pressed. When you let go of the button, replay will go back to being paused. If replay is not paused when you press Fast-Forward button, it will replay at the higher rate as long as the button is pressed. When you let go of the button, replay will return to the previous rate. 2.5.3 Using the Pause/Resume Button To pause a replay, press the Pause/Resume button . To resume the replay at the same rate, either press Pause/Resume again or press Play 2.5.4 Advanced Configuration 2.5.4.1 Changing the Replay Rate . To increase the rate temporarily, keep the Fast-Forward Button pressed (see Section 2.5.2). The vertical slider on the right controls the replay rate (up for faster, center for original speed, lower for slower). 2-8 Viewing Recorded Topics You can specify a default replay rate in the Playback configuration panel. Select a speed from the drop-down list or type in your own value. If you use the slider to change the playback speed, you can easily go back to default playback rate by pressing the Play button again while replay is in progress. 2.5.4.2 Auto-Repeat To automatically repeat the replay in a continuous loop, select the Auto repeat check-box. 2.5.5 Restricting the Time Range to be Replayed You can limit the start and end time for replaying data while replay is stopped by dragging the bars seen below: Drag these bars inward to restrict the time range for replaying data Note: This time-restriction feature cannot be used when using a configuration file. 2.6 Viewing Recorded Topics While recording, or when you have loaded a pre-recorded file, you can use the Recorded Topics panel to see the topics that have been recorded. For each topic, the table shows the topic name, and (when the recording is not in progress) the first and last recorded samples of that topic. 2-9 Scheduling Recording and Replay Tasks If playback is configured through Recording Console, the topic table enables you to select which topics to replay. Click here to open the Recorded Topics Panel Search for topics by name here Searching for Topics To assist in selecting multiple topics, use the search bar on the bottom of the topics panel. You can narrow down the topics that are displayed based on a substring in the topic name. Note: The search bar does not support regular expressions. When the desired group of topics is displayed, you can use the select all/unselect all buttons on the entire group. Only the selected Topics will be replayed. To restore and see the list of all topics, remove (erase) the search string from the search box. Topic selection in the table is only available when the Console is in Ready mode (not recording or replaying data) and you have used the Playback Configuration panel (not a configuration file). 2.7 Scheduling Recording and Replay Tasks To schedule recording or replay: 1. Press the Schedule button . 2. Select the type of task (record, replay, or stop current operation). 3. Select the starting time and date. 2-10 Troubleshooting 4. Optionally, select an ending time for the activity. Important Notes: ❏ Recording Console’s window must remain active for the scheduled operation to run. You may minimize the window, but closing it will cancel the activity. ❏ When selecting a file in which to record, be aware that any data already in the file will be erased. 2.8 Troubleshooting If Recording Console hangs, issues a generic error message, or behaves in an unexpected manner, here are some steps to resolve the problem: 1. Read the instructions again to ensure you understand the expected behavior. 2. It’s possible that the environment or configuration in which Recording Console is running is causing the unexpected behavior. Recording Console generates a log file. To open the log file, click on the info button ('i') in the lower right corner, then click on the link at the bottom of the info panel. Each line in the log begins with a severity level. Look for lines that start with WARN or ERROR. 3. Contact RTI’s support team. If you cannot resolve the issue based on the information in the log file, please contact us so we can help you overcome the issue. Before contacting support, please increase the logging verbosity and try to reproduce the problem so you can provide more detailed information. To do so: a. Close any running instances of Recording Console (otherwise, any change you make to the settings file may be overwritten). b. Open the console settings file in your home directory: • rti_workspace/version/user_config/recording_service/settings.ini (rti_workspace is described in Paths Mentioned in Documentation (Section 1.1)) Note: Except for the specific changes described in this document, avoid making other changes in the settings.ini file. c. Find the line with "loggingLevel=INFO" and replace the default value of "INFO" with "TRACE". d. Save the updated settings file. 2-11 Troubleshooting e. Run Recording Console again until the issue you encountered before is reproduced. f. Find the log file. The info panel has a link indicating the name of the current log file. In general, log files are stored here: rti_workspace/version/user_config/RTI Recording Console /logs Log files are named by date and time. Log files are only saved if there is an error. If no errors are reported, the log file is deleted when Recording Console shuts down. g. Save a copy of the log file in a safe location and close Recording Console. Review the log file and remove any sensitive information that you would prefer not to expose. h. Repeat the above steps to restore the logging level to the default "INFO" setting. i. Contact RTI support. Click on the info button ('i') in the lower right corner of Recording Console to open the info panel, which contains links for contacting RTI support. Provide a description of the problem, how to reproduce it, and a copy of the log file. If possible, please include a screenshot that demonstrates the problem. RTI's support team is very responsive, you should receive a reply within 24 hours. 2-12 Chapter 3 Using the Record Tool Besides using Recording Console, you can also record data by using the Record tool. While the Console provides a simple graphical user interface (GUI) for using the Record tool, you can also run it directly, without using the Console. You may find this method of recording useful when you want to tie its service into your own infrastructure or software or if you need to use its more advanced features. For instance, perhaps you want to run them from your own script to record periodically or to process the recorded data automatically. See also: ❏ Chapter 4: Configuring the Record Tool ❏ Chapter 5: Accessing the Record Tool from a Remote Location 3.1 Starting the Record Tool Open a command prompt1 and change to the /bin directory. Then enter: ❏ On Linux and Mac OS X systems: > rtirecord -cfgFile -cfgName ❏ On Windows systems: > rtirecord.bat -cfgFile -cfgName To see a list of available arguments, enter rtirecord -help. The Record tool is dynamically linked against the Connext DDS libraries. You should run the tool from the scripts in the /bin directory—not from the executable files themselves. The scripts set all the paths and variables needed for the tool to find the shared libraries and run correctly. To see which configurations are available, use the -listCfgs option: $ rtirecord -listCfgs To use your own configuration file: $ rtirecord -cfgFile config-file.xml -cfgName my_record_cfg Table 3.1 describes the command-line options and which ones are required. 1. On Windows systems: from the Start menu, select Accessories, Command Prompt. 3-1 Stopping the Record Tool Chapter 4: Configuring the Record Tool describes the contents of the configuration file. Example files are provided in the /recording_service directory. Table 3.1 Record Tool’s Command-Line Options Command-line Option 3.2 Description -appName Assigns an application name to the DomainParticipants created by the Record tool. If not specified, the same name used in -cfgName will be used. -cfgFile Required. Specifies the XML configuration file (path and filename). In addition to the file provided using this command-line option, the Record tool can load other XML files—see Section 4.1. -cfgName Required. This name is used to find the matching tag in the configuration file. -help Prints version information and list of command-line options. -licenseFile Specifies the license file (path and filename). Only applicable to licensed versions of the Record tool. -listCfgs Lists the available configuration profiles. -verbosity Specifies what type of logging information should be printed. 0: silent (Connext DDS and the Record tool) 1: errors (Connext DDS and the Record tool) (default) 2: warnings (the Record tool only) 3: warnings (Connext DDS and the Record tool) 4: information (the Record tool only) 5: tracing (the Record tool only) 6: tracing (Connext DDS and the Record tool) This property can also be set in the configuration file. However, this command-line option overrides the value specified in the configuration file. Stopping the Record Tool To stop the Record tool: Press Ctrl-C. The Record tool will close all files and perform a clean shutdown. You can also start, stop, and even reconfigure the Record tool remotely—see Chapter 5: Accessing the Record Tool from a Remote Location. 3.3 Format of the Recorded Data This section describes the format of the recorded data. For information on viewing the data, see Chapter 9: Viewing Recorded Data. 3.3.1 Discovery Data The Record tool stores discovery-related data in these tables: ❏ DCPSParticipant — corresponds to the Participant Built-in Topic 3-2 Format of the Recorded Data ❏ DCPSPublication — corresponds to the Publication Built-in Topic ❏ DCPSSubscription — corresponds to the Subscription Built-in Topic Please refer to the RTI Connext DDS C API Reference HTML documentation for the fields in each of the corresponding builtin topics. (In the HTML documentation for the C API, select Modules, RTI Connext DDS API Reference, Domain Module, Built-in Topics.) Note: When using self-contained database files, the locator_filter column of the Publication Built-in Topic Data will not be replicated. The Subscription Built-in Topic Data will also not be replicated. This is done to minimize the overhead of replication when opening a new database file. The fields stored for each discovery table are listed in Appendix A. If no field selection settings enabled, the Record tool will just create the DCPSPublication table with enough information for the Replay tool to work. Fields can be added to the tables, see Choosing Which SampleInfo and Discovery Fields to Record (Section 4.5.1). If fields are added to the DCPSParticipant and DCPSSubscription tables they will be created. 3.3.2 User Data 3.3.2.1 Deserialized Data When the Record tool stores data in deserialized form, it creates a mapping from a Topic’s type to a table. Each individual scalar is stored in a column named with the fully qualified name. For example, the following will create a column, bar$x: struct Bar { long x; }; struct Foo { Bar bar; }; 3.3.2.2 Serialized Data If the topic data is saved in serialized form, the user data table will contain the following columns: ❏ rti_serialized_sample: Raw binary data for the sample ❏ rti_serialized_length: Length of the raw data blob ❏ rti_serialized_endian: 1 — little endian, 0 — big endian 3.3.2.3 Sample Info and Metadata Fields The Record tool creates a table called TopicName$RecordGroupName$Domain-Name for each recorded topic (unless the shared_table property is true). The Record tool stores topic data as specified in the subscription properties. For each topic, the Record tool also stores the following extra columns, by default: ❏ The Sample Info’s reception timestamp (in nanoseconds since Jan. 1st, 1970). ❏ The Sample Info’s valid data boolean indicator. ❏ Table_prefix: A string representing “RecordGroupName$DomainName” (only if is specified—see TopicGroup Properties (Section 4.8)). The fields selected for recording can be modified using the tag in both the Database (Output File) Properties (Section 4.5)) and RecordGroup Properties (Section 3-3 Format of the Recorded Data 4.9) in the Recorder configuration. The name and SQL type for all the fields that can be recorded appear in Appendix A. 3-4 Chapter 4 Configuring the Record Tool When you start the Record tool, you may specify a configuration file in XML format (it is not required). In that file, you can set properties that control what to record, how to record, and where to save the recorded data. This chapter describes how to write a configuration file. 4.1 How to Load the XML Configuration The Record tool loads its XML configuration from multiple locations. This section presents the various approaches, listed in load order. The first three locations only contain QoS Profiles and are inherited from Connext DDS (see the chapter on Configuring QoS with XML in the RTI Connext DDS Core Libraries User's Manual). ❏ /resource/xml/NDDS_QOS_PROFILES.xml This file contains the Connext DDS default QoS values; it is loaded automatically if it exists. (First to be loaded.) ❏ File in NDDS_QOS_PROFILES The files (or XML strings) separated by semicolons referenced in this environment variable are loaded automatically. ❏ /USER_QOS_PROFILES.xml This file is loaded automatically if it exists. If the USER_QOS_PROFILES file is found and there is a default profile specified in it, this default profile is automatically applied to the QoS settings of the Recording Service entities. The next locations are specific to Recording Service. ❏ /resource/xml/RTI_RECORDING_SERVICE.xml This file contains the default configuration for the Record tool; it is loaded if it exists. RTI_RECORDING_SERVICE.xml defines a configuration that records all topics on domain 0. ❏ /USER_RECORDING_SERVICE.xml This file is loaded automatically if it exists. ❏ File specified with the command-line option, -cfgFile (see Table 3.1 on page 3-2). ❏ File specified using the remote command ‘configure’ 4-1 General Format The configure command (see Table 3.1 on page 3-2) allows loading of an XML file remotely. The file loaded using this command replaces the file loaded using the -cfgFile command-line option. (Last to be loaded.) You may use a combination of the above approaches. 4.2 General Format The configuration file uses XML format. The XSD definitions followed by the configuration are in the document resource/schema/rti_record.xsd. All the following main sections are optional; if specified, they must be in this order: ❏ General Properties for the Record Tool (Section 4.3) ❏ Remote Access Properties (Section 4.4)—contained in the top-level tag, ❏ Database (Output File) Properties (Section 4.5)—contained in the top-level tag, ❏ Domain Type Configuration (Section 4.6)—contained in the top-level tag, ❏ Domain Properties (Section 4.7)—contained in the top-level tag, ❏ TopicGroup Properties (Section 4.8)—contained in the top-level tag, ❏ RecordGroup Properties (Section 4.9)—contained in the top-level tag, Let’s look at a very basic configuration, just to get an idea of its contents. You will learn the meaning of each line as you read the rest of this chapter. Example configuration files are provided in the examples/record directory: ❏ simple_config.xml With this configuration, the Record tool will record all fields from all topics in a specified domain (domain ID 0). ❏ advanced_config.xml With this configuration, the Record tool will record: • The ‘x’ and ‘y‘’ fields from all Topics named Square in domains 0 and 1. • The ‘color’ field from all Topics in domains 0 and 1. ❏ remote_shell.xml This configuration file provides a configuration that can be used with the tutorial found in the Recording Service Getting Started Guide to learn about how to modify the Record tool while it is running. 4.2.1 Configuration File Syntax Recording Service follows the same XML syntax rules as Connext DDS. Please see the RTI Connext DDS Core Libraries User’s Manual for details. 4.2.2 Supported Data Types As you will see in the following sections, each property that can appear in the configuration file uses a specific data type. The Record tool converts between the value string in the XML file and the specified type. Table 4.1 lists the supported types and the mappings used by the Record tool. Table 4.1 Property Value Data Types Type char and octet sequences and arrays DDS_Boolean Format Notes Compact form yes,1,true,on: TRUE no,0,false,off: FALSE These values are not case sensitive. 4-3 General Format Table 4.1 Property Value Data Types Type Format Notes Enum values are not case sensitive. DDS_Enum A string Legal values are those listed for the property in the RTI Connext DDS C API Reference HTML documentation. A 32-bit signed integer. You may include the following unit designations: KB — 2^10 kB — 10^3 DDS_Long -2147483648 - 2147483647 0x80000000 - 0x7fffffff MB — 10^6 GB — 10^9 KiB — 2^10 MiB — 2^20 GiB — 2^30 For example, 100 kB is a legal value, meaning 100,000. A 32-bit unsigned integer. You may include the following unit designations: KB — 2^10 kB — 10^3 DDS_UnsignedLong 0 - 4294967296 0 - 0xffffffff MB — 10^6 GB — 10^9 KiB — 2^10 MiB — 2^20 GiB — 2^30 For example, 100 kB is a legal value, meaning 100,000. 4-4 General Format Table 4.1 Property Value Data Types Type Format Notes Each field in each QoS policy structure has a corresponding tag. The tag is the same as the field name in the Connext DDS C API. DDS_QosPolicy See the RTI Connext DDS C API Reference HTML documentation for the structure of each QoS policy, and the RTI Connext DDS Core Libraries User’s Manual’s chapter on Configuring QoS with XML. For enumerations, the legal constants are those defined for the Connext DDS C API. For example: simple_config.dat 0 RTIDDS_DESERIALIZEMODE_ALWAYS 4-2 General Format * * domain0 All The above configuration will set (a) the Presentation QoS policy’s access_scope field to DDS_TOPIC_PRESENTATION_QOS and (b) the Partition QoS policy’s name field to “rti”. (name is a sequence of strings, which requires using the DDS_TOPIC_PRESENTATION_QOS rti tag, also described in this table.) FileSize 64 bit integer You may include the following unit designations: kB — 10^3 MB — 10^6 GB — 10^9 KB — 2^10 TB — 10^12 KiB — 2^10 MiB — 2^20 GiB — 2^30 TiB — 2^40 For example, 100 kB is a legal value, meaning 100,000. String UTF-8 character string All leading and trailing spaces are ignored between two tags. 4-5 General Properties for the Record Tool 4.3 General Properties for the Record Tool Table 4.2 describes optional properties that control the Record tool’s main module. Table 4.2 General Properties Property auto_start replay_ compatibility verbosity 4.4 Syntax DDS_Boolean DDS_Boolean DDS_Long Description Whether or not the Record tool should start recording data when it is started. This option is mostly useful if the Record tool is usually controlled remotely. Default: True If set to true, the Record tool will always preserve the fields needed by the Replay tool to work with the recorded database, regardless of the field selection settings (see Table 4.4, “Database Properties” and Table 4.15, “RecordGroup Properties”) specified by the user. Default: True The verbosity is a bit-map that specifies what type of logging information should be printed. The verbosity may be: 0: silent (Core Libraries and the Record tool) 1: errors (Core Libraries and the Record tool) (default) 2: warnings (the Record tool only) 3: warnings (Core Libraries and the Record tool) 4: information (the Record tool only) 5: tracing (the Record tool only) 6: tracing (Core Libraries and the Record tool) Remote Access Properties As you will see in Chapter 5: Accessing the Record Tool from a Remote Location, you can create a Connext DDS application that can remotely control the Record tool. By default, Remote Access is turned off in the Record tool for security reasons. The Remote Access section of the configuration file is used to enable Remote Access and configure its behavior. A Remote Access section is not required in the configuration file. The remote application can send commands to the Record tool that will: ❏ Start/stop recording. ❏ Shutdown the Record tool. ❏ Reconfigure the Record tool. Table 4.3 describes the Remote Access properties. All Remote Access properties must be specified insideand tags. All remote access properties are optional unless otherwise noted. 4.4.1 Enabling RTI Distributed Logger in the Record Tool The Record tool provides integrated support for RTI Distributed Logger. 4-6 Remote Access Properties Table 4.3 Remote Access Properties Properties underaccept_ broadcast_ commands Syntax DDS_Boolean enabled DDS_Boolean datareader_qos DDS_DataReaderQos datawriter_qos DDS_DataWriterQos distributed_ logger Distributed Logger Properties publish_ status_ periodDDS_Long publisher_qos DDS_PublisherQos Description Specifies if the Record tool will accept commands that have been broadcast to any Record tool or only accept commands addressed specifically to it. (See Chapter 5: Accessing the Record Tool from a Remote Location.) Default: True Enables or disables remote access to the Record tool from another application. (See Chapter 5: Accessing the Record Tool from a Remote Location.) Default: False (remote access disabled) Configures the QoS for the DataReader created by the Record tool’s Remote Access module. Default: default DataReader QoS settings. Configures the QoS for the DataWriter created by the Record tool’s Remote Access module. Default: Default DataWriter QoS settings. Configures RTI Distributed Logger. See Enabling RTI Distributed Logger in the Record Tool (Section 4.4.1). Specifies, in seconds, the period between each status message sent by the Record tool. Default: 1. Minimum value: 1. Configures the QoS for the Publisher created by the Record tool’s Remote Access module. Default: default Publisher QoS settings. Required if enabled is true. remote_access_ domainString Specifies which domain the Record tool will use to enable remote access. Only one domain can be specified. Note that this is a String, not a Domain ID. It is the same String used in theline. Default: False subscriber_qos DDS_QosPolicy Configures the QoS for the Subscriber created by the Record tool’s Remote Access module. Default: Default Subscriber QoS settings. Distributed Logger is included in Connext DDS but it is not supported on all platforms; see the RTI Connext DDS Core Libraries Platform Notes to see which platforms support Distributed Logger. When you enable Distributed Logger, the Record tool will publish its log messages to Connext DDS. Then you can use RTI Monitor1 to visualize the log message data. Since the data is pro- 1. RTI Monitor is a separate GUI application that can run on the same host as your application or on a different host. 4-7 Database (Output File) Properties vided in a Connext DDS topic, you can also use rtiddsspy or even write your own visualization tool. To enable Distributed Logger, modify the Record tool’s XML configuration file. In thesection, add the tag as shown in the example below. There are more configuration tags that you can use to control Distributed Logger’s behavior. For example, you can specify a filter so that only certain types of log messages are published. For details, see the Distributed Logger section of the RTI Connext DDS Core Libraries User’s Manual. 4.5 Database (Output File) Properties Table 4.4 describes the Database properties. All database properties are optional except database_name. All database properties must be specified within true adminDomain true and tags. The Record tool stores data in a set of SQL database files. (Note, however, that you do not need to install any database software to use the Record tool.) [Note: Replaying data from a set of files is not supported. This holds true for both Recording Console and the Replay tool. They can only replay data from one file at a time.] A fileset is a named collection of file segments which belong to the same recording session. Each of these file segments contains discovery and user-data, and the format is determined by SQLite. The Record tool uses a fixed file-naming scheme: name_set-number_segment-number Where: ❏ name is the base filename for the fileset, specified in the configuration file with theproperty. ❏ set-number is an integer identifying the fileset, specified in configuration file with the property. ❏ segment-number is an integer identifying the file-segment within the fileset. The first segment number to use, and the maximum number of segments are specified in the configuration file with the and properties, respectively. For example: mydata_5_3 means this file belongs to fileset 5 and is the 3rd segment in that fileset. The maximum size of a file segment, whether to overwrite existing files, and whether to overwrite the oldest file can all be set in the configuration file. 4-8 Database (Output File) Properties Table 4.4 Database Properties Properties under Syntax Description Specifies which fields to include/ exclude in the discovery tables. There are settings for each of the three recorded discovery tables described in Table 4.5. Required. database_ name flush_period String The name of the fileset used to store recorded data. The Record tool appends a set number and a segment number to the filename. Default: undefined Example: ParticipantData fields builtin_topic_ metadata_ PublicationData fields fields SubscriptionData fields myfile Specifies how often (in seconds) to flush data to disk. Note: increasing this value causes the Record tool to use additional memory. Default: 1 second Minimum: 1 second max_file_ segmentsDDS_Long DDS_Long Specifies how many file segments may be created. Each time the max_file_size limit is reached for a file segment, a new file is created if this number of segments has not been exceeded. Default: 1 Example:100 max_file_size FileSize Specifies the maximum size for a file segment. The Record tool records data to one or more files. This property specifies the maximum file size. This is not an absolute value, but a threshold value. As soon as the threshold is exceeded, no more data is written to file. Default: 2 GB Maximum: imposed by the operating system Example:1 GB 4-9 Database (Output File) Properties Table 4.4 Database Properties Properties underSyntax Description Specifies whether or not the Record tool should delete all existing file segments in the fileset before it starts recording. overwrite DDS_Boolean This is useful if you want to reuse a data-file name between recording sessions, but do not want to keep any old data. • True: If the file segments already exist, they are deleted; otherwise, the file segments are created as needed. • False: If the file segments already exist, the Record tool exits; otherwise, the file segments are created as needed. Example:test 4 yes In this case, the Record tool will delete test_0_0, test_0_1, and test_0_2 before starting to record to test_0_0. Default:False Specifies the path separator character that the Record tool will use when creating table and column names. For instance, table names follow the "TopicName$RecordGroupName$DomainName" convention and fields in Topics use $ to navigate hierarchical types, such as a$b$c.. path_ separatorDDS_Char The dollar sign (‘$’) is used as the default path separator instead of the more conventional comma (',') because $ does not require quotes when used in SQLite SQL statements. For example, to use '#' as the path separator:# Notes: • Using a character that can be included in a field name, such as an "_" (underscore) may lead to errors when you try to replay the file with Replay if any field contains that character. • This is not a required property, but when added, it cannot be empty. 4-10 Database (Output File) Properties Table 4.4 Database Properties Properties underrollover Syntax DDS_Boolean Description Specifies whether or not the Record tool should overwrite existing file segments in the fileset once the file size limit (max_file_size) has been reached for the last file segment. • True: Overwrite existing file segments as needed (starting with the first one). • False: Stop recording data. Default: False Specifies the first segment to use in the fileset. segment_ numberDDS_Long If the segment number is >= 0, that is the first segment number in the fileset. Default: -1. The next available segment number will be used, starting at 0. Note:The set number is determined first, then the segment number. Specifies the set number to use in the fileset. set_numberDDS_Long If set_number is >= 0, that specific fileset number is used. In this case, theproperty takes effect. Default: -1. The next available set number will be used, starting at 0. 4-11 Database (Output File) Properties Table 4.4 Database Properties Properties under Syntax Description Specifies a list of SQLite pragma statements to be applied to the database. There must be at least one ' ' object in the list; there is no upper limit for the number of pragmas that can be specified. Pragmas are applied right after database creation and before any table is created. The pragma name is just the name of the SQLite pragma (e.g., page_size) as defined by SQLite. The PRAGMA SQLite keyword should not be specified, as the Record tool will do that automatically. Values or parameters can be provided (e.g., page_size = 4096 or table_info(DCPSPublication)). The output of the pragma statements is shown in standard output. See https://www.sqlite.org/pragma.html Notes: • One possible pragma is the database journal mode. One of the journal modes is WAL (write-ahead logging). This mode improves concurrency when reading and writing to the same database file from different processes or threads. However, WAL doesn't work on network file systems. • The order in which you specify the pragmas is the order in which they will be applied. user_topic_ metadata_ fields sqlite_ pragmas pragma name [plus assignment or parameters] ...Specifies lists of included and excluded Sample Info or metadata fields in the user topic tables. A field expression is a Posix fnmatch expression to match field names as described in Appendix A (e.g. "SampleInfo_*" will match all Sample Info specific fields). There is no upper limit to the number of field expression ...field expression ...expressions to be specified. The ‘included’ and ‘excluded’ fields are optional. If both are defined, the ‘included’ expressions are processed before the ‘excluded’ ones. User topic field settings can also be expressed in the Record Group settings (see Table 4.15, “RecordGroup Properties”). If defined, Record Group settings take precedence over general database settings defined here. 4-12 Database (Output File) Properties Table 4.5 Builtin Topic (Discovery) Field Selection Properties Properties under Syntax Description field expression ... DCPSParticipant_ topicfield expression ... Specifies lists of included and excluded fields in the DCPSParticipant table. A field expression is a POSIX fnmatch expression to match field names as described in Appendix A (e.g. "ParticipantData_*" will match all DCPSParticipant specific fields). There is no upper limit to the number ofexpressions to be specified. The ‘included’ and ‘excluded’ fields are optional. If both are defined, the ‘included’ expressions are processed before the ‘excluded’ ones. DCPSSubscription _ topic field expression ... DCPSPublication_ topicfield expression ... Specifies lists of included and excluded fields in the DCPSPublication table. A field expression is a POSIX fnmatch expression to match field names as described in Appendix A (e.g. "PublicationData_*" will match all DCPSPublication specific fields). There is no upper limit to the number ofexpressions to be specified. The ‘included’ and ‘excluded’ fields are optional. If both are defined, the ‘included’ expressions are processed before the ‘excluded’ ones. Specifies lists of included and excluded fields in the DCPSSubscription table. A field expression is a POSIX fnmatch expression to match field names as described in Appendix A (e.g. "SubscriptionData_*" will match all DCPSSubscription specific fields). There is no upper limit to the number of field expression ...field expression ...expressions to be specified. The ‘included’ and ‘excluded’ fields are optional. If both are defined, the ‘included’ expressions are processed before the ‘excluded’ ones. 4-13 Database (Output File) Properties 4.5.1 Choosing Which SampleInfo and Discovery Fields to Record To reduce database size and increase flexibility, the Record tool provides a way to select which Sample Info, discovery (DCPSPublication, DCPSSubscription and DCPSParticipant), and metadata fields should be recorded. An application may not be interested in recording all the metadata, SampleInfo, and discovery information. Before this feature was introduced, the Record tool would record everything by default. Now, the Record tool will only record the fields necessary for the Replay tool to work with the database. These fields are: ❏ In the user table: SampleInfo_valid_data and SampleInfo_reception_timestamp. ❏ In the DCPSPublication table: PublicationData_topic_name, PublicationData_type_name, PublicationData_typecode and PublicationData_typecode_length. The Record tool provides capabilities to add to, or to remove from, this set of fields. It also provides a special boolean flag called replay_compatibility (see Table 4.2, “General Properties”). When this flag is enabled (the default), it preserves the above set of fields, regardless of which fields the user chooses to exclude. This way very general regular expressions can be used without affecting compatibility with the Replay tool. Table 4.4 describes the XML settings for selecting fields in the discovery tables (tag ). There are settings for each of the three discovery tables created by the Record tool (tags , and ). In any of the tables, if you decide to exclude all fields (for example: ), the table will not be created; that is, if a table would end up with no columns, the Record tool won't create it. The field selection settings also apply to user topic tables. The tag used to define those settings is called * ; it can be used inside to define general settings, and inside to define settings that apply only to a specific Record Group. Record Group settings take precedence over general database settings. These settings are described in Table 4.4, “Database Properties”and Table 4.15, “RecordGroup Properties”. 4.5.1.1 Field Selection Examples This section shows some examples of how to configure field selection settings for the Record tool. The following is a basic recording configuration used as the starting point for the examples. It is based on the default configuration shipped with the product (see the file RTI_RECORDING_SERVICE.xml in the resource/xml directory): By default, the Record tool will record only the fields that the Replay tool will need to work with the recorded database. Furthermore, because the replay_compatibility flag is set to true, these fields will be protected by the Record tool and will always be present when recording. 4.5.1.2 Example 1: Record Everything The following configuration uses the builtin_topic_metadata_fields and user_topic_metadata_field settings in the recorder_database section to record all possible fields in all tables, including the discovery ones. true true domain0 true WARNING 4-14 Database (Output File) Properties rti_recorder_default.dat 0 RTIDDS_DESERIALIZEMODE_ALWAYS * * domain0 AllTopics 4-16 Database (Output File) Properties 4.5.1.3 Example 2: Record No Extra Fields The following configuration will record only user data fields in user data tables. No Sample Info or metadata fields will be recorded. Moreover, no discovery information is selected to be recorded so no discovery tables will be created. The replay_compatibility flag must be disabled for this configuration to work, because if enabled, it would lock the Replay tool’s compatibility fields and they would be recorded. true true domain0 true WARNING rti_recorder_default.dat 4-15 Database (Output File) Properties* * * * 0 RTIDDS_DESERIALIZEMODE_ALWAYS * * domain0 AllTopics 4.5.1.4 Example 3: Overriding Database Settings with Record Group Settings In the following configuration, two sets of settings are defined for user topic tables. The settings in the general database section include the SampleInfo_source_timestamp field in the user topic field selection settings (apart from the fields included by default). There is an extra Topic Group called KeyedTopics, which the user will associate with keyed topics. There may be an interest in recording the instance handle field (SampleInfo_instance_handle) for these topics. This may be done by defining a new Record Group with different field selection settings, as shown below. One important aspect of the configuration is the use of the exemption expression in the AllTopicsExceptKeyed Topic Group. By using the exemption expression 'Keyed*' we make the two available Topic Groups (AllTopicsExceptKeyed and 'KeyedTopics) disjoint, because AllTopicsExceptKeyed will never match the same topics as KeyedTopics. This is very important to be sure that the right settings apply to the right topics. false true domain0 true WARNING rti_recorder_default.dat * * * * 4-17 Database (Output File) Properties0 RTIDDS_DESERIALIZEMODE_ALWAYS * * domain0 AllTopics 4.5.1.5 Example 4: Recording Everything Except the Metadata Fields The following example configuration shows how to record all fields except the metadata fields (prefixed with Metadata_). The key for this is to first include everything with the '*' regular expression and then exclude fields matching Metadata_*. true true domain0 true WARNING 4-18 Database (Output File) Properties rti_recorder_default.dat SampleInfo_source_timestamp 0 RTIDDS_DESERIALIZEMODE_ALWAYS * Keyed* * Keyed* * domain0 AllTopicsExceptKeyed domain0 4-19 Database (Output File) Properties KeyedTopics SampleInfo_instance_handle 4-21 Domain Type Configuration 4.6 Domain Type Configuration The top-level tag true true domain0 true WARNING rti_recorder_default.dat * Metadata_* 4-20 Database (Output File) Properties * Metadata_* * Metadata_* * Metadata_* 0 RTIDDS_DESERIALIZEMODE_ALWAYS * * domain0 AllTopics allows you to pass type configuration information to the Record and Converter tools in the form of XML type-configuration files. Table 4.6 describes the Domain Type Config properties. All Domain Type Config properties are optional. Table 4.6 Domain Type Configuration Properties Properties under Description domain_group Table 4.7 Syntax A list of type configuration elements associated with specific Recorder domain definitions (see Section 4.7). These type configuration elements can be repeated. For more details in the contents of this tag See Table 4.7, “Domain Group Configuration Properties”. Domain Group Configuration Properties Properties under Domain Group Properties domain_filter type_config Syntax Description A list of POSIX expressions that specify the names of the Recorder domain definitions for which the type definitions specified will apply. The element tag can be repeated. The POSIX expressions have to match the name attribute of any of the domain definitions as defined in Section 4.7. POSIX fn expression XML Properties Specific XML type configuration properties for the domains specified by the list of elements in the domain_filter tag seen above. See Table 4.8, “Type Config Properties”. Table 4.8 Type Config Properties Properties underxml Syntax XML Type Configuration Properties Description Allows you to specify XML type-configuration files, the path in which to find them, and other properties related to the registration of the types with the DomainParticipants. See Table 4.9, “XML Type Configuration Properties”. 4-22 Domain Type Configuration Table 4.9 XML Type Configuration Properties Properties underSyntax Description file_group File Group Properties Allows you to specify XML file groups; each of these files contain type definitions to be used by the Record tool. The element tag can be repeated. See Table 4.10, “File Group Properties”.max_sequence Integer max_string Integer The default sequence size, in case there are unbounded sequences in the type definitions specified in the any of the files specified in any of the file groups. The default string size, in case there are unbounded strings in the type definitions specified in any of the files specified in any of the file groups.register_ top_level path Path A list of the paths (relative or absolute) to be used when searching for the XML type definition files. Thetag can be repeated. Boolean Whether or not to register the top-level types found in the type definitions with their canonical names. Do this with any of the files defined in any of the file groups. Default: TRUE. Table 4.10 File Group Properties Properties underSyntax Description file_name File Name A list of file name strings, specifying files containing the type definitions. The element tag can be repeated.max_sequence Integer max_string Integer The default sequence size in case there are unbounded sequences in the type definitions specified in the any of the files specified in this specific file group. The default string size in case there are unbounded strings in the type definitions specified in any of the files specified in this specific file group . 4-23 Domain Properties Table 4.10 File Group Properties Properties underregister_ top_level Syntax Boolean Description Whether or not to register the top-level types found in the type definitions with their canonical names. Do this with any of the files found in this specific file group. The value of this setting overrides the value of the upper-level setting (see Table 4.9, “XML Type Configuration Properties”). Default: TRUE.Table 4.11 Type Registration Properties Properties under Type Registration type Properties Specific type properties. A list of type registration properties used to define how a type found in the files has to be registered by the Record tool in the DomainParticipants. See Table 4.11, “Type Registration Properties”Syntax register_top_level Boolean Description Whether or not to register this type's canonical name (as defined in tag type_name) with the DomainParticipant. This name is registered alongside any of the registration type names defined in tag registered_type_name above. Default: TRUE.registered_ type_name Registration name string When registering the type with the DomainParticipant, this setting defines a list of names to register the type with. The element tag can be repeated.topics Topic name string type_name Type Name string 4.7 This is a list of regular POSIX fn-name expressions (everyentry is equivalent to an expression). A topic whose name matches any of the expressions will be recorded using the type definition designated by . If a topic matches more than one expression in different entries, the first one that was matched will be used. A string representing the canonical type name as defined in the XML type definition for the type. Domain Properties Table 4.12 describes the Domain properties. All Domain properties are optional. 4-24 Domain Properties Domain properties must be specified inside and tags. If you want to use a RecordGroup (Section 4.9), you must assign a domain name with these tags, even if you do not specify any domain properties (because the domain name is needed in the RecordGroup’s domain_ref property). Table 4.12 Domain Properties Properties underSyntax Description Determines how topic data is stored in a database (serialized or deserialized). The following values are allowed: deserialize_ mode DDS_Enum domain_id DDS_Long • RTIDDS_DESERIALIZEMODE_AUTOMATIC Deserialize data if possible, otherwise store data in serialized format. • RTIDDS_DESERIALIZEMODE_NEVER Do not deserialize the data; store data in serialized format. • RTIDDS_DESERIALIZEMODE_ALWAYS Only store data if it can be deserialized first. Default: RTIDDS_DESERIALIZEMODE_NEVER See Recording Large User Data Types (Section 4.7.2). Sets the domain ID. Default: 0 Configures the DomainParticipant’s QoS policies.participant_qos DDS_QosPolicy Default: default DomainParticipant QoS settings See the RTI Connext DDS Core Libraries User’s Manual for details. (See the chapter on Configuring QoS with XML.) See the Notes: below for more information. You may specify more than one Domain. Each one must have a unique name, with its ownand tags. For example, the following creates a Domain named “mydomain” using domain ID 68. The data will be recorded in serialized format. The DomainParticipant will use default QoS settings, except for the Discovery QoS policy’s accept_unknown_peers field:Notes: ❏ If you do not set the 68 RTIDDS_DESERIALZEMODE_NEVER false property in the settings, the Record tool will automatically build a participant name and set it using the prefix "RTI Recorder: ". This is for compatibility with RTI Administration Console. If this property is 4-25 Domain Properties changed, the Record tool won't override the property, but compatibility between the Record tool and RTI Administration Console will be broken if the participant name is not prefixed with "RTI Recorder: " (notice the space after the colon). ❏ Transports are configured through the Property QoS under the tag. 4.7.1 Enabling Monitoring Library in the Record Tool RTI Monitoring Library enables Connext DDS applications to provide monitoring data. The monitoring data can be visualized with RTI Monitor, a separate GUI application that can run on the same host as Monitoring Library or on a different host. Recording Service is statically linked to Monitoring Library (you do not have to install it separately). To enable monitoring in the Record tool, modify the participants’ QoS in the XML configuration to include the rti.monitor.library property with a value of rtimonitoring. For example: See also: Enabling Monitoring Library with Replay (Section 7.4.1). 4.7.2 Recording Large User Data Types When the Record tool records serialized user data, each primitive type in the topic’s data structure will have its own column in the table. The maximum number of columns is approximately 5,050. Therefore, if you have a data-type that would require more than 5,050 columns, you must set the deserialize_mode property to RTIDDS_DESERIALIZEMODE_NEVER. (Disregarding this limit will cause recording to fail.) Note: Each primitive type is considered a column. For example, the following would require 3,000 columns: long Array[3000]; As another example, the following y[0].x.a,y[0].x.b,y[1].x.a,y[1].x.b, etc. would require separate columns struct X { long a; long b; }; struct Y { X x; }; struct Z { Y y[10]; } 4-26 for TopicGroup Properties 4.8 TopicGroup Properties A TopicGroup is an optional logical collection of Topics. If you are not going to have a RecordGroup in the configuration file, you do not need a TopicGroup. (See Section 4.9.) Table 4.13 describes the TopicGroup properties. TopicGroup properties must be specified inside rti.monitor.library rtimonitoring false 0 and tags. The following properties are required: ❏ field_expr ❏ shared_table ❏ topics Table 4.13 TopicGroup Properties Properties underauto_detect_ reliability compact_char_ array compact_char_ sequence compact_ octet_array compact_ octet_sequence Syntax DDS_Boolean DDS_Boolean DDS_Boolean DDS_Boolean DDS_Boolean Description If set to true, use the same reliability as the Publisher of the matched Topic. Default: False Store array of char in a single column. The default (true) saves the most space. While it is possible to store individual elements in separate columns, it is not recommended as the number of columns stored can become very large. Default: True Store sequence of char in a single column. The default (true) saves the most space. While it is possible to store individual elements in separate columns, it is not recommended as the number of columns stored can become very large. Default: True Store array of octet in a single column. The default (true) saves the most space. While it is possible to store individual elements in separate columns, it is not recommended as the number of columns stored can become very large. Default: True Store sequence of octet in a single column. The default (true) saves the most space. While it is possible to store individual elements in separate columns, it is not recommended as the number of columns stored can become very large. Default: True 4-27 TopicGroup Properties Table 4.13 TopicGroup Properties Properties underSyntax Description Specifies the QoS settings for all DataReaders created for this TopicGroup. datareader_qos DDS_DataReaderQos A DataReader is created for each discovered Topic that matches topic_expr. All the DataReaders for the TopicGroup will use the same set of QoS policies. You can specify all of the QoS policies with the datareader_qos property. See the RTI Connext DDS Core Libraries User’s Manual for more information. (See the chapter on Configuring QoS with XML.)exemption field_expr POSIX fn expressions POSIX fn expressions Specifies a comma-separated list of expressions that should not be recorded. Default: Nothing is exempt Required. A list of comma-separated POSIX expressions that specify which fields in the Topics to record. (The Topics are specified with, see Table 4.14, “Topics Properties”.) If set to ‘*’, everything is recorded. This parameter is ignored when recording serialized data. include_ meta_columns DDS_Boolean In the database, every sample is stored alongside all its sample information. If this property is set to FALSE, the sample is stored in a serialized way, with no sample information attached to it. Setting this to FALSE (not the default) saves storage space. When set to FALSE, less columns are created in the SQLite database. The columns in this database are often filled with repetitive data. So this option can save space and execution time when these requirements are critical. Default value: Trueindex User Data Table fields Allows you to create an index for the recorded database based on the fields provided as parameters. See ‘Create Index’ Syntax (Section 4.8.1) for details. 4-28 TopicGroup Properties Table 4.13 TopicGroup Properties Properties underSyntax shared_table DDS_Boolean Description Required. Specifies whether the tables of recorded data are shared or exclusive. The Record tool stores Topic data in tables; those tables can be Shared or Exclusive. An Exclusive table means that each Topic recorded in a RecordGroup is stored in its own table. The name of the table follows the convention: TopicName$RecordGroupName$DomainName (You can change the $ separator with the path_separator database property described in Table 4.4.) Thus, two topics with the same name but from two different TopicGroups are stored in separate tables. A shared table means that Topics with the same name are stored in the same table, regardless of where it was recorded from. In this case the table has an additional column, table_prefix, which stores the table prefix in the form: RecordGroupName$DomainName. Default: False (exclusive)topics Table 4.14 Topics Properties Properties underPOSIX fn expression Required. Specifies a topic expression and any exemptions to that expression. See Table 4.14, “Topics Properties”.Syntax Description Required. A comma-separated list of POSIX expressions that specify the names of Topics to be included in the TopicGroup. The syntax and semantics are the same as for Partition matching. Default: Null topic_expr POSIX fn expression Note: Keep in mind that spaces are valid first characters in topic names, thus they can affect the matching process. For example, this will match both Triangle and Square topics (notice there is no space before Square):Triangle,Square However the following will only match Triangle topics (because there is a space before Square):Triangle, Square 4-29 TopicGroup Properties For example, the following creates a TopicGroup called AllTopics, which will include all discovered Topics. From those Topics, all fields will be recorded. This example does not specify the optional datareader_qos property, so it will use default DataReader QoS settings:This next example creates a TopicGroup called ColorsOfSquares that will only include Topics named “Square.” For the recorded Topics, only the “color” field will be recorded. The DataReaders for the matching Topics will have default QoS settings, except that the Reliability QoS’s kind will be DDS_RELIABLE_RELIABILITY_QOS: * * The following example creates a TopicGroup called AllMinusCircleAndSquare that will include all Topics except “Circle” and “Square.” For the recorded Topics, all fields will be recorded: Square color DDS_RELIABLE_RELIABILITY_QOS Notes: ❏ Topics are never removed from a TopicGroup. The resources used to create DataReaders for discovered Topics are not released if/when the Topics are deleted. ❏ The Record tool will ignore Topics published with a type that conflicts with an already discovered type. 4.8.1 ‘Create Index’ Syntax SQLite indexes may improve performance on certain SQL queries. The Replay tool creates an index based on the reception timestamp when opening the database, if it did not already exist (see Performance and Indexing (Section 6.4)). The process of building the index, however, may take some time for large tables. But if it is important for you to avoid spending this time, or if indexing needs to happen during the recording, this is an easy way to create customized indexes while still recording data into the database. Note: While other applications accessing the database may benefit from online indexing, the Record tool’s performance may drop because of it, so you should consider this when using online indexing. 4-30 TopicGroup Properties The Record tool's ability to create and store indexes for the User Data Table is controlled by the * Circle, Square * property under (see Table 4.13, “TopicGroup Properties”). The property expects one or more tags, which create the indexes. Syntax The can contain as many indexes as needed (for some notes about indexes and performance see Indexing and Performance in SQLite: Tips and Tricks (Section 4.8.2)). Each of those indexes can be built using one or more fields. The fields listed could be meta-data fields (such as the reception timestamp used by the Replay tool) or user-data ones. In addition, you may optionally add a prefix to the index. The general syntax is: ... The above configuration will create an index named OptionalPrefix$TableName, where $ is the default path-separator (although it could be replaced using the... One_field Another_field ...property) and TableName is the name of the user-data table (see Table 4.4, “Database Properties” for details). There are some details to consider when creating an index: ❏ An index can only be created based on columns that actually exist in the user-data table. So if some or all of the columns specified in the index configuration are excluded (see Choosing Which SampleInfo and Discovery Fields to Record (Section 4.5.1)), they cannot be used to build an index. ❏ If the index cannot be created, a warning is shown and the Record tool will continue its execution. ❏ Two indexes cannot share the same prefix. If that happens, only the first one is created. ❏ If no prefix is provided, the string "index" and a ordinal number are added before the table name. For instance, if two indexes are created for a given table, their names will be index1$TableName and index2$TableName. Examples: To improve the Replay tool's initialization performance, we can create an index using the field SampleInfo_reception_timestamp like this: Note that this is the same index that would be created by the Replay tool. (This index corresponds to the one created by the old database property SampleInfo_reception_timestamp , which is no longer supported.) User-data fields can also be used to create indexes. To add a user-data field to an index configuration, you must use the fully qualified name of the field. This notation is similar to the notation used to access data fields in filter expressions for content-filtered topics (see RTI Connext DDS Core Libraries User’s Manual for more details). Fields inside container types are accessed using a period character '.' (e.g., field1.nestedField2.nestedField3...). Fields in collections (arrays and sequences) can be accessed using square brackets ('[]') notation (e.g., collectionField[1].nested- 4-31 TopicGroup Properties Field, matrixField[0][0].field1). Only primitive fields can be used for indexing, because the Record tool does not store non-primitive fields. For example, consider a race scenario. We have a collection of ten runners and their order in the race is recorded with the Record tool. The data types are defined using IDL as follows: struct Runner { int id; //@key char * name; //@key } struct Race { struct Runner runnerList[10]; TimeStamp currentTime; } If other applications are trying to access the recorded data in order to analyze it, we may want to speed up data retrieval for these applications by indexing the above data in many ways. For instance, we could build an index based on the ID and name of the first runner. We may also need an index based on the current time and the reception timestamp. The XML configuration to create these indexes is: ... The above configuration creates two indexes: ❏ firstRunnerIndex$TableName, which indexes on the first runner’s id and name. ❏ index1$TableName, which indexes on the SampleInfo_reception_timestamp field and user-data currentTime field. 4.8.2 Indexing and Performance in SQLite: Tips and Tricks Online indexing can affect the permanence of the insertions the Record tool makes in the database, because of the extra work to maintain the indexes. However, in situations where more than one application besides the Record tool will be accessing the database, online indexing may make a difference, especially for applications retrieving data from the database. It is important that indexes and the applications using them are as efficient as possible. Here are some tips and tricks about indexing and efficient usage of indexes in SQLite. 4.8.2.1 Small Size Data Fields Work Best as Index Columns The fewer bytes used in every index entry, the better for performance. SQLite stores indexes as B-Trees. Every tree node uses a page of the database file. If the index does not fit in one page, overflow pages are created. Keeping the index in one page may make a difference in terms of performance. Therefore, large BLOBS, compact octet or char arrays, etc. should be avoided as 4-32 TopicGroup Properties index columns. If you need to index on one of these types, consider building a hash key or similar compact representation and use that for indexing instead. The space overhead may be worth the performance improvement. 4.8.2.2 Use Multi-Column Indexes where Possible SQLite can use indexes that are created by indexing more than one column. However, SQLite only allows a single index per table within a simple SQL statement. For UPDATE and DELETE statements, this translates into only allowing a single index, since these statements can only work with one table at a time. Suppose we have a table with columns C 1, C 2, ..., C n and we want to access the table with a SELECT statement with columns C 1, C 2, ..., C i, i < n, in the WHERE clause, such as "... WHERE C 1 = value 1 AND C 2 = value 2 ... AND C i = value i.” SQLite will be able to use the index provided for each of the terms in the WHERE clause. However, if we have individual indexes for each column, SQLite can only access one of the indexes for the SELECT statement and will only benefit from the use of indexes for one of the search terms. 4.8.2.3 Avoid Excessive Indexes Each index added to the database has a performance cost: ❏ Every additional index takes up some additional space in the database. ❏ INSERT and UPDATE statements have to modify both the original table and every index associated with it. The performance of INSERT and UPDATE decreases linearly with the number of indexes. ❏ Compilation of the SQL statements takes longer when there are more indexes for the compiler to choose from. ❏ More indexes to choose from, bigger the chance the optimizer selects a suboptimal index for a query. Avoid redundant indexes where possible. If for a certain table we have index 1 indexing on columns (x,y) and index 2 indexing on columns (x,y,z) then index 1 is redundant and can be eliminated. 4.8.2.4 Use Indexes to Improve Performance of ORDER BY Clauses To evaluate statements containing ORDER BY classes, SQLite first puts all the results of the SELECT statement in a temporary table, then sorts the temporary table according to the ORDER BY clause columns. This can be time-consuming. Whenever possible, SQLite tries to avoid storing and then sorting the result set; it does this by using an index that makes the results of the SELECT statement appear in order. To force this to happen, provide the table with an index that indexes all the columns in the ORDER BY clause. For example, suppose we have a table with columns (x,y,z,a) and we want to execute the following query: SELECT a FROM table ORDER BY x,y,z Then providing an index in columns (x,y,z) will make SQLite avoid using a temporary table and sorting all the result set. The index can also be used to satisfy a WHERE clause and an ORDER BY clause in the same statement. In the example above, suppose we want to execute this statement: SELECT a FROM table WHERE x=value ORDER BY y,z The above index on columns (x,y,z) will still be used by SQLite both to speed up the WHERE clause and to avoid sorting the whole result set in the ORDER BY statement. 4-33 RecordGroup Properties Nevertheless, care must be taken so that the columns in the index are all used in the SQL statement. For example, consider the following statement: SELECT a FROM table WHERE x=value ORDER BY z It does not use "y", which creates a gap in the index terms of our index. This will make the index be used to speed up the WHERE clause, but won't avoid storing and sorting the whole result set afterwards. 4.8.2.5 Terms Used in Inequality Expressions should be Placed Last in Index Column Lists SQLite allows at most one index column to be used in statements containing inequality expressions (such as '<', '>', '<=' or '>='). Columns that are constrained by inequalities should be placed as the right-most term of the index. For example, suppose if we have a table with columns (x,y,z,a), an index in columns (x,y,z) and the following SQL statement: SELECT a FROM table WHERE x = value x AND y < value y AND z = value z The index does not help optimize term "z", because "y" is constrained by an inequality. SQLite allows up to two inequality expressions for the same column, as long as they provide upper and lower bounds for the column. So this statement will effectively use the index as the inequality expressions for "y" provide an upper and lower bound for the term: SELECT a FROM table WHERE x = value x AND y < value y1 AND y > value y2 4.8.2.6 Use Indexed Column Names in WHERE Clauses, not Expressions SQLite uses indexes for a column when the column name appears isolated in statements, not in more complex expressions. For example, if we have a table with column "x" and an index in "x", the index will be used if the SQL statement includes "x" but not expressions based on "x", such as these: ... WHERE x - value = 0 ... WHERE x * 1 = ? ... WHERE +x = value All the WHERE clauses above will cause a full-table scan and SQLite will not use the index to optimize the query. 4.9 RecordGroup Properties A RecordGroup is a binding between a TopicGroup and a Domain. It controls which TopicGroup members are recorded for each Domain. Any Topic that is part of a TopicGroup in the RecordGroup is recorded from the specified Domains. RecordGroups are optional. If you do not create one, the Record tool will not record any data. This is useful if you want to start the Record tool in “stand-by” mode—then you can use remote access (see Section 4.10) to switch to a different configuration file (one that does have a RecordGroup) and start recording. Table 4.15 describes the RecordGroup properties. Notice that domain_ref and topic_ref are required. RecordGroup properties must be specified insiderunnerList[0].id runnerList[0].name ... SampleInfo_reception_timestamp currentTime and record_group> tags. The name that you assign (“String”) will be used in the table name(s) in the database (output) file(s). 4-34 RecordGroup Properties Table 4.15 RecordGroup Properties Properties under Syntax domain_ref StringSequence subscriber_qosDDS_SubscriberQos topic_ref StringSequence Description Required. Specifies a sequence of references to domains. Default: Null Configures the Subscriber used by the RecordGroup. Default: default Subscriber QoS settings See the RTI Connext DDS Core Libraries User’s Manual for details. (See the chapter on Configuring QoS with XML.) Required. Specifies a sequence of references to TopicGroups. Default: Null Specifies lists of included and excluded Sample Info or metadata fields in the user topic tables. A field expression is a POSIX fnmatch expression to match field names as described in Appendix A (e.g. "SampleInfo_*" will match all Sample Info specific fields). There is no upper limit in the number of field expression ... user_topic_ metadata_fieldsfield expression ...expressions to be specified. The ‘included’ and ‘excluded’ fields are optional. If both are defined, the ‘included’ expressions are processed before the ‘excluded’ ones. User topic field settings can also be expressed in the Database settings (see Table 4.4). However, Record Group settings take precedence over general database settings defined there. For example, the following creates a RecordGroup called RecordAll, which will include all members of TopicGroup All that are discovered on Domain MyDomain. This example does not specify the optional subscriber_qos property, so it will use default Subscriber QoS settings: Note: A RecordGroup can refer to multiple domains and multiple TopicGroups. However, a RecordGroup will only record one of each matching Topic from a Domain. If multiple matches occur, only the first one will be recorded. (If you need to record the same Topic from the same domain using different QoS policies, you should use different TopicGroups and RecordGroups.) 4-35 Recording Service Integration with Extensible Types 4.10 Recording Service Integration with Extensible Types Recording Service includes partial support for the "Extensible and Dynamic Topic Types for DDS" specification from the Object Management Group (OMG)1. This section assumes that you are familiar with Extensible Types and you have read the RTI Connext DDS Core Libraries Getting Started Guide Addendum for Extensible Types. This support allows systems to define data types in a more flexible way, and to evolve data types over time without giving up portability, interoperability, or the expressiveness of the DDS type system. With Extensible Types, different type definitions for the same type name may be discovered by the Record tool during execution. The tool’s default behavior is to register the first type definition (type code) found for a type. You can learn more in the RTI Connext DDS Core Libraries Getting Started Guide Addendum for Extensible Types. ❏ Recording Service can subscribe to topics associated with optional, final, mutable, and extensible types. ❏ A topic “T” within a recording service domain ( AllTopics MyDomain ) can be associated with at most one version of a type. To record more than one version, you will have to use multiple recording service domains. ❏ Users can pre-register a set of types in a recording service domain by providing an XML description of the types. The XML description supports structure inheritance and mutability (described in the RTI Connext DDS Core Libraries Getting Started Guide Addendum for Extensible Types). ❏ The TypeConsistencyEnforcementQosPolicy can be specified on a per-topic-group ( ) basis, in the same way as other QoS policies. Conversions between extensible and mutable types are allowed if the TypeConsistencyEnforcementQosPolicy’s kind is set to ALLOW_TYPE_COERCION. 4.10.1 Selecting a Type Version For a Topic “T” In a Recording Domain A topic “T” within a recording service domain ( ) can be associated with at most one version of a type. By default, Recording Service will use the type associated with the first discovered DataWriter on topic “T”. This makes the selection of the type non-deterministic since it depends on the order in which DataWriters are discovered. To resolve this problem, you can provide the type in the XML configuration using the . For example: With the above type configuration, Recording Service will register the type "ShapeTypeExtended" with the DomainParticipant associated with “domain0”. When any of the topics in the domain0 1. http://www.omg.org/spec/DDS-XTypes/ 4-36 Recording Service Integration with Extensible Types ShapeType.xml false ShapeTypeExtended ShapeType Circle Square Triangle . list is matched ("Circle", "Square" or "Triangle"), Recording Service will use "ShapeTypeExtended" as the type for recording it. The name used for registering the type depends on the flag. If this flag is set to true, the type name used for the registration will be the canonical type name (in the example above, it would be "ShapeTypeExtended"). However, if this flag is set to false, at least one name has to be provided for registration of the type using the XML setting. The first name in this list will be the one used by Recording Service. When Recording Service discovers the first DataWriter on topic “T”, it will first try to match the topic name against the expressions in all the settings. If it finds a match, it will use the associated type settings. Otherwise, Recording Service will try to create the topic using the DataWriter’s registered type name. If the type name has not been registered with Recording Service ’s DomainParticipant yet, the new topic will be associated with the discovered type. If the type name is already registered, the new topic will use the registered type. 4.10.1.1 Example Let’s consider an example based on RTI Shapes Demo (described in the Recording Service Getting Started Guide). You can use Shapes Demo to publish and/or subscribe to either the "ShapeType" data type or the "ShapeExtended" data type. ShapeExtended includes the same data as ShapeType, plus two more fields: FillKind and Angle. Suppose Shapes Demo is publishing the base ShapeType in a domain and the Record tool is subscribing to ShapeType in the same domain. The Record tool will register and record data of type ShapeType. If a different instance of Shapes Demo—one that uses the ShapeExtended type— starts publishing in the same domain, the Record tool will record new data from this second instance of Shapes Demo. (Both types are compatible because one extends the other.) However, the Record tool will only record the fields corresponding to the base ShapeType, because that is the registered type. The Record tool will ignore the extra fields in the ShapeExtendedType (FillKind and Angle). 4-37 Recording Service Integration with Extensible Types As described in Selecting a Type Version For a Topic “T” In a Recording Domain (Section 4.10.1), this default behavior is non-deterministic regarding the types being recorded. That is, you have no control over what type version will be recorded. To change this behavior, you can change the Record tool’s configuration and provide the XML description of the desired type version via XML. We illustrate this with the following example, whose objective is to make sure that the Record tool records the type ShapeTypeExtended, no matter which types are being published. To do so, the Record tool needs a file that defines the type to be recorded, such as the following file named ShapeType.xml. Using the following configuration, the Record tool will always record the ShapeTypeExtended by using the XML type definition in ShapeType.xml. With the configuration below, no information from a DataWriter using ShapeTypeExtended will be lost. 4.10.2 Recording Two Versions of a Type in Different Tables in Same Database The following example shows how Recording Service can store samples of different type versions it finds for a topic "T" for the same DDS domain ID, in different tables, and without any loss or duplication of information (each type version is recorded completely, and no samples in one table are present in a different one). The type configuration settings in Recording Service allow the specification of name filters (regular POSIX fn-match expressions) which allow the specification of a subset of the Recording Service domains they will apply to. This allows the specification of different type selection settings (as described inSelecting a Type Version For a Topic “T” In a Recording Domain (Section 4.10.1)) for different Recording Service domains. With these tools and using RTI Shapes Demo as an example, we could define a domain where to record the base type of Shapes (named "domain0Base") and another one to use for the extended type ("domain0Extended") associated with the same domain ID: shapes.dat domain0 ShapeType.xml ShapeTypeExtended ShapeType Square Circle Triangle false . 0 RTIDDS_DESERIALIZEMODE_ALWAYS * * 4-39 Recording Service Integration with Extensible Types domain0 All 0 RTIDDS_DESERIALIZEMODE_ALWAYS By applying filters to the Domain Type Configuration settings, we can specify that domain "domain0Base" should record topics "Circle", "Square" and "Triangle" with the base type in the XML definitions, like this: 0 RTIDDS_DESERIALIZEMODE_ALWAYS For the moment, we have defined the type to use with each Recording Service domain, but because the default value for the TypeConsistencyEnforcementQosPolicy is ALLOW_TYPE_COERCION and both types are compatible, we would record each sample twice: once for each type version. We need to set the DataReader QoS settings in the TopicGroups we create so that they will not allow type coercion: The same way, we can associate the extended type for shapes with the extended domain: domain0Base false TestTypesLibrary.xml true 4-40 Recording Service Integration with Extensible TypesShapeType Circle Square Triangle . domain0Extended false TestTypesLibrary.xml false ShapeTypeExtended ShapeType Circle Square Triangle . We also need to associate the RecordGroup we create with both Recording Service domains: 4-41 Recording Service Integration with Extensible Types Circle,Square,Triangle * DISALLOW_TYPE_COERCION With all these settings together, Recording Service will create a different table for each type version of Shapes it finds when it discovers each of the Shapes Demo topics. For example, for topic "Square", it would create table "Square$RecordGroup$domain0Base" where it would record only the samples published with the base type version, and table "Square$RecordGroup$domain0Extended", which would contain only the samples published with the extended type version of Shapes. Note: Because of a known issue1, for the Replay tool to work properly with the databases created with the above settings (replaying different topics with their recorded version requires concurrent access to the database from different Replay database entitites), we need to enable the domain0Base domain0Extended Shapes flag in Recording Service so the index is created beforehand: 1. RTI Issue ID RECORD-318 4-42 Chapter 5 Accessing the Record Tool from a Remote Location Perhaps you want to start/stop the Record tool from another machine, or even reconfigure it to change what is being recorded. You can create a Connext DDS application that can remotely control the Record tool. This chapter explains how. To control the Record tool from a remote location: 1. Configure the Record tool to allow remote access (see Recording Service Integration with Extensible Types (Section 4.10). 2. Create a Connext DDS application using the provided rtirecord.idl file. You will use rtiddsgen to generate the basics and then add code to send your desired remote commands. 5.1 Overview If the Record tool is configured to allow remote access, it creates a DataReader for a “command request” Topic (named RTI_RECORDER_COMMAND_REQUEST_TOPIC) and a DataWriter for “command response and status” Topic (named RTI_RECORDER_COMMAND_RESPONSE_TOPIC). So the Record tool will write status updates and comman responses. These topics’ types and names are specified in the IDL file, resource/idl/rtirecord.idl. When the Record tool detects a remote DataReader and DataWriter of these special topics from the same participant, the Record tool will be in a ‘connected’ state, which means it will accept remote commands. Your remote-access application will use the following constants: ❏ RTI_RECORDER_COMMAND_TYPE Register a type of this name, as seen in Figure 5.1. ❏ RTI_RECORDER_COMMAND_REQUEST_TOPIC Create a DataWriter with this Topic name, as seen in Figure 5.2. ❏ RTI_RECORDER_COMMAND_RESPONSE_TOPIC Create a DataReader with this Topic name, as seen in Figure 5.2. See Remote Control Messages (Section 5.3) for more information. 5-1 Establishing a Connection with the Record Tool Figure 5.1 Registering the Message Type RTIRemoteCtxMsgTypeSupport_register_type (self->dds_participant, RTI_RECORDER_COMMAND_TYPE); 5.2 Establishing a Connection with the Record Tool To establish a connection with the Record tool, your remote-access application needs: ❏ 2 Topics (one for commands, one for status and command responses) ❏ 1 DataReader ❏ 1 DataWriter When creating the DataReader and DataWriter, use the following QoS settings: ❏ history.kind = DDS_KEEP_ALL_HISTORY_QOS ❏ reliability.kind = DDS_RELIABLE_RELIABILITY_QOS 5-2 Establishing a Connection with the Record Tool Figure 5.2 shows how to create the Entities in your remote-control application using the C API. (A general knowledge of Connext DDS is assumed.) Figure 5.2 Creating the Required Entities struct DDS_TopicQos tqos = DDS_TopicQos_INITIALIZER; DDS_Topic * dds_topic_cmd = NULL; DDS_Topic * dds_topic_status = NULL; struct DDS_DataWriterQos wqos = DDS_DataWriterQos_INITIALIZER; RTIRecorderAdminMessageDataWriter * dds_writer = NULL; struct DDS_DataReaderQos rqos = DDS_DataReaderQos_INITIALIZER; RTIRecorderAdminMessageDataReader * dds_reader = NULL; ... dds_topic_cmd = DDS_DomainParticipant_create_topic( dds_participant, RTI_RECORDER_COMMAND_REQUEST_TOPIC, RTI_RECORDER_COMMAND_TYPE, &tqos, NULL, DDS_STATUS_MASK_NONE); dds_topic_status = DDS_DomainParticipant_create_topic( dds_participant, RTI_RECORDER_COMMAND_RESPONSE_TOPIC, RTI_RECORDER_COMMAND_TYPE, &tqos, NULL, DDS_STATUS_MASK_NONE); ... rqos.reliability.kind = DDS_RELIABLE_RELIABILITY_QOS; rqos.history.kind = DDS_KEEP_ALL_HISTORY_QOS; dds_reader = (RTIRemoteCtxMsgDataReader*) DDS_Subscriber_create_datareader( dds_subscriber, DDS_Topic_as_topicdescription( dds_topic_status), &rqos, NONE, DDS_STATUS_MASK_NONE); wqos.reliability.kind = DDS_RELIABLE_RELIABILITY_QOS; wqos.history.kind = DDS_KEEP_ALL_HISTORY_QOS; dds_writer = (RTIRemoteCtxMsgDataWriter*) DDS_Publisher_create_datawriter( dds_publisher, dds_topic_cmd, &wqos, NULL, DDS_STATUS_MASK_NONE); 5-3 Remote Control Messages 5.3 Remote Control Messages The Record tool exchanges messages with your remote-access application by publishing and subscribing to two special remote-access topics. Both topics use the same message format, shown in Figure 5.3. Figure 5.3 Top Level Structure for Remote Control Messages struct RTIRecorderAdminMessage { long destination_mask; RTIRemoteAdminAddress destination; long msg_id; RTIRecorderAdminUnion msg; }; //@Extensibility MUTABLE_EXTENSIBILITY For complete details, see the IDL file, rtirecord.idl in the examples directory. destination_mask — A field used by other RTI tools; can be ignored. destination — The Record tool application for which the message is intended. If accept_broadcast_commands is turned off, this structure must match that of the Record tool. If accept_broadcast_commands is turned on, this structure can be a specific destination or all 0's. msg_id — A user-specified integer that identifies a particular message exchange. When the Record tool sends a response to a command, it will include the same msg_id that was received in the command. msg — A union of different message types. The discriminator must be set to one of the message types listed in Table 5.1. The code fragment in Figure 5.4 shows how to set the message type in the remote-access application. Depending on the message type, the correct union member must also be filled in. For example, Figure 5.5 shows how to construct a message to the Record tool to read a new configuration from a file. In this example, the new configuration is to be read from a file on the same file-system as the Record tool. Figure 5.4 Assigning a Message Type (C Language) RTIRecorderAdminMessage * msg = NULL; ... msg = RTIRecorderAdminMessagePlugin_create_sample(); /* Handle creation errors */ if (msg == NULL) { ... } msg->msg._d = RTI_RECORDER_ADMIN_START; 5-4 Remote Control Messages Figure 5.5 Sending a Command to the Record Tool to Read a New Configuration File RTIRecorderAdminMessage * msg = NULL; DDS_ReturnCode_t retcode; struct DDS_SampleInfo info; msg = RTIRemoteCtxMsgPlugin_create_sample(); /* Handle creation errors */ if (msg == NULL) { ... } msg->msg._d = RTI_RECORDER_ADMIN_CONFIGURE; /* This is the last part of the configuration. If the * configuration spans multiple samples, then only the last * one should have this set to TRUE */ msg->msg._u.config.final_config = DDS_BOOLEAN_TRUE; /* Tell the Record Tool that the filename to read from follows * in the config_from_string text string */ msg->msg._u.config.config_from_file = DDS_BOOLEAN_TRUE; /* Copy the name of file that the Record tool shall read from */ strncpy(msg->msg._u.config.config_from_string, filename, RTI_RECORDER_CONFIG_MAX_STRING); /* Copy the configuration name of the shapes.dat true tag to load */ strncpy(msg->msg._u.config.config_name, cfgname, RTI_RECORDER_CONFIG_MAX_STRING); /* Send the configuration message to the Record tool. * (dds_writer has been created elsewhere) */ retcode = RTIRecorderAdminMessageDataWriter_write(dds_writer, msg, &DDS_HANDLE_NIL); /* check for errors here ... */ while (no response) { retcode = RTIRecorderAdminMessageDataWriter_read_next_sample( dds_reader, msg, &info, &DDS_HANDLE_NIL); if (retcode != DDS_RETCODE_NO_DATA) { /* response received */ } sleep(1); } 5.3.1 Updating the Record Tool’s Partition QoS Policy For each Record Group in the XML configuration, Recording Service creates a DDS Subscriber. There is one Subscriber in each of the Record Group’s domains. Sometimes it may be useful to change the Partition QoS settings for some of these Subscribers. 5-5 Remote Control Messages Table 5.1 Messages Types Exchanged Between Record Tool and Remote Access Application Direction Message Type (add prefix: RTI_RECORDER_ ADMIN) Description RECORDER_START Instructs the Record tool to start recording. RECORDER_STOP Instructs the Record tool to stop recording. Instructs the Record tool to reconfigure according to the contents of the message. Stop the Record tool before sending this message: RECORDER_ CONFIGURE From: RECORDER_ Your Connext DDS SHUTDOWN Remote-Control Application RECORDER_ADD To: The Record tool RECORDER_DELETE If the Record tool has already been stopped, it will read the new configuration and restart. It will not automatically start recording unless auto_start (see Table 4.2, “General Properties”) is true (the default case). If the Record tool has not already been stopped, an error is returned. Instructs the Record tool to shutdown and exit. Instructs the Record tool to add entities based on the contents of the message. Instructs the Record tool to delete entities based on the contents of the message. RECORDER_PAUSE Instructs the Record tool to pause entities based on the contents of the message. RECORDER_ PARTITION Updates the Partition QoS in all or some of the Record tool’s Record Groups (in their associated DDS Subscribers). See Updating the Record Tool’s Partition QoS Policy (Section 5.3.1). RECORDER_RESUME Instructs the Record tool to resume recording of previously paused entities based on the contents of the message. RECORDER_PING Instructs the Record tool to send the recording model a to the Remote Control application. To: RECORDER_INFO Your Connext DDS Remote-Control Application RECORDER_ From: RESPONSE The Record tool When the Record tool publishes statistics, it periodically sends out this message type. Indicates that this message is a response to a command. a. The recording model is an XML representation of two aspects of the Record tool: (1) The configuration model: the XML configuration (similar to the XML configuration file used to configure the Record tool.) and (2) The run-time model: an XML description of the entities that have been created based on the configuration. Note that only a a minimal model is returned; the QoS are not returned. For instance, suppose the Record tool needs to record data from producers that are organized into different partitions based on their geographical distribution (different locations are represented by different Partition strings). It is possible to specify a Partition QoS policy via XML configuration when the Record tool starts up. But suppose the data producers change location—and thus change their Partition QoS? The Record tool won't be able to keep track of the data without changing its Partition QoS too. (For details on the Partition QoS Policy, see the RTI Connext DDS Core Libraries User’s Manual.) You can change the Partition QoS for any or all Record Groups by using the RTI_RECORDER_ADMIN_PARTITION message type. This command needs the following information: 5-6 Remote Control Messages ❏ A collection of partition strings to be applied. As described in the RTI Connext DDS Core Libraries User’s Manual, the partitions can be POSIX regular expressions. If no partition string is specified, the default partition (empty) is applied. ❏ A collection of Record Group names (or regular expressions matching Record Group names) for which the partitions will be applied. The partitions will be applied to all the DDS Subscribers created for the matching Record Groups. If no Record Group string is specified, the partitions are applied to all the Record Groups in the Record tool’s configuration. The partition update command is absolute, meaning that current partitions that are active for the matching Record Groups will be discarded and the new ones will be applied instead. For example, if a Record Group is already joined to partition "A", in order to have the Record Group join "A" and "B," the command will need to specify both "A" and "B" in their partition string collection. Partition updates are applied per Record Group. If a Record Group is linked with multiple DomainParticipants, the Partition QoS policy will be updated for each Subscriber created for each of the Record Group’s associated DomainParticipants. For example, consider the following configuration: ... With the above configuration, there will be two DDS DomainParticipants, "Domain0" and "Domain1." Each of these DomainParticipants will contain a Subscriber associated with the Record Group called "RecordGroup." Sending a partition update command specifying "RecordGroup" will affect the Subscribers in both DomainParticipants. If you have a situation in which different partition changes need to be specified for each Subscriber, you should specify separate Record Groups in the Record tool’s configuration. For the above example, this would mean splitting the Record Group in two, like this:... 0 ... 1 ... Domain0 Domain1 ... ... This way, partition update commands can modify separate Partition QoS settings for each Record Group. The Partition QoS Policy establishes limits on the length of the strings provided in the partition string collection. There can be up to 64 strings, with a maximum of 256 characters summed across all strings. When the Record tool receives a partition update command, it checks this limit by checking the length of all the partition strings in the command. If the summed length of the strings is larger than the limit, the partitions won't be applied and an error response will be sent back to the command issuer. Note: For DDS Subscribers to match DDS Publishers, either of the two can use regular expressions as their partition strings, but not both at the same time. A regular expression partition has to be matched against a specific name partition string. It is the user's responsibility to ensure that at least one of the sides in the communication (Publisher or Subscriber) uses a pecific name partition string as the partition. Any failure while processing the command will result in an error response from the Record tool to the command issuer. However, after validating the partition strings passed in the command, the processing is completed for all the Record Groups, even if an error happens while processing any of the QoS updates for any of them. Depending on the status of the Record tool when the partition update command is issued, the following can happen: ❏ If the Record tool is running, the command will update the current DDS Subscribers associated with matching Record Groups. The same will happen when the Record tool is idle (paused). ❏ If the Record tool is stopped, the command will update the stored QoS settings for the Record Groups. Because the DDS subscriptions haven't been created yet when Recorder is stopped, the Partition QoS settings that were updated will take effect when the Record tool is started. The newly created DDS Subscribers will use the new Partition QoS settings as received in the partition update command. Note: Partition updates are not instantaneous. Thus, the Record tool may lose samples while the partition changes take effect. This behavior is not different than that of any other Connext DDS application. 5-8 Remote Control Messages 5.3.1.1 Sending a Partition Update Command to the Record Tool The following is the IDL definition of the type used to specify the information in a Partition Update command: const long PARTITION_MAX_LENGTH = 256; const long MAX_PARTITIONS = 64; const long MAX_RECORD_GROUP_EXPRESSIONS = 256; const long RECORD_GROUP_EXPRESSION_MAX_LENGTH = 256; struct RTIRecorderPartitionMessage { sequence... 0 ... 1 5-7 Remote Control MessagesDomain0 ... ... Domain1 ... , MAX_PARTITIONS> partitions; sequence , MAX_RECORD_GROUP_EXPRESSIONS> recordGroupExpressions; }; A maximum of 64 (MAX_PARTITIONS) partition strings can be specified, with a maximum length of 256 characters (PARTITION_MAX_LENGTH). In a similar way, a maximum of 256 expressions to match Record Group names (MAX_RECORD_GROUP_EXPRESSIONS) can be specified, with a maximum length of 256 characters (RECORD_GROUP_EXPRESSION_MAX_LENGTH). The following code snippet in C shows how to prepare and send a partition update command to the Record tool so that all the Record Groups in the configuration join partition "A": RTIRemoteCtxMsgDataWriter * messageWriter = NULL; RTIRemoteCtxMsg * message = NULL; DDS_ReturnCode_t retcode; /* Initialize the DDS entities used for the communication */ ... /* Create the message instance to be written to the tool */ message = RTIRemoteCtxMsgTypeSupport_create_data(); if (message == NULL) { /* Error handling */ } /* Set the destination information for broadcast commands * (all zeroes) * Set the destination mask as empty too */ message->destination.app_id = 0; message->destination.host_id = 0; message->destination.instance_id = 0; message->destination_mask = 0; /* Set the type of the message to be a partition message */ message->msg._d = RTI_REMOTECTX_MSG_RECORDER_PARTITION; /* Set the message ID; here we set it to zero for simplicity, * but this value should be auto-incremented with every new command * sent to the tool in order to correlate the commands with their * responses */ message->msg_id = 0; /* * * if To send a partition update command for all Record Groups in a Recording configuration, set the collection of Record Group names (expressions) to be empty */ (!DDS_StringSeq_ensure_length( &message->msg._u.partitions.recordGroupExpressions, 0, 0)) { /* Error handling */ 5-9 Remote Control Messages } /* Ensure enough space to add the "A" partition string to the * collection of partitions*/ if (!DDS_StringSeq_ensure_length( &message->msg._u.partitions.partitions, 1, 1)) { /* Error handling */ } /* Copy the string ("A") into the first string in the partition * string collection. We've used 'strncpy' in conjunction with the * maximum length of a partition string for correctness, even * though we know the length of string "A" fits the maximum length * of a partition string */ strncpy(DDS_StringSeq_get(&message->msg._u.partitions.partitions, 0), "A", PARTITION_MAX_LENGTH); /* Write the message; recall that the 'accept_broadcast_commands' * must be enabled in the Record tool to be able to read this * command; if we know the destination information for the Record * tool (app id, host id and instance id), we can use this * information and don't have to enable 'accept_broadcast_commands' */ retcode = RTIRemoteCtxMsgDataWriter_write( RTIRemoteCtxMsg_writer, message,&DDS_HANDLE_NIL); if (retcode != DDS_RETCODE_OK) { /* Error handling */ } If we wanted to include a Record Group filter in our command, the filtering expression would have to be included in the collection of Record Group expressions. For example, to apply a partition update only to Record Groups ending with the suffix "Domain1," we could use the regular expression "*Domain1" and use the following code (in C language): RTIRemoteCtxMsgDataWriter * messageWriter = NULL; RTIRemoteCtxMsg * message = NULL; DDS_ReturnCode_t retcode; /* Initialize the DDS entities used for the communication */ ... /* Create the message instance to be written to the tool */ message = RTIRemoteCtxMsgTypeSupport_create_data(); if (message == NULL) { /* Error handling */ } ... /* To send a partition update command to Record Groups suffixed * with "Domain1," use the regular expression "*Domain1"; we need * to ensure enough space in the record group expressions * collection to hold one entry */ if (!DDS_StringSeq_ensure_length( &message->msg._u.partitions.recordGroupExpressions, 1, 1)) { /* Error handling */ } /* Copy the string ("*Domain1") into the first string in the * record group expression string collection. We used 'strncpy' in * conjunction with the maximum length of a record group expression * string for correctness, even though we know the length of string * "*Domain1" fits the maximum length of a record group expression 5-10 Using the Example Remote-Access Application—Record Shell * string */ strncpy(DDS_StringSeq_get( &message->msg._u.partitions.recordGroupExpressions, 0), "*Domain1", RECORD_GROUP_EXPRESSION_MAX_LENGTH); /* * * if Set the length of the partition string collection to be zero; The Record tool will set the default partition (empty) in the matching Record Groups */ (!DDS_StringSeq_ensure_length( &message->msg._u.partitions.partitions, 0, 0)) { /* Error handling */ } /* Write the message */ retcode = RTIRemoteCtxMsgDataWriter_write( RTIRemoteCtxMsg_writer, message, &DDS_HANDLE_NIL); if (retcode != DDS_RETCODE_OK) { /* Error handling */ } The example above uses an empty collection of partition strings. This means that the Record tool will apply the default partition (empty) to the Record Groups that match the regular expression "*Domain1" specified in the command. 5.4 Using the Example Remote-Access Application—Record Shell The Record Shell is a Connext DDS application that can remotely control (start, stop, and reconfigure) the Record tool. The Record Shell is not meant as a complete solution to remotely controlling the Record tool. Its purpose is just to give you an idea of what can be done. To start the Record Shell, open a command prompt1change to the /bin directory, and enter: ❏ On Linux and Mac OS X systems: rtirecsh -domain ❏ On Windows systems: rtirecsh.bat -domain Table 5.2 lists the command-line options you can use when starting the Record Shell. Once it is running, you can use the commands described in Record Shell’s Commands (Section 5.4.1). Table 5.2 Record Shell’s Command-Line Options Command-line Option Description -domain Required. Specifies the domain ID (an integer between 0 and 99). -partition Specifies an optional, comma-separated list of partition names. This option is necessary if the Record tool is configured to enable remote access in a particular partition. 1. On Windows systems: from the Start menu, select Accessories, Command Prompt. 5-11 Using the Example Remote-Access Application—Record Shell Table 5.2 Record Shell’s Command-Line Options Command-line Option 5.4.1 Description -noUdpv4 Disables the UPDv4 transport. -updv6 Enables the UDPv6 transport. -noShmem Disables the shared memory transport. -noMulticast Disables multicast. -verbosity The verbosity is a bit-map that specifies what type of logging information should be printed. The verbosity may be: 0 — No messages 1 — Exceptions (default) 2 — Warnings 4 — Information 7 — All types -help Prints version information and a list of options. Record Shell’s Commands ❏ ❏ ❏ ❏ ❏ ❏ ❏ ❏ ❏ ❏ ❏ add (Section 5.4.1.1) configure (Section 5.4.1.2) delete (Section 5.4.1.3) exit (Section 5.4.1.4) info (Section 5.4.1.5) pause (Section 5.4.1.6) resume (Section 5.4.1.7) shutdown (Section 5.4.1.8) start (Section 5.4.1.9) status (Section 5.4.1.10) stop (Section 5.4.1.11) Several of the commands accept a argument. A model is an XML representation of two aspects of the Record tool: ❏ The configuration model: the XML configuration (similar to the XML configuration file used to configure the Record tool.) ❏ The run-time model: an XML description of the entities that have been created based on the configuration. The format of this XML is the same as the configuration format for the Record tool (see Chapter 4: Configuring the Record Tool). The top-level tag must be followed by . Some examples for are: 5-12 Using the Example Remote-Access Application—Record Shell 5.4.1.1 add This command adds entities to the Record tool. The add command has the following format: add name="RTI Shapes Demo"> Square color 5.4.1.2 configure The Record tool can be reconfigured remotely with the configure command. There are two ways to reconfigure the Record tool; using a local file or a remote file. Note that the Record tool must be stopped before it can be reconfigured. When the Record tool is reconfigured, it will shut down completely. The Record Shell will lose its connection with the Record tool until the Record tool re-establishes remote access. If remote access is not enabled in the new configuration, Record Shell will not reconnect to the Record tool. The configure command has the following format: configure [-localfile | -remotefile ] The configuration name is used to find the matching tag to load. ❏ -localfile Example: Assume that you want to the Record tool to use a configuration file called myconfig.xml, which is local to the Record Shell: RTI Record Shell> stop RTI Record Shell> configure myrecord -localfile myconfig.xml The Record Shell will read the contents of myconfig.xml and send it to the Record tool, which will search for a tag . If auto_start (see Table 4.2, “General Properties”) is true (the default case), it is not necessary to run the start command to start the Record tool. If auto_start is false in the new configuration, then issue the start command in the Record Shell to start recording: RTI Record Shell> start ❏ -remotefile To configure the Record tool with the contents of a file that is local to the Record tool, use the -remotefile option. For example, assume that you want reconfigure the Record tool with a file called remotemyconfig.xml, which resides on the same file-system as the Record tool. RTI Record Shell> stop RTI Record Shell> configure myrecord -remotefile remotemyconfig.xml The Record tool will read the contents of remotemyconfig.xml and reconfigure with the contents of the tag . Depending on the configuration file, it may be necessary to start it: RTI Record Shell> start 5-13 Using the Example Remote-Access Application—Record Shell 5.4.1.3 delete This command deletes entities from the Record tool. The delete command has the following format: delete 5.4.1.4 exit This command exits the Record Shell. RTI Record Shell> exit 5.4.1.5 info This command shows you which Record tool session the Record Shell is connected to. The output looks similar to this: STATE ..: Connected to [0a0a64fe.006bbe00] GUID ...: 0a0a64fe.006bbb00 ❏ ❏ 5.4.1.6 STATE Which DomainParticipant the Record tool is connected to (HOSTID.APPID]. GUID The GUID of the Record Shell itself. pause This command pauses the recording of entities in the Record tool. The pause command has the following format: pause 5.4.1.7 resume This command resumes the recording of already paused entities in the Record tool. The resume command has the following format: resume 5.4.1.8 shutdown This command causes the Record tool to shut down and terminate. This command can only be issued when the Record tool has been stopped. 5.4.1.9 start The start command is used to start the Record tool. Note that this command only works after stopping the Record tool first, since the tool is started when it is launched. When the start command is given, the Record tool will shut down completely, delete all state and objects and start from scratch. By default, the Record tool will create a new fileset each time it is started. 5.4.1.10 status When the Record tool is configured with remote access enabled, it will periodically send its current status. The Record Shell stores the most recent status. The current status is displayed with the status command: RTI Record Shell> status The output is similar to the following: 5-14 Using the Example Remote-Access Application—Record Shell Version ..........: Timestamp ........: State ............: Config file ......: Database file ....: Received bytes ...: Saved bytes ......: ❏ ❏ ❏ The Record tool’s version Version Timestamp State 5.0.0 Mon Feb 18 20:02:48 2013 STOPPED simple_config.xml simple_config.dat_34_3 86653952 2127872 (2 %) The timestamp of the Record tool when status message was sent. The Record tool’s state. The following states are possible: • IDLE • RECORDING • STOPPED (the Record tool has been stopped and is not recording any user data) • RECONFIGURE • SHUTDOWN • DOWNLOAD (the Record tool is downloading a new configuration) ❏ ❏ ❏ ❏ 5.4.1.11 Config file The name of the file from which the Record tool read its configuration. If the configuration was received with configure -localfile, this field is not available. Database file Received bytes The file-segment currently being written to. Total amount of data that has been written to file. Total number of data that has is currently saved to file. Note that if the rollover property is true, then Saved bytes may be less than Received bytes. Saved bytes stop This command stops the Record tool from recording user data. RTI Record Shell> stop 5.4.2 Running Multiple Record Tools in the Same Domain The Record Shell can only keep track of one instance of the Record tool. To control multiple copies of the Record tool in the same domain with the Record Shell, run each Record tool instance in a separate partition. For the first instance of the Record tool, change the configuration file as follows: For the second instance of the Record tool, change the configuration file as follows: true domain0 RecordA 5-15 Using the Example Remote-Access Application—Record Shell RecordA Then you can run the Record Shell for each partition: rtirecsh -partition RecordA rtirecsh -partition RecordB 5-16 Chapter 6 Using the Replay Tool Besides replaying data with Recording Console, you can use the Replay tool directly. You may find this method useful when you want to tie its service into your own infrastructure or software, or if you need to use its more advanced features. The Replay tool replays recorded data by publishing it just like the original Connext DDS application did. You can use the original domain ID, QoS settings and data rate, or make changes to test different scenarios. See also: ❏ Chapter 7: Configuring the Replay Tool ❏ Chapter 8: Accessing the Replay Tool from a Remote Location 6.1 Recording Data for Replay The Replay tool can replay information that has been stored in either serialized or deserialized form. If Replay is to be used to replay deserialized data, ensure that all of the fields of the sample data are recorded, as Replay is unable to replay partial data. Note: SQLite is unable to look at the individual fields in the sample data of files recorded in serialized mode. 6.2 Starting the Replay Tool Open a command prompt1 and change to the true domain0 RecordB RecordB /bin directory. Then enter: ❏ On Linux and Mac OS X systems: rtireplay -cfgFile -cfgName ❏ On Windows systems: rtireplay.bat -cfgFile -cfgName Table 6.1 describes the command-line options and which ones are required. 1. On Windows systems: from the Start menu, select Accessories, Command Prompt. 6-1 Stopping the Replay Tool The Replay tool is dynamically linked against the Connext DDS libraries. You should run the tool from the /bin directory scripts—not from the executable files themselves. The scripts set all the paths and variables needed for the tool to find the shared libraries and run correctly. 6.3 Stopping the Replay Tool To stop the Replay tool, use . Table 6.1 Replay Tool’s Command-line Options Command-line Option -appName Description Specifies an application name which is used to identify the application for remote administration. Default: -cfgName -cfgFile Required. Used to identify the XML configuration file. Required. -cfgName -domainIdBase Identifies the configuration within the XML configuration file. The Replay tool will load the with the same name as this value. Adds this value to the domain IDs in the configuration file. Default: 0 -forceXmlTypes When used with XML Type Configuration, this option instructs Replay to always use type code from the XML file, even if an alternate is available from recorded data. -help Displays this information. -identifyExecution Appends the host name and process ID to the appName to help using unique names. -noAutoEnable Use this option if you plan to enable the Replay tool remotely. -remoteAdministrationDomainId Enables remote administration and sets the domain ID for the communication. Default: remote administration is not enabled. -srvName Specifies a name that will be used to identify the service. -verbosity Specifies what type of logging information should be printed. Silent Exceptions (both Connext DDS and the Replay tool) Warnings (the Replay tool only) Information (the Replay tool only) Warnings (both Connext DDS and the Replay tool) Tracing (the Replay tool only) Tracing (both Connext DDS and the Replay tool) Default: 1 -version Prints the Replay tool’s version. 6-2 Performance and Indexing 6.4 Performance and Indexing The Replay tool replays stored samples in the same order in which they were received, using SQLite indexes to retrieve the samples in sorted order. SQLite automatically builds indexes when opening an SQLite table for sorted access, and for large tables the process of building the index may take some time. To improve initialization performance, the Replay tool attempts to create and store indexes (rather than depend upon automatic indexing) for the tables that it will be replaying; this saves initialization time on subsequent replays. The Replay tool's ability to store indexes is controlled by the parameter under (see Database (Input File) Properties (Section 7.4)). The default value for is false; this allows the Replay tool to write the table indices to the database. If you change to true, the Replay tool will display a message during initialization for each table opened, stating that it was unable to store the table index. In summary, the replay performance of the Replay tool is not affected by the parameter. The Replay tool will use the fastest means of retrieving samples in either case. But setting the option to false (the default) may help improve initialization performance. 6-3 Chapter 7 Configuring the Replay Tool When you start the Replay tool, you must specify a configuration file in XML format. In that file, you can set properties that control the data source, which topics to replay, and attributes such as the replay speed. This chapter describes how to write a configuration file. 7.1 How to Load Replay’s XML Configuration File The Replay tool loads its XML configuration from multiple locations. This section presents the various approaches, listed in load order. The first three locations only contain QoS Profiles and are inherited from Connext DDS (see Chapter 15 in the RTI Connext DDS Core Libraries User's Manual). ❏ /resource/xml/NDDS_QOS_PROFILES.xml This file contains the Connext DDS default QoS values; it is loaded automatically if it exists. (First to be loaded.) ❏ File in NDDS_QOS_PROFILES The files (or XML strings) separated by semicolons referenced in this environment variable are loaded automatically. ❏ /USER_QOS_PROFILES.xml This file is loaded automatically if it exists. If the USER_QOS_PROFILES file is found and there is a default profile specified in it, this default profile is automatically applied to the QoS settings of the Recording Service entities. The next locations are specific to Replay: ❏ /resource/xml/RTI_REPLAY_SERVICE.xml This file contains the default configuration for the Replay tool; it is loaded if it exists. RTI_REPLAY_SERVICE.xml defines a configuration that replays all topics on domain 0. ❏ /USER_REPLAY_SERVICE.xml This file is loaded automatically if it exists. ❏ The file specified with the command-line option, -cfgFile (see Table 6.1 on page 6-2). You may use a combination of the above approaches. 7-1 General Format 7.2 General Format The Replay configuration file uses XML format. The main sections use the following top-level tags: Top-level Tag Reference Section General Properties for Replay (Section 7.3) Database (Input File) Properties (Section 7.4) Session Properties (Section 7.5) Replay Topic Properties (Section 7.6) Time Control Properties (Section 7.7) Remote Administration Properties (Section 7.8) Type Configuration (Section 7.9) The XML configuration file used by Replay has a simple hierarchical format. The replay_service is configured to replay data contained in one or more replay_database. Each replay_database is associated with a DomainParticipant, and must contain one or more session. Each session is associated with a Publisher, and corresponds to a unique execution thread. Each session contains one or more replay_topic, each of which is associated with a DataWriter, and contains a filter expression that specifies what information contained in the data base should be replayed. Each of the four major levels— replay_service, replay_database, session, and replay_topic—may contain a time_control element that allows control over such features as the rate of replay, how much of the available data to be replayed, and for coordination. Much of Replay’s configuration has been designed to be compatible with the Record tool, so familiarity with the Record tool’s concepts and configuration will be helpful. See Chapter 4: Configuring the Record Tool. Let’s look at a very basic configuration, just to get an idea of its contents. You will learn the meaning of each line as you read the rest of this chapter. 7.3 General Properties for Replay Table 7.1 describes optional properties that control the Replay tool’s main module. All 1 6 yes replay_database.dat_0_0 0 7-2 General Properties for Replay 2 26 * * * * properties are optional except replay_database. These properties must be specified inside and tags, where String is the name to be assigned to the service entity when it is created. This name will be used during remote administration unless it is overridden by theelement. Table 7.1 Replay Service Properties Property Syntax administration Remote Admin. Properties auto_exit DDS_Boolean Description Configures the DomainParticipant that can be used to remotely control Replay via the rtireplaysh utility. See Remote Administration Properties (Section 7.8). The Remote Administration Properties must specify a domain_id. You may also specify a name, participant_qos, publisher_qos, subscriber_qos, datareader_qos, and datawriter_qos. Controls whether or not the Replay tool should terminate when all the available data specified in the initial configuration has been replayed. Default: True 7-3 Database (Input File) Properties Table 7.1 Replay Service Properties Property Syntax replay_databasetime_control Time Control Properties 7.4 Description Required. Specifies configuration properties that describehow to replay the information from a database. This Replay Database Properties element can be repeated. See Database (Input File) Properties (Section 7.4) Specifies time configuration properties to be applied to the Replay tool as a whole. See Time Control Properties (Section 7.7). Database (Input File) Properties Table 7.2 describes the source of the data that Replay will replay. Allproperties are optional except session. These properties must be specified inside and tags, where String is the name to be assigned to the database entity when it is created. This name will be used during remote administration. Table 7.2 Replay Database Properties Properties underfilename Syntax String Description Specifies the name of the fileset that contains the data to be replayed. Do not use bothand at the same time. Default: Undefined fileset participant Specifies a fileset to be used by the Replay tool. This fileset must contain the file prefix to be searched for, the set number, and the start and end segments. Do not use both String DDS_Long DDS_Long DDS_Long and at the same time. Participant Properties See Table 7.3, “Participant Properties” Note: The fileset replay feature is not compatible with the reposition command for timestamps outside of the current segment being replayed. 7-4 Database (Input File) Properties Table 7.2 Replay Database Properties Properties underreadonly Syntax DDS_Boolean Description Specifies if Replay should open the data file in read-only mode (true), or readwrite mode (false). Setting this option to false is useful to enable indexing of older database files. Default: False See Performance and Indexing (Section 6.4). RequiredSession Properties session The configuration properties that describe how to replay the information in a session. This element can be repeated. See Table 7.4, “Session Properties” time_control type_configTime Control Properties XML Properties The time configuration properties to be applied to the replay database. See Table 7.8, “Time Control Properties” Optional XML type configuration for this replay_database. This option is useful when type codes have not been recorded in the database, or when specifying types that are too large to be recorded in the database. See Table 7.13, “XML Type Configuration Properties” Table 7.3 Participant Properties Properties underdomain_id participant_qos Syntax DDS_Long DDS_QosPolicy Description Sets the domain ID. Default: 0 Configures the DomainParticipant’s QoS policies. See the RTI Connext DDS Core Libraries User’s Manual’s chapter on Configuring QoS with XML. Defaults: See the RTI Connext DDS API Reference HTML documentation on DomainParticipants. See the Note: below for more information. Note: ❏ If you do not set theproperty in the settings, the Replay tool will automatically build a participant name and set it using the prefix "RTI Replay: ". This is for compatibility with RTI Administration Console. If this property is 7-5 Session Properties changed, the Replay tool won't override the property, but compatibility between the Replay tool and RTI Administration Console will be broken if the participant name is not prefixed with "RTI Replay: " (notice the space after the colon). 7.4.1 Enabling Monitoring Library with Replay This section only applies if you want to use RTI Monitoring Library (included in Connext DDS), which enables Connext DDS applications to provide monitoring data. The monitoring data can be visualized with RTI Monitor, a separate GUI application that can run on the same host as Monitoring Library or on a different host. Recording Service is statically linked to Monitoring Library (you do not have to install it separately). To enable monitoring in the Replay tool, use the same approach described in Enabling Monitoring Library in the Record Tool (Section 4.7.1). In the section, include the rti.monitor.library property with the value rtimonitoring. For example: 7.5 Session Properties Table 7.4 describes the Session’s properties. All 0 rti.monitor.library rtimonitoring false properties are optional except replay_topic. These properties must be specified inside and tags, where String is the name to be assigned to the session entity when it is created. This name will be used during remote administration. Table 7.4 Session Properties Properties underSyntax publisher_qos DDS_QosPolicy replay_topicReplay Topic Properties Description Configures the Publisher’s QoS policies. See the RTI Connext DDS Core Libraries User’s Manual’s chapter on Configuring QoS with XML. Defaults: See the RTI Connext DDS API Reference HTML documentation on Publishers. Required. The configuration properties that describes the topics to be replayed, and the associated DataWriter configuration. This element can be repeated. See Table 7.5, “Replay Topic Properties” 7-6 Replay Topic Properties Table 7.4 Session Properties Properties under7.6 Syntax Description thread Thread Properties Configures the properties for the execution thread. time_controlTime Control Properties Configures the time control properties to be applied to the Session. See Table 7.8, “Time Control Properties” Replay Topic Properties Table 7.5 describes the Topics’ properties. Allproperties are optional except input. These properties must be specified within and tags, where String is the name to be assigned to the replay topic entity when it is created. This name will be used during remote administration. All input properties (Table 7.6) are required, except for type_name, which is optional. All output properties (Table 7.7) are optional. Table 7.5 Replay Topic Properties Properties underSyntax input Input Properties Required. Configures the topics that are to be replayed from the database. See Table 7.6, “Input Properties”. output Configures the attributes to be used in writing the replayed topics. See Table 7.7, “Output Properties”. time_control Time Control Properties Table 7.6 Description Specifies time configuration properties to be applied to the Session. See Table 7.8, “Time Control Properties”. Input Properties Properties under Syntax Description domain_nameString Required. Specifies the name of the domain_name that was specified in the Record tool’s configuration file or a regular or wildcard expression. record_group_ nameString Required. Specifies the name of the record_group that was specified in the Record tool’s configuration file or a regular or wildcard expression. 7-7 Replay Topic Properties Table 7.6 Input Properties Properties under Table 7.7 Syntax topic_nameString Required. Specifies the name of the topic_name that was specified in the Record tool’s configuration file or a regular or wildcard expression. type_nameString Specifies the name of the type_code to be used in writing matching topics. This parameter will default to “*” if not specified. Replay will search for a matching type name only within matching topic records. Output Properties Properties under