Managing ObjectStore

osdump: Dumping Databases

The osdump utility dumps to ASCII a database or group of databases and generates the source for a loader capable of creating equivalent databases.

Syntax

osdump [options] [-emit] pathname ...
pathname ...

One or more pathnames, separated by spaces, specifying the database or databases to be dumped or (if -emit is supplied) specifying the database or databases for the loader source that is to be emitted.

Options
-emit
Tells osdump to generate the source code for a loader executable for the specified databases. To generate an ASCII dump of the specified databases, do not specify emit.

-cache cache 
(-c)
cache
Sets cache size to the specified value cache in bytes. The default is 24 MB.

-debug level 
(-d) level
Sets debugging level to the specified value level. The range is 1-6. The default is that debugging information is not displayed.

-pages pages
(-p) pages
Sets the pages fetched from databases created to the specified value pages. The default is 8.

-policy { 0 | 1 | 2 } 
(-f) { 0 | 1 | 2 }
Sets the fetch policy of databases created to page (0), stream (1), or cluster (2). The default policy is page (0).

-size size 
(-s) size
Sets the address space size to the specified value size in bytes. The default is OS_AS_SIZE.

-table tablefile 
(-tab) tablefile
Specifies the name of the generated database table file when run without the -emit option. The default is db_table.dmp.

-threshold threshold
(-t) threshold
Sets the address space usage threshold to the specified percentage value threshold. The range is 0.00-1.00. The default is 0.50.

Description

Each execution of osdump does one of the following:

For each database or group of databases you want to dump, execute osdump twice:

The dumped ASCII files in the first pass have a compact, human-readable format. These ASCII files are used as input to the loader.

The schema for the dumped databases is stored in a remote schema database associated with the dump.

See also osload: Loading Databases.

Default compared to customized dump and load

You can use the default dump and load processes or customize the dump and load of particular types of objects. Customization is appropriate for certain location-dependent structures, such as hash tables. Databases with unions, pointers-to-members, or address-dependent data of types that are not C++ pointers or ObjectStore references or soft pointers cannot be dumped by this utility and need customized dump and load applications.

To determine when to customize, see When Is Customization Required?. To learn how to customize, see Chapter 7, Dump/Load Facility, in the Advanced C++ API User Guide.

Generated ASCII files

When invoked without -emit, osdump generates the following files in the current directory:

See Default Dumper ASCII Format for a description of the layout of the generated ASCII file.

Generated source and makefiles

If osdump is invoked with -emit, it produces the following files in the current directory:

If files with these names exist in the working directory, osdump overwrites them, except for the makefile and the file ldrhdr.h.

To build the loader from these files, use the makefile produced by osdump. On UNIX, use the make utility and makefile.unx. On Windows, use nmake and makefile.w32.

Considerations

When planning how to dump and load a database, the following points might influence your plans:

Default Equivalence

This section defines equivalence for databases dumped and loaded by the default dump and load processes.

In general, two databases are equivalent if every object in one database has a corresponding, equivalent object in the other database. Two objects are equivalent if

More precisely, two databases, db1 and db2, are equivalent if and only if there is a one-to-one mapping, map(), between objects in db1 and objects in db2 such that for every object, o1, in db1, o1 is equivalent to map(o1).

Two objects, o1 and o2, are equivalent (according to map()) if and only if all the following are true:

When Is Customization Required?

In most cases, customization is not required. If you have a database with objects whose structure depends on the locations of other objects, you might have to customize the dumping and loading of those objects.

A dumped object and its equivalent loaded object do not necessarily have the same location, that is, the same offsets in their segment. Among the implications of this are the following:

The default dumper and loader take into account the first implication, and the loader adjusts all pointers automatically in loaded databases to use the new locations.

The default dumper and loader also take into account the second implication for ObjectStore types including collections with hash-table representations. Because a dumped collection element hashes to a different value than the corresponding loaded element does, their hash-table slots are different. The facility, then, does not simply dump and load the array of slots based on fundamental values (which would result in using the same slot for the dumped and loaded objects).

Instead, it dumps the collection in terms of sequences of high-level API operations (that is, string representations of create and insert arguments) that the loader can use to recreate the collection with the appropriate membership.

The default dumper and loader do not take into account the second implication for non-ObjectStore classes. If you have your own classes that use hash-table representations, you must customize their dumping and loading. Any other location-dependent details of data structures (such as encoded offsets) also should be dealt with through customization.

See Chapter 7, Dump/Load Facility, in the Advanced C++ API User Guide.

Performance

To enhance efficiency during a dump, database traversal is performed in address order whenever possible. To enhance efficiency during loads, loaders are generated by the dumper and tailored to the schema involved. This allows the elimination of most run-time schema lookups during the load.

Converting a Database

This section describes how to use osdump and osload to update an ObjectStore database with a Release 5.1 format to one with a Release 6.0 format. Briefly, the steps are as follows.

  1. Dump the databases using the Release 5.1 version of osdump to create the database table file and the ASCII representations of the databases.

Use osdump without the -emit option. This will produce the
db_table.dmp and filename.dmp files.

  1. Generate a Release 6.0 schema that corresponds to the schema of the Release 5.1 database.

You will need the C++ header files and the schema file (schema.cc in the example, below) marking all persistent types that were used to create the original database. You need to change or remove any types that are not supported in Release 6.0. On Windows, generate the schema as follows:

      ossg -asof schema.obj -asdb schema.adb /nologo /GX /MD \
/DWIN32 schema.cc
On UNIX, generate the schema as follows:

      ossg -assf dschema.cc -asdb schema.adb \
-I$OS_ROOTDIR/include schema.cc
  1. Use the header and schema files to build a Release 6.0 application that simply creates an empty Release 6.0 database. The source code for a simple application to do this is
    $OS_ROOTDIR/etc/dummy.cc. Copy this to the working directory and compile. On Windows:


      cl /Fedummy.exe /nologo /GX /MD /DWIN32 dummy.cc \
schema.obj %OS_ROOTDIR\lib\ostore.lib
On UNIX:

      CC -o dummy dummy.cc dschema.cc -los -loscol -losthr
  1. Run the application to create the empty database:

      dummy my_db.db
  1. Generate the loader source files from the empty database using the Release 6.0 version of osdump.

Use osdump with the -emit option. This produces the loader files described on page 163.

      osdump -emit my_db.db
  1. Build an osload executable from the loader source files. On Windows, use nmake and makefile.w32. On UNIX, use the make utility and makefile.unx.

  2. Generate the Release 6.0 format database by running osload and specifying the database table file and the ASCII database representations you dumped in step 1.

      osload db_table.dmp filename.dmp
See osload: Loading Databases for more information on osload.

Default Dumper ASCII Format

Each db_table.dmp file has the format for database_table described in the following section.

For each dumped database, filename.db, filename.dmp has the format shown for database, in the following information:

database_table ::= 
      databases [ number_databases ] 
            { database_entry [ database_entry ]* } 
number_databases ::= 
      the integer number of dumped databases 
database_entry ::= 
      < 
            pathname 
            database_size 
            number_segments 
            odi_release 
            architecture (date) 
      > 
database ::= 
      database [database_index] pathname segments roots finalization
fixups
pathname ::= the pathname of the database being dumped database_size ::= the size of the database in an integral number of bytes number_segments ::= the integral number of segments contained in the database odi_release ::= the ObjectStore release information architecture ::= the host architecture set for the database date ::= the date the database was last modified database_index ::= the index of this database within the list of databases being dumped (0-based) roots ::= roots [ number_roots ] { root [ , root ]* } root ::= name ( Type ) id segments ::= segments [ segment ]* segment ::= segment segment_number [segment_size] (pathname) data segment_number ::= integral segment number of this segment within its database data ::= ( objects )* cluster ::= cluster [cluster_size] { objects } objects ::= object* object ::= id ( type ) value id ::= <database_index,segment_number,cluster_number,offset> offset ::= integral value denoting the byte offset of an object within its segment type ::= integral | real | pointer | reference | array | class value ::= character | integral | floating_point | pointer_value | reference | collection | string | array_elements | class_members integral ::= char | signed char | unsigned char | signed short | unsigned short | int | unsigned int | signed long | unsigned long real ::= float | double pointer ::= type* reference ::= type& array ::= array type [ size ] class ::= ( class | struct | union ) name character ::= ' c' where c is any printable ascii character or escaped hex value integral ::= any non-floating-point decimal number floating_point ::= any floating-point decimal number pointer_value ::= id string ::= "s" where s is any sequence of printable ascii characters or
escaped hex value with '"' escaped as "\"" and '\' escaped as "\\".
array_elements ::= { value [ , value ]* } class_members ::= { value [ , value ]* }
Each object is emitted as a single line of text.

The special storage types cluster, segment, and database denote underlying ObjectStore storage structures. When a storage type appears, each object following is contained within that storage structure.

Other types denote C++ type constructs. Values appear as single values or as a bracketed comma-separated list of values. Base class instances and other embedded subobjects are flattened into a class_members list.

ObjectStore references or soft pointers, collections, cursors, indexes, and queries are instances of Object Store types that require special treatment. The following special dump formats are used for them:

reference ::= 
      id
collection ::=       
      simple_collection | dummy_cursor | cursor | cursor_with_index | 
                  cursor_with_range | collection_index | 
                        collection_element_load | collection_query 
simple_collection::= 
      [ behavior cardinality collection_type representation_enum ] 
behavior::= 
      integral 
cardinality::= 
      integral 
collection_type::= 
      string 
representation_enum::= 
      integral 
dummy_cursor::= 
      [ D ]
cursor::= 
      [ C options ]
collection_reference::= 
      reference 
safe_flag::= 
      integral 
cursor_with_index::= 
      [  C options
            { I path_name_length path_name element_name_length 
                  element_name } ]
path_name_length::= 
      integral 
path_name ::= 
      string 
element_name_length::= 
      integral 
element_name::= 
      string 
cursor_with_range::= 
      [  C collection_reference safe_flag 
            { R range_type key_type low_condition low_value H 
                  high_condition high_value } ]
range_type::= 
      integral 
key_type::= 
      integral 
low_condition::= 
      boolean 
low_value::= 
      integral 
high_condition::= 
      boolean 
high_value::= 
      integral 
boolean::= 
      0 | 1
collection_index::=  
      [ [{ path_name_length path_name element_type_length 
            element_type_name }]* ]
collection_element_load::= 
      [ [element_reference]* ]
element_reference::= 
      reference 
element_type_length::= 
      integral 
element_type_name::= 
      string 
collection_query::= 
      [ element_type_length element_type  < query_string_length 
            query_string > < file_name_length file_name > 
                  < line_number > ]
query_string_length::= 
      integral 
query_string::= 
      string 
file_name_length::=
      integral 
file_name::= 
      string 
line_number::= 
      integral 


[previous] [next]

Copyright © 1999 Object Design, Inc. All rights reserved.

Updated: 03/11/99 11:19:07