Managing ObjectStore

Chapter 1

Overview of Managing ObjectStore

This chapter briefly describes the architecture of ObjectStore and provides an overview of management tasks. For an introduction to object-oriented database management, including concepts such as persistence, see the first several chapters of the C++ API User Guide.

The following topics are discussed in this chapter:

What Is ObjectStore?

ObjectStore is an object-oriented database management system. It allows you to

What Is an ObjectStore Database?

An ObjectStore database is a storage location for persistent objects. It is organized into clusters and segments.

Clusters

The basic unit of allocation in an ObjectStore database is the cluster. When you create a persistent object, the storage is allocated from a cluster.

Clusters can be normal or huge. If an allocation is less than or equal to 64 KB, it is stored in a normal cluster, which can contain any number of normal allocations, up to a maximum size of 2 GB. If an allocation is greater than 64 KB, ObjectStore creates a huge cluster containing just that one allocation.

Segments

Clusters are organized into segments. When you create a database, ObjectStore normally creates two segments:

You can create additional segments using the
os_database::create_segment() method, and specify any of these for allocation instead of the default segment.

The default segment and any additional segments always have a default cluster. ObjectStore normally allocates storage from this cluster. You can create additional clusters using the
os_database::create_cluster() method.

What Kinds of Databases Are There?

You can use ObjectStore to store objects in two kinds of databases, file databases and rawfs databases. See Managing the Rawfs for a discussion of the relative merits of file and rawfs databases.

File Databases

A file database is a native operating system file that contains an ObjectStore database. You can, with some restrictions, manipulate file databases with standard operating system commands as well as with ObjectStore utilities described in this book. A file database has a standard operating system pathname.

Rawfs Databases

A rawfs database is a database that you store in an ObjectStore rawfs. A rawfs (raw file system) is a private file system managed by the ObjectStore Server. It is independent of the file system managed by the operating system.

A rawfs can contain directories, subdirectories, and databases, just as the native file system can. It can include links, but each link must be to another ObjectStore rawfs. The ObjectStore Server manages everything in the rawfs. Everything in the rawfs is invisible to the operating system. ObjectStore provides utilities and os_dbutil class methods for operating on databases and directories in a rawfs. An ObjectStore Server can manage one rawfs, which consists of one or more Server partitions.

Rawfs partitions

On UNIX platforms you specify each partition in the rawfs with a Partitionn statement in the Server parameter file. On Windows platforms you specify partitions using the ObjectStore setup.exe utility. Each partition can be either

On Solaris, a raw partition can be greater than 2 GB. On Windows, a raw partition can be larger than 4 GB.

A rawfs database can span partitions. This allows you to create a database that is larger than any single disk.

When you create a rawfs database, you specify a pathname. The Server determines where in the rawfs to store your database. Thus, the logical directory structure might not map directly to the physical placement of the databases in the partitions. For example, two rawfs databases in different ObjectStore directories might be stored in the same partition.

Rawfs database
name format

ObjectStore recognizes a rawfs database by the following format:

hostname::/database_pathname 
A double colon separates the host name from the database pathname. The name of a rawfs database always starts at root; it is never relative to a working directory. Slashes always separate the levels of a rawfs database name, regardless of the platform. Case is significant. For example, the following two pathnames identify different databases:

hostess::/accounts/payable/JUNE
hostess::/accounts/payable/june
You can create a rawfs during ObjectStore installation or at any time after installation. SeeChapter 7, Managing ObjectStore on UNIX, or Chapter 8, Managing ObjectStore on Windows, for more information about how to create a rawfs.

How Do Objects Get into a Database?

When an application allocates an object in persistent storage, it specifies the database to contain that storage. The member functions create, lookup, and open of the os_database class are responsible for creating databases. You name the database in a pathname argument to the function that creates the database.

See the C++ API Reference for information about these functions.

How ObjectStore Controls Storage

The Server is the ObjectStore process that primarily controls object storage. With help from the client process and the Cache Manager process, the Server can manage databases for multiple client applications. These applications can be on one or multiple hosts.

What Does the Server Do?

The ObjectStore Server is a process that controls access to ObjectStore databases on a host. This includes

The Server also manages pages of data on behalf of clients running applications.

Rawfs management

For the rawfs, if there is one on the host, the Server manages the hierarchy of directories and maintains permission modes, creation dates, owners, and groups for each entry.

Typically, a Server must be running before any ObjectStore application can access databases on the host. (A locator file allows access to databases residing on a host that is not running a Server. See Chapter 5, Using Locator Files to Set Up Server-Remote Databases, for further information.)

An application can use databases that are stored on different hosts and managed by different Servers. A Server can serve clients on any number of hosts.

Multiple Servers on a host

A host can run one Server of a given ObjectStore release. You can run two ObjectStore Servers on the same host if they are different versions of ObjectStore. For example, you can run a Release 6 and Release 5 Server on the same host. Start them on different ports and use the ports file to let clients know the one to contact. See Modifying Network Port Settings for details.

A network can have a number of Servers.

What Does the Client Application Do?

ObjectStore links the client library into each ObjectStore application. In this way, each ObjectStore application is an ObjectStore client that

Any number of clients can run on a particular host. These clients can contact

Client cache

Each client has its own storage area, called the client cache or simply the cache. The cache is a local holding area for data mapped or waiting to be mapped into physical memory. Data is not shared by clients even when running on the same host.

To change the default size of the client cache, use the OS_CACHE_SIZE environment variable. See OS_CACHE_SIZE.

When a client application needs an object stored in a database it dereferences a pointer (or object reference in Java). If the page that holds the object is already in physical memory or if the page is in the cache with the appropriate permission, access is immediate.

If the page that holds the object is not in physical memory, is not in the cache, or is in the cache but with inappropriate permission, the application takes a page fault. This causes the client to request the page from the Server, put it in the cache, and resume executing the program.

UNIX

By default, ObjectStore places the cache file in the /tmp/ostore directory. To change the default, specify an alternate directory for the OS_CACHE_DIR environment variable, or set the Cache Directory parameter in $OS_ROOTDIR/etc/host_cache_manager_parameters.

Windows

The operating system determines the location of the cache in virtual memory. You cannot change the location. The cache is not a file; it is a region of virtual memory. The necessary storage is obtained from system virtual memory, which consists of physical memory plus swap file space.

What Does the Cache Manager Do?

The primary function of the Cache Manager is to facilitate concurrent access to data by handling callback messages from the Server to client applications. Note that the Cache Manager never reads the cache itself. The Cache Manager coordinates access by clients to cached data.

A Cache Manager starts automatically when an ObjectStore application starts, if a Cache Manager is not already running on the host. Each host that runs an ObjectStore application must have one Cache Manager. A single Cache Manager can handle callback messages for any number of client applications running on that host.

If you are running clients from two different major releases of ObjectStore, there are two Cache Managers - one for each release. Unlike running different Servers on one host, you need not configure ports.

The name of the Cache Manager executable is oscmgr6.

On UNIX, the oscminit6 executable starts oscmgr6. Typically, you never need to invoke oscminit6.

Callbacks

When a client requests permission to read a page and no other client has permission to modify that page, the Server grants read permission (read ownership). The Cache Manager is not involved.

The Cache Manager is involved in the following situations:

In these situations, the clients with permission are blocking the requesting client from obtaining permission, so the Server sends a callback message to the Cache Manager on the host of the client that has the permission.

The Server cannot send callback messages directly to the client because the client might not be listening; the client might be busy running the application. The Cache Manager determines whether the read or write permission can be released or whether the client requesting permission must wait.

If you are running an ObjectStore application that uses a database that nobody else is using, there are no callback messages for that database.

For information about ownership and locks, see Callback Messages Background.

Commseg

The commseg (communications segment) is a shared-memory object where the client and the Cache Manager maintain information about permissions on pages and whether the client is actually using the page. Each client has its own commseg. For every page in the cache, there is a corresponding item in the commseg.

UNIX

By default, ObjectStore places the commseg file in the /tmp/ostore directory. You can specify an alternative directory by setting the OS_COMMSEG_DIR environment variable. Another way to change the default is to set the Commseg Directory parameter in the $OS_ROOTDIR/etc/host_cache_manager_parameters file.

Windows

The operating system determines the location of the commseg in shared memory. The commseg is not a file; it is a region of virtual memory. The illustration that follows shows one possible configuration of ObjectStore processes.

Managing Processes

ObjectStore includes three main processes that communicate with each other to manage your data:

In general, the actions you perform on ObjectStore processes are

Communication Among ObjectStore Processes

The following table summarizes the communication among the Server, client, and Cache Manager processes.
Server

Responds to client requests for pages

Sends callback messages to Cache Manager to request locks held by a client

Client

Requests the Server to fetch data from a database

Requests the Server to store data in a database

Receives locks and pages from Server

Cache Manager

Receives callback requests from Server

Creates client cache and commseg files

ObjectStore uses network connections to communicate among Server, client, and Cache Manager processes. The kind of network connection used depends on your platform. Typically, you need not modify network connections. However, if you do need to make changes, see Modifying Network Port Settings.

Starting ObjectStore Processes

Server

The chapter supporting your platform provides instructions for starting the Server on your platform. Typically, the installation procedure arranges for the Server to be started automatically when the system is booted.

When you start a Server, the Server checks for values of Server parameters you might have changed from the default and uses the modified values. If you have not modified any Server parameters, ObjectStore uses the default parameters.

The Server then makes its service available. A client can use the network connection available on its platform to connect to the Server. ObjectStore uses default network connections. To modify these connections, see Modifying Network Port Settings.

There are many Server parameters you can set to determine the behavior of the Server. Chapter 2, Server Parameters, describes each parameter. When you modify a parameter, you must shut down and restart the Server for the parameter to take effect.

Client

When a client application starts, it tries to connect to the Cache Manager on that machine. If a Cache Manager is not running, ObjectStore starts one.

Cache Manager

The Cache Manager starts automatically if one is not already running when a client application starts.

Windows NT

On Windows NT, the Server and Cache Manager typically run as NT Services. You can use the Services applet in the Control Panel to start and stop the Server and Cache Manager and to determine whether they start automatically when you boot the system.

Stopping ObjectStore Processes

Server

You need to shut down the Server

Use the following steps to shut down the Server:

  1. Use the ossvrstat utility to determine whether clients are using the Server.

    Along with other information, this utility displays client names, if they have been set. To identify clients easily, encourage developers to use the objectstore class, set_client_name method. See ossvrstat: Displaying Server and Client Information.

  2. Notify clients to end their connections with the Server.

  3. Use the ossvrclntkill utility to end the Server's connection with any dangling clients.

    Dangling clients are clients still attached to the Server, even though they no longer exist. This can happen when a client is halted abnormally rather than being stopped in the usual manner. See ossvrclntkill: Disconnecting a Client Thread on a Server.

  4. Use the ossvrshtd utility to shut down the Server. See ossvrshtd: Shutting Down the Server.

To restart the Server, see the instructions in the chapter supporting your platform.

Client

Shutdown of a client is the responsibility of the application.

If necessary, you can use the ossvrclntkill utility to sever the connection between a client and the Server. This disconnects the client. See ossvrclntkill: Disconnecting a Client Thread on a Server for details.

Cache Manager

Before you shut down the Cache Manager, notify clients that you are shutting it down, then use the oscmstat utility to confirm that there are no active clients. See oscmstat: Displaying Cache Manager Status. Use the oscmshtd utility to shut down the Cache Manager. See oscmshtd: Shutting Down the Cache Manager for details. The next client process that starts automatically starts the Cache Manager.

Obtaining Process Status Information

When an ObjectStore daemon process sends output to stdout or stderr, ObjectStore routes the output to a corresponding file. These files have different names on different platforms. See Finding Files Containing ObjectStore Messages in Chapter 7 or Finding Files Containing ObjectStore Messages in Chapter 8.

ObjectStore daemons seldom send messages to these files except under certain unusual error conditions. In these cases, this information can be helpful in understanding and resolving an error. When you report to Object Design a problem that might involve one of these daemons, find such a file if it exists and provide the contents.

Status commands

The ossvrstat utility displays information from a Server. For example:

This utility provides these meters and many more for several periods of time, such as the last hour and the last minute. See ossvrstat: Displaying Server and Client Information.

Use the oscmstat utility to obtain information about the Cache Manager, client cache files, and commseg files. See oscmstat: Displaying Cache Manager Status.

Debugging Cache Manager

Use the following command line to start the Cache Manager in debug mode:

oscmgr6 0 debug-level 
For debug-level, specify an integer from 0 through 50. The higher the number, the more information ObjectStore displays about Cache Manager activity.

Pinging

If you are having problems with a Server, the first thing to do is run ossvrping to see if the Server is running. See ossvrping: Determining Whether a Server Is Running.

Monitoring the Server

You can run the Server in debug mode to obtain information about exactly what is happening. ObjectStore displays messages about process communication that show where the problems are, if there are any.

To run the Server in debug mode, you must shut down and restart the Server with the debug option. See Chapter 7, Managing ObjectStore on UNIX, or Chapter 8, Managing ObjectStore on Windows, for specific details for your platform. When you no longer need the debug output, shut down the Server and restart it without the debug option.

Debug mode slows down the Server but does not affect clients. Use debug mode only when you are experiencing a problem.

If you want to turn debug mode on without shutting down the Server, you can use the ossvrdebug command to set the debug trace level for the Server. To enable server debugging, type ossvrdebug -d debug-level where debug-level is an integer from 0 to 9. To disable server debugging, type ossvrdebug -d 0. See ossvrdebug: Setting a Server Debug Trace Level for more information.

Description of the Server Transaction Log

Each Server keeps a transaction log, also called a log file. The most important function of the transaction log is to prevent database corruption in case of failure. The log contains modified pages of data and the records about modified pages of data.

Log file

The log file stores database modifications until they are propagated to the database. The log does not have a fixed size. It can grow to contain as much data as is written to it. You can use the ossvrstat utility to obtain the size of the log. This is described more fully in ossvrstat: Displaying Server and Client Information.

Location

By default, the Server places its log file in the rawfs. Server performance is always better when the log is in the rawfs rather than in a native file system. If there is no rawfs, you must use the Log File Server parameter to specify a pathname for the transaction log. When you use the Log File Server parameter, you cannot place the log file in a raw partition. See Log File.

When the log is in the rawfs, it is not visible to you. Its size is limited by the size of the rawfs. The log can span partitions.

When the log is in the native file system, its size is limited by the file partition size. You should place the log file where it can never be deleted by users accidentally. Deleting the log file can cause database corruption.

Transactions, commits, and the log

When a transaction modifies databases, either all or none of the modifications are made, depending on whether ObjectStore commits or aborts the transaction. This is true even if the Server machine crashes during the transaction.

If your transaction aborts, the log entries are discarded. When your transaction commits, your program waits until the log information is safely on disk.

Propagation

The Server moves committed data from the log to databases through propagation. The information accumulated in the log is propagated from the log to the material (that is, real) database transparently in a way that does not interfere with client performance. After propagation, the space in the log that was occupied by propagated data becomes available for new entries in the log.

Sector

A sector is a 512-byte disk block (two sectors equal one kilobyte). When you run the ossvrstat utility, ObjectStore displays many statistics in number of sectors.

Log File Size

When the Server recognizes that it needs a bigger transaction log, it increases the size of the log segments according to the Log Data Segment Growth Increment and Log Record Segment Growth Increment Server parameters. See Log Data Segment Growth Increment for details.

When you run the ossvrstat utility, Current log size, in the list of Server parameters, displays the current size of the log. Usually, the log grows to a size that accommodates your application and then stops growing. There usually is no reason to monitor log size or to worry about its allocation. However, if an unusual event causes the log to grow too large, there are ways to make it smaller.

If there is nothing in the log when you start the Server, the Server resets the size of the log data segment and log record segments to the sizes set by the Log Data Segment Initial Size and Log Record Segment Initial Size Server parameters. For log files in the rawfs, this means the space is free for other databases. For log files in the native file system, this reallocates internal log file space; the log file size does not change.

Shrinking the
log file

To move or shrink the log, follow these steps:

  1. Set the Log Data Segment Initial Size and Log Record Segment Initial Size Server parameters to the values you want. If necessary, ensure that the correct value is specified for the Log File Server parameter.

  2. Ensure that no clients are using the Server.

  3. Run ossvrshtd to shut down the Server.

    The Server clears the log before it actually shuts down.

  4. If you are reallocating a log in the rawfs, skip to step 5. If you are reallocating a log in the native file system, run the Server executable with the -ReallocateLog option.

    This does not actually start the Server; it only reallocates the log. Enter

          osserver -ReallocateLog 
    
  5. Restart the Server. See the chapter discussing your operating system for details.

Another way to shrink the size of the log file is to reinitialize the Server. See Starting the Server on page 299 in Chapter 7 or page 325 in Chapter 8 for more information about starting the Server.

Warning

Never use -ReallocateLog if the Server is in an inconsistent state. Doing so can cause database corruption. Call ObjectStore Technical Support for assistance.

Managing Computer Resources

The computer resources you must manage are your CPUs, memory, disk space, and network.

CPUs

Consider the speed of your CPUs. You can run computation-intensive applications on your fastest machines, or you can distribute intensive applications evenly among network hosts. You can also combine these approaches.

Memory

ObjectStore uses several kinds of memory. Managing Memory is devoted to effective memory management.

Disk space
and network

Network communications and disk input and output often are the most constraining elements of your installation. Configure your system to minimize network and disk activities. Ensure that applications are designed to minimize this activity. Also, you probably want most of your disks, especially your fastest disks, on the Server.

It is impossible to predict the amount of disk space you need for a client application because it is dependent on the application. However, following are some ways that an ObjectStore application uses disk space:

The following table shows how heavily ObjectStore uses resources:
ProcessCPU UseDisk UseNetwork UseMemory Use
Server

Not intensive.

Intensive.

Intensive.

Not intensive. Uses a little to communicate with client.

Client

Can be intensive; depends on application.

ObjectStore does not use local disk. Application might.

Can be intensive.

Can be highly intensive. Lots of mapping of data in virtual memory.

Cache Manager

Not intensive.

Not intensive.

Not intensive. Sends and receives short messages.

Not intensive.

Managing Memory

To manage the memory that an ObjectStore application uses, you need to understand the concept of address space.

What Is Address Space?

ObjectStore transfers an application's data to virtual memory. Data stored in virtual memory can, at any particular time, reside in

An application's virtual memory contains both

Address space is a range of virtual memory addresses. For most 32-bit computers, the address space is slightly less than 232 bytes. (The platform's virtual memory system might reserve or might not implement a portion of the 232 range.) For 64-bit computers, the address space is substantially larger.

Each client process has its own address space. Address space is distinct from virtual memory in that

What Are the Pieces of Address Space? How Are They Shared?

A client's address space includes two kinds of addresses: persistent and transient. The data itself can be in one of three locations in physical memory or backing store. These are described in detail in this section.

Kinds of addresses

Address space includes

Just as each client has its own address space, each client has its own persistent address space, called the persistent storage region or PSR. Two environment variables control the size and address range of the PSR. OS_AS_SIZE and OS_AS_START have different default values on different platforms. For example, the PSR on a SPARCstation 10 running Solaris 2 typically is 400 MB. See OS_AS_SIZE and OS_AS_START for specific details.

Each client also has its own transient address space. This space includes all addresses not part of the PSR.

Locations for data

An application's data is stored in virtual memory. This means that data is in one of the following:

Physical memory is shared by all applications running on that machine. A typical amount of physical memory for a machine is 32 to 256 MB.

When a page of data needs to be brought into physical memory, the operating system often needs to make room by removing another page. When the operating system removes a page from physical memory, it places the page on disk in the appropriate backing store.

If the page contains persistent data, the operating system pages it to the client cache. Each client has its own cache.

If the page contains transient data, the operating system pages it to swap space. Swap space is a disk file or disk partition that is shared by all applications running on the host.

Virtual memory

Remember that data in an application's address space is always in virtual memory. It does not matter whether the data has a persistent address or a transient address. It also does not matter whether the data is in physical memory or backing store.

Illustration of Address Space

The following figure shows address space. The persistent storage region is near the middle of the address space. The stack allocates transient data starting at one end of the range of addresses. The heap allocates transient data starting at the other end of the range of addresses. The stack and the heap can allocate space until they reach the persistent storage region.

What Is the Relationship Between a Transaction and Address Space?

Address space limits the amount of data you can touch within a single top-level transaction. Address space must be reserved to correctly relocate data into virtual memory. Space is reserved as each page is used in the transaction, and the amount of space is the minimum required to relocate the page correctly into virtual memory.

Normally, after a top-level transaction commit or abort, the assignments of persistent space are made available for reuse.

However, if the application is using retain_persistent_addresses(), ObjectStore does not release persistent address space until the program calls release_persistent_addresses().

Transaction commit

If a transaction commits, the client

Transaction abort

If a transaction aborts, the client

Guidelines

An application can limit the amount of address space it uses by

What Happens When Resources Are Exhausted?

Address resources are large and it is unusual to exhaust them. However, lack of a particular resource might affect the application.

Persistent address space

If persistent address space is needed but is not available, ObjectStore raises an exception. This can happen when a transaction tries to assign to the persistent storage region more data than the PSR can accommodate.

Physical memory

When physical memory is needed but is not available, the operating system swaps pages to backing store. The application continues to run, but program execution is slower if a great deal of swapping occurs.

Client cache

When space in the client cache is needed but is not available, ObjectStore attempts to migrate modified pages from the client cache back to the Server that supplied the data. This can impair performance.

Swap space

If swap space is needed but is not available, the operating system does one or both of the following:

Often a process is aborted when it tries to allocate more memory; the allocation function returns 0. If an ObjectStore allocation fails in this way, err_insufficient_virtural_memory is signaled.

How Can You Control These Resources?

Persistent address space

Increasing the size of the persistent storage region makes more address space available for a client's persistent data. This allows a transaction to assign more persistent data, which in turn might change a transaction that aborts to a transaction that commits.

The environment variables OS_AS_START and OS_AS_SIZE control the amount of persistent address space. Each application can use the default values or specify its own settings. See OS_AS_SIZE.

Physical memory

You can add physical memory to the machine to lower the reliance on backing store. This increases the performance of all applications (ObjectStore as well as non-ObjectStore) because swapping pages out of physical memory happens less often. Operating systems include tools that help you determine when an application is paging, for example, time and top in UNIX or Performance Monitor in Windows.

Client cache

Increasing the size of the cache can improve performance because it decreases the need to send pages containing persistent data back to the Server. You can control the size of the client cache with the OS_CACHE_SIZE environment variable. See OS_CACHE_SIZE.

Swap space

Adding more swap space allows you to run more or larger applications. You can add swap space by following operating system-specific procedures. Some operating systems require a system reboot to accomplish this, while others allow swap space to be added while the machine is running. Your operating system includes a tool for determining the amount of swap space available, for example, pstat -s in UNIX or Control Panel | System in Windows.

Increasing the size of the client cache or adding swap space provides more potential virtual memory for the client's data.

How Much Memory Is Needed?

The amount of memory your application needs depends entirely on the application. Work with the application developers to understand the application's data structures and data access patterns. Start by using the default settings for the variables that control address space. Use test runs of the application to refine memory allocation.

Difference Between Assigning and Mapping an Address

When considering the way a client uses address space, it is important to understand the difference between assigning and mapping an address.

When ObjectStore assigns an address to a page, it has determined where to put the page if the client needs it. The data on the page is not available to the client. Assigning an address reserves the address so that it cannot be assigned to another page. ObjectStore assigns address space in units of 64 KB, regardless of the page size on the platform. Assigning an address consumes address space but not physical memory or swap space.

When ObjectStore maps a page to an address, it means that the page is available to the client. The client can now use the data on that page. Mapping occurs one page at a time and consumes virtual memory (physical memory and, perhaps, swap space).

Summary of the Kinds of Memory an ObjectStore Application Uses

An ObjectStore application uses three kinds of memory:

Persistent memory is not a limitation on the amount of persistent data an application can have. It is just the place in which the ObjectStore client manipulates persistent data for a transaction. Persistent memory is a subset of virtual memory.

Managing the Rawfs

This section presents general information on managing a rawfs in an ObjectStore environment. See Chapter 7, Managing ObjectStore on UNIX, or Chapter 8, Managing ObjectStore on Windows, for more platform-specific information on creating a rawfs.

Advantages

The advantages of a rawfs are that it

Security

A rawfs can provide greater security because the

Disadvantages

The disadvantages of a rawfs are that it

Utilities for Managing the Rawfs

ObjectStore provides the following utilities for managing the rawfs. You can use many other utilities on the rawfs and on rawfs databases, but these are exclusively for operating on the rawfs.

Notes for Working with Rawfs Databases

Wildcards

ObjectStore utilities that operate on rawfs directories and databases can perform wildcard processing. The wildcards you can use are described below. For example, to list all databases in the sax directory that start with charlie, you enter the following on Server oscar:

osls oscar::/sax/charlie*
WildcardDescription
*

Matches any string, including a null string.

?

Matches any single character.

[...]

Matches any one of the enclosed characters. A pair of characters separated by - matches any character lexically between the pair, inclusive. If the first character following the opening [ is a !, any character not enclosed is matched.

{...}

Matches any one of the enclosed sequences. For example, file.{cc,hh} matches file.cc and file.hh.

UNIX note

On UNIX systems, you must precede the wildcard with a back slash (\) or enclose the pathname with the wildcard in quotation marks (" "). This prevents the shell from interpreting the wildcard as a shell wildcard.

Reconfiguring the Rawfs

To reconfigure a rawfs, you must wipe out the existing rawfs.

See Chapter 7, Managing ObjectStore on UNIX, or Chapter 8, Managing ObjectStore on Windows, for specific instructions about creating a rawfs and starting the Server on your platform. If you decide to reconfigure the rawfs, use that information with these general instructions.

Motivation

You might want to reconfigure a rawfs because you want to

Follow these instructions:

Procedure

  1. Confirm that you are on the machine you want to reinitialize and that the OS_ROOTDIR environment variables reflects this. You must be careful not to delete another rawfs accidentally.

  2. Use the ossvrstat utility to confirm that no users are changing any databases in the rawfs. The rawfs databases are backed up for the last time during this procedure.

  3. Use the ossvrchkpt utility to move everything in the log to the relevant databases.

  4. Use the osbackup utility to back up the databases in your rawfs.

  5. Use the ossvrshtd utility to shut down the Server.

  6. On UNIX platforms, modify the PartitionN Server parameter specifications to reflect your new rawfs. On Windows platforms, use the ObjectStore setup.exe utility to modify the configuration of the rawfs.

  7. Initialize the Server by specifying osserver -i. This wipes out the rawfs partitions and starts the Server.

  8. Use the osrestore utility (or oscopy, if you used it when saving the database) to restore any necessary databases.

What You Need to Know About the API

Some administrative tasks require familiarity with aspects of the API.

Capacity planning

Capacity planning requires knowledge of the data structures underlying any ObjectStore classes that the application stores, such as collection, relationship, and reference classes. See the following related ObjectStore documentation.
For Information About See
Soft pointers

Chapter 1, Advanced Persistence, in the Advanced C++ API User Guide

Collections

Chapter 1, Introducing Collections, in the C++ Collections Guide and Reference

Relationships

Chapter 4, Data Integrity, in the Advanced C++ API User Guide

Data organization

Managing the physical organization of the data (what is stored next to what) requires knowledge of the application's creation and deletion patterns and clustering directives. For information about creation and deletion patterns, talk to the application developers. For information about clustering, see Chapter 3, Programming with Persistent Storage, in the C++ API User Guide.

Indexes and contention

Managing indexes uses the API, and managing contention sometimes involves the API (for example, controlling locking granularity and lock caching). For information about indexes, see Chapter 7, Using Indexes to Optimize Performance, in the C++ Collections Guide and Reference. For information about controlling locking granularity and lock caching, see Chapter 2, Advanced Transactions, in the Advanced C++ API User Guide.

Managing Databases

To manage databases, you are likely to perform the following typical operations:
OperationUtility and Reference
Copy

oscopy: Copying Databases

Move

osmv: Moving Directories and Databases

Delete

osrm: Removing Databases and Rawfs Links

Backup

osbackup: Backing Up Databases

Restore

osrestore: Restoring Databases from Backups

Dump

osdump: Dumping Databases

Load

osload: Loading Databases

Compact

oscompact: Compacting Databases

Verify

osverifydb: Verifying Pointers and References in a Database

Additional utilities for operating on databases are documented in Chapter 4, Utilities.

Pointers and references

Database management is complicated by the fact that a database often

Data set

To perform many administrative activities, you must know the relationships among the databases so you can identify the data set. The data set includes

If a database contains no external pointers or references and is not pointed to or referenced by any other database, it alone is the data set. The application developer is often the best source for this information. If the developer is not available, you can iteratively use the ossize utility to establish the data set. See ossize: Displaying Database Size.

If you move all the databases of a dataset as a unit, no further action is usually required. For example, if there are references among the three databases

host:/usr/ed/db1
host:/usr/ed/dbs/db2
host:/usr/ed/dbs/db3
and they are moved to

host:/usr/fred/db1
host:/usr/fred/dbs/db2
host:/usr/fred/dbs/db3
or

hostess:/usr/ed/db1
hostess:/usr/ed/dbs/db2
hostess:/usr/ed/dbs/db3
no action is required. If you move one of the set, or change the name of one or more of the databases, you must use the osaffiliate utility to update the others to reflect the change. See osaffiliate: Changing Database Affiliations.

Schema databases

When you are operating on schema databases, you need not identify the data set. A schema database does not have cross-database pointers and references.

Your application's executable files may have references to schema databases. Use ossetasp to determine whether the pathname is embedded in the application and to update the pathname as required. Applications can use the set_application_schema_pathname method of the objectstore class to choose the location of the schema database at run time; if so, you must work with your developers to determine how best to keep schema database pathnames consistent. See also ossetasp: Patching Executable with Application Schema Pathname.

Operate on the set

After you identify a data set, you can perform an administrative function on the entire set. If you rename or move an individual database in the set, use the osaffiliate utility described in osaffiliate: Changing Database Affiliations to fix any external pointers and references.

Moving, renaming, and dumping databases

Before moving, renaming, or dumping a database, do the following:

  1. Run the osverifydb utility described in osverifydb: Verifying Pointers and References in a Database to confirm that no bad pointers or dangling references exist. This utility detects inconsistencies; it does not fix them.

If you are moving a database within a rawfs, verification is not necessary.

  1. Run the ossize utility described in ossize: Displaying Database Size to ensure that cross-database references are established correctly.

  2. Perform steps 1 and 2 on all databases in the data set.

  3. Run the ossvrchkpt utility described in ossvrchkpt: Moving Data Out of the Server Transaction Log to ensure that all data has been propagated from the log to the affected database.

Avoiding difficulties

To avoid administrative difficulties,

Server-remote databases

Databases are usually local to the Server. However, you can enable a Server to control databases that reside on a remote host. See Chapter 5, Using Locator Files to Set Up Server-Remote Databases, for details.

Databases and applications on CDROM

You can place an ObjectStore application on a CDROM and run the application from the CDROM. You can access read-only databases on the CDROM. To do this, you must allocate a Server log on a local writable disk. The Server itself (the executable files that make up the Server) can reside on the CDROM.

You should validate the schemas before you place an application or database on a CDROM. In other words, run the application on the database in question (in update mode), then put the application or database on the CDROM. This validates the schemas and sets the appropriate cache state in the databases. The result is improved performance because schema validation is not needed when the application opens the database on the CDROM.

For information about schema validation, see Chapter 9, Schemas, in the C++ API User Guide.

Overview of the Backup/Restore Facility

ObjectStore provides the following utilities to back up and restore databases without interrupting production:

These utilities back up databases that you specify to a secondary storage location. The osbackup utility performs backups according to the level that you specify; that is, it copies clusters that have been modified since a certain date. The osarchiv utility performs snapshots of pages modified since the previous snapshot or backup. You specify the interval between snapshots.

These utilities copy data from backups and archive media to your disk. The osrestore utility primarily restores databases from sources created by the osbackup utility. The osrecovr utility primarily restores data from archive files created by osarchiv. You can specify a point in time to which you want to recover data.

These utilities provide protection from catastrophic data loss due to hardware failure and can be used to transport databases from one location to another. Run the utilities in the following order:

  1. Run the osbackup utility (described in osbackup: Backing Up Databases) according to a schedule that you determine.

  2. Keep the osarchiv utility active. See osarchiv: Logging Transactions Between Backups.

  3. Run the osrestore utility (described in osrestore: Restoring Databases from Backups) to recover data backed up by the osbackup utility.

  4. Run the osrecovr utility (described in osrecovr: Restoring Databases from Archive Logs) to recover data from archive logs.

On-Line Backup and Archive Logging

On-line backup is the first step in guarding against data loss, but it cannot help you recover modifications made after the backup was performed. Archive logging provides the information you need to recover modifications made after a backup. On-line backup gives you a starting point for using archive logging.

On-line backup and archive logging provide these features:

The Server transaction log is not affected by archive logging.

On-Line Restore and Recovery

The osrestore utility restores databases from a backup image, restoring either the entire backup set or selected databases within the set. Although osrestore runs with the ObjectStore Server on-line, ObjectStore applications cannot access databases that are being restored until the entire restoration process is complete.

On-line restore and recovery offer these features:

See Backup Strategies for particular suggestions about using ObjectStore's backup and restore tools in a manner that best suits your environment.

Backup Strategies

When you develop a backup strategy, you need to consider certain conditions of your database environment. The questions to think about include:

The following paragraphs provide suggestions and examples of methods and tools you might use, depending on your answers to the previous questions.

General Backup Practices

Object Design recommends, at a minimum, a nightly backup of ObjectStore databases. The osbackup command is an on-line utility that runs as if it were an ObjectStore MVCC client. It does not cause any concurrency conflicts.

With osbackup, you can specify a backup level from 0 to 9. Files that have been modified since the last backup at a lower level are copied to the backup image. For example, suppose that you did a level 2 backup on Monday, followed by a level 4 backup on Tuesday. A subsequent level 3 backup on Wednesday would contain all files modified or added since the level 2 (Monday) backup.



You might choose to run Microsoft's Schedule service or use the at command to invoke this operation automatically each night. You can store the backup image on tape or on disk. If you are backing up to disk, use a separate disk for the backup images. This allows reads to occur on the source disk and writes on the target disk, which produces a faster backup and protects you from a disk crash.



You can take advantage of the cron facility on UNIX systems to automatically invoke the backup operation each night.

After the backup is complete, the backup images can then be moved to tape and eventually be stored in a safe location. For determining the best backup strategy, it is important that production size databases be estimated. If the databases are not in the gigabyte range, it is better to perform a level 0 (full backup) every night, as opposed to doing additional incremental backups. The advantage is that, in the event of a failure, only a single backup image needs to be restored. The following is a sample backup strategy:
Sun.:

Backup level 0

Wed.:

Backup level 1

Mon. Tues. Thurs. Fri. Sat.:

Backup level 2

For example, if you need to restore the databases on Friday morning, you must restore the backup images from Sunday, Wednesday, and Thursday. It is advisable to save the previous level 0 backup in another location before starting the new level 0 backup.

osbackup command flags

Following is a sample backup command:

osbackup -i bkup_rec.txt -l 0 -f full_bkup.img sample1.db sample2.db 
sample3.db 
Use the same incremental record file for both osbackup and osarchiv. If you do not, osarchiv starts its archiving operation with a full copy first. Make sure that you use the most recent backup and archive images.

See osbackup: Backing Up Databases for further explanation of the options for this utility.

Archive Logging

The osarchiv utility takes much smaller pictures of the database than osbackup takes. Object Design recommends that you always run the osarchiv utility, even during an osbackup. The advantage of this is that in the event of a system failure during the osbackup process, no data is lost. The osarchiv utility performs snapshots of pages modified since the previous snapshot or backup. You specify the interval between snapshots. The osarchiv utility records all transaction activity for specified databases.

Because the osarchiv process requires a backup image as initial input, the script responsible for this operation might choose to stop osarchiv and restart it each night after the osbackup process is completed successfully. Avoid updates in the window of time following the start of osbackup and the startup of osarchiv so osarchiv does not have to dump full clusters. You can move the archive file from disk to tape at this time if disk space is an issue.

osarchiv switches to the next archive file in the sequence when it encounters the maximum size allowed for an archive file. You can specify the maximum amount with the -s flag. The default maximum size is 2 MB. If osarchiv runs out of disk space for archive files, it notifies you and suspends activity until additional disk space is available.

The utility uses the following naming convention for archive files:

YYYYMMDDHH.ext, where
YYYY =

Year

MM =

Month

DD =

Day

HH =

Hour

ext =

Extension of the form aaa, aab, aac...

If you decrease the time between snapshots, you also decrease the number of transactions recorded in each snapshot. Using shorter intervals between snapshots has the effect of keeping the archive more up to date and keeping the amount of data that needs to be archived smaller at each interval. However, because each snapshot causes information to be written to the archive file, even if no data modifications are being recorded, frequent snapshots can consume space in the archive file unnecessarily. Longer intervals can reduce the amount of data being logged in cases in which the same data is modified by multiple transactions. In such cases, only the most recent copy of the committed data needs to be logged.

osarchiv command flags

The following is an example of an osarchiv command:

osarchiv -a bkup_rec.txt -d archive_img -i 30 sample1.db sample2.db 
sample3.db 
Remember that the incremental record file created with osbackup is the starting point for osarchiv. In the previous command line example:

See osarchiv: Logging Transactions Between Backups for further information about the options for this utility.

Special Considerations for Large Databases

The osbackup procedure backs up approximately 4 GB an hour. The backup can take much longer under certain load conditions, such as when updates are occurring on large numbers of pages while the backup is running. Contrast this time requirement with an operating system backup that averages 20 GB an hour. If you have very large databases to back up, the advantage of an on-line back up with osbackup might be less important than the amount of time it takes to do the back up. You might benefit more from shutting the ObjectStore system down and backing up the file system using operating system commands, as described next.

Using a file system backup and the ObjectStore archiver

If you keep the ObjectStore's archiver running while the operating system backup is running, the database is never without a recovery mechanism. The most dependable and least time-consuming method of backing up your data is to depend on the operating system backup and the ObjectStore archiver. The sequence of activities you need to complete is summarized in the following list:

  1. Freeze your applications (or shut them down).

  2. Perform a Server checkpoint.

  3. Wait for the archiver to take its snapshot.

  4. Shut down the archiver.

  5. Shut down the Server.

  6. Run the File system backup.

  7. Restart the Server.

  8. Restart the archiver.

  9. Resume or restart your applications.

Steps 3 through 5, 7, and 8 are necessary only if clients might access the Server during this procedure. If you can guarantee no client access, you need only perform steps 1, 2, 6, and 9.

The next paragraphs describe the way osrestore and osrecovr work.

Recovery Options

You should use the osrestore utility to restore databases from the most recent backup images created previously by osbackup. Recover any archived images created by the osarchiv utility by using the osrecovr utility.

Using both osrestore and osrecovr

When you are restoring databases to a specific point in time, make sure you run osrestore before you run osrecovr. The following osrestore command provides an example that assumes a full backup was performed:

osrestore -f full_bkup.img 
After the database has been restored, you can restore your database to a point in time by running the osrecovr utility with a command such as

      osrecovr -F archive_list.txt 
      C:\name\user>type archive_list.txt 
      archive_img\1999020719.aaa 
      archive_img\1999020719.aab 
      archive_img\1999020720.aac 
      archive_img\1999020720.aad 
      archive_img\1999020720.aae 
      archive_img\1999020720.aaf 
To recover to a specific date and time, use a command such as the following:

-F archive_list.txt -D 2/8/1999 -r 19:59:45 
See osrestore: Restoring Databases from Backups and osrecovr: Restoring Databases from Archive Logs for further explanation of options for these utilities.

Using system backup and osrecovr

Archive image files generated in a directory (specified by the osarchiv -d flag) can be deleted or moved to tape at your discretion. In the event of a failure, you can first restore your UNIX or Windows backup files, then invoke osrecovr with the file name that contains a list of all the archived images in the directory specified by the -d flag.

The Dump/Load Subsystem

This subsystem provides a facility that allows ObjectStore users to dump and load databases into and from a nondatabase format.

The ObjectStore dump/load facility allows you to

The dumped ASCII file is in a compact, human-readable format. You can read the file using an editor or string processing program such as perl, awk, or sed. The ASCII file is the input for the loader.

See osdump: Dumping Databases and osload: Loading Databases for more detailed information about using the dump/load facility. For advanced topics related to customization, see Chapter 7, Dump/Load Facility, in the Advanced C++ API User Guide.

Managing Users

There are two types of ObjectStore users:

This explanation focuses on the requirements for those running ObjectStore applications.

Running applications

To run an ObjectStore application, you need

OS_ROOTDIR

References to ObjectStore executables, libraries, and utilities require a definition for OS_ROOTDIR. OS_ROOTDIR is an environment variable that indicates the top-level directory in the file system hierarchy containing the ObjectStore release. It serves as the prefix of various directory names used in search paths.

You can set OS_ROOTDIR on each host that runs an ObjectStore Server or application. Alternatively, you can set OS_ROOTDIR in each user's environment.

OS_ROOTDIR allows you to change the location of the ObjectStore installation and allows users to switch to a different version of ObjectStore.

Application schema database

Every ObjectStore application has one application schema database that the schema generator produces when you build your application. The application schema database contains the definitions for all classes the application uses in a persistent context. An ObjectStore executable embeds the pathname of the application schema database. Therefore, you must ensure that the application schema database is available to the executable.

You can use the ossetasp utility to change the pathname of an application schema database for a particular executable.

Alternatively, an application can specify its application schema database pathname when it runs by calling objectstore::set_application_schema_path().

Sharing schemas

Multiple executables can share an application schema database. Developers create the application schema database as part of the procedure for building the application. The purpose of the application schema database is to ensure that the schema for an accessed database matches exactly the schema for an executable. ObjectStore compares the application schema to the database schema during execution.

Developing applications

To develop an ObjectStore C++ application, you need to be able to run ossg, the ObjectStore schema generator. Developers use the schema generator to create the application schema database. See Building ObjectStore C++ Applications.

Modifying Network Port Settings

Normally, the default settings for ports for network services are sufficient. However, you can modify them if you need to. One reason you might want to do this is if you are running two releases of ObjectStore on a machine at the same time. Another reason to modify port numbers might be if your site uses a firewall to prevent unauthorized network access. You can choose to have the firewall protect the default port numbers shown below or you can select different port numbers that are protected.

Communication Methods Background

To communicate with a network daemon such as the ObjectStore Server, a client requires a host address to identify the machine and a port to identify a particular process. ObjectStore finds host addresses by looking up the host name in a host table or similar facility. ObjectStore uses default ports, which can be overridden if necessary, as described in the following paragraphs. On each platform, ObjectStore supports at least two ways for processes to communicate:

The following table lists the communication channels for each platform.
PlatformLocal Transport LayerRemote Network
Solaris 2

TLI_LOCAL

TCP/IP

Windows

NSharedMemory

TCP/IP

UNIX

For the local network, ObjectStore uses sockets or TCP/IP streams to communicate among Server, client, and Cache Manager processes using predefined ports that you can modify if necessary. A port identifies a particular application on that machine. (An address identifies a particular machine.)

Windows

For the local network, ObjectStore uses a proprietary local network based on Named Shared Memory. Server, client, and Cache Manager processes use an identifier instead of port addresses. You can modify this identifier in the ports file.

Defaults for Port Settings

For NSharedMemory, the port setting modifies the default port, so you can use the same setting for all services. The defaults are

connect.server_client
accept.server_client
connrel.server_client
connreg.server_client
exception.server_client.
On the other networks, a port setting replaces the existing port setting, so you must provide unique settings for each port that you modify.

The default port settings are in the following tables.
ProcessIP Port NumberTLI_LOCAL PathnameUNIX Pathname
Server to R6 Cache Manager

51031

os_callback_v6

/tmp/ostore/os_callback_v6

R6 client to R6 Cache Manager

51041

osccom6

/tmp/ostore/osccom6

Client to Server

51025

objectstore_server_comm

/tmp/ostore/objectstore_server_comm

Notification

51050

objectstore_notification

/tmp/ostore/objectstore_notification

Modifying Port Settings

To modify settings, you change entries in the file shown in the following table. After you modify the ports file, you must shut down and restart the Server and Cache Manager for the changes to take effect. When the daemons start, they detect the existence of the ports file and use the settings in the ports file.

On UNIX and Windows, you can also set the variable OS_PORT_FILE to the name of a file you create.
PlatformPorts File
UNIX

$OS_ROOTDIR/etc/ports

Windows

%OS_ROOTDIR%\ETC\PORTS

Ports File Format

Each line in the ports file specifies the port for a network service. The syntax of a line in the ports file is

net:service:version:port 
net

Specifies the network type. It must be one of the values that appear in the Network column in the following table. Possible values vary according to the platform.

service

Specifies one of the following network services:



cache manager client is the service the client uses to find the Cache Manager. This is only meaningful when net is a local network. (The port the Cache Manager listens on for clients is always accessed by local clients.)



cache manager server is the service the Server uses to find a Cache Manager.



cache manager notification is the service the Server uses for notification purposes among clients.



server client is the service a client uses to find the Server.

version

Specifies the software version for the Cache Manager client or the Cache Manager Server. For Releases 4 and 5, specify 4. For ObjectStore Release 6, specify 6 as the version number in all cases except server client. This service requires a 1.

port

Specifies a port identifier as described in the following table.

NetworkPort IdentifierPort Identifier Example
IP (TCP/IP)

TCP/IP 16-bit port number. See Defaults for Port Settings.

51025

NSharedMemory

The string appended to shared object name. Omitted by default.

accept.server_client_myserver

TLI_LOCAL

Pathname in TLI Local name space. No default.

objectstore_server_com

UNIX

Pathname in file system. No default.

/tmp/ostore/objectstore_server_com

Examples

TCP/IP:server client:1:54432
NSharedMemory:server client:1:new_server
UNIX:server client:1:/tmp/.ostore/objectstore_server_comm
UNIX:cache manager client:6:/tmp/.ostore/objectstore_client_cache
UNIX:cache manager server:6:/tmp/.ostore/objectstore_server_
cache
If a ports file is not present, ObjectStore uses default settings.


Running Two Servers on One Host

You can run two ObjectStore Servers on the same host under some circumstances. You must specify different ports in the ports file. This lets clients know the one to contact.

Different versions

Object Design recommends that you never run on the same host two Servers that are the same ObjectStore version. If you want to run two Servers on the same host, ensure that they are different ObjectStore major versions, for example, one release 5 and one release 6 version.

To set up two Servers on the same host, you need to change only the server client ports for one of the Servers. The Cache Manager ports are already different in different major versions of ObjectStore.

All Servers that a client can communicate with must have the same network port number. This means that if you run two Servers on one host, any single client can access one of those Servers but not the other. It also means that if a client accesses Servers on more than one host, you must change the Server port settings on all affected hosts.

UNIX notes

On System V Release 4 systems, such as Solaris 2, specify a combination of TLI_LOCAL and TCP/IP statements. Note that the TLI_LOCAL domain port names exist in a separate, flat name space.

Windows

On Windows systems, you can specify statements for NSharedMemory and TCP/IP.

When Your Application Uses Notification

When an ObjectStore application uses notifications, the client automatically establishes a second network connection to the Cache Manager on the local host. The application uses this connection to receive (and acknowledge receipt of) incoming notifications from the Cache Manager. (Outgoing notifications are sent to the Server, not to the Cache Manager.)

This all happens automatically and transparently, so there is no relevant API. However, as with all network connections, you might want to control the network port that is used by the connection. You can use the ports file in the usual way to control the use of network ports. The relevant information follows:
Name of service

cache manager notification

Default IP port number

51050

Default UNIX local socket file name

/tmp/ostore/objectstore_notification

How a Client Locates the Server for a Database

How does a client determine the Server to communicate with? The answer depends on whether the database being created or opened is a file database or a rawfs database.

When Accessing a File Database

When a client tries to open or create a file database, the client has a pathname for the database. The client looks for the Server on the machine that has the disk on which the database is or will be stored. Normally, this disk is local to the machine with the Server. In other words, the database is Server local.

If the client cannot find a Server that is local to the disk, it signals an error unless there is a locator file.

A locator file allows a client to access Server-remote databases. Server-remote databases are stored on disks that are not local to an ObjectStore Server. See Chapter 5, Using Locator Files to Set Up Server-Remote Databases.

If there is a locator file, the client checks it to determine the Server to communicate with.

When Accessing a Rawfs Database

When a client tries to open or create a rawfs database, the rawfs host is specified in the pathname of the rawfs database: See Rawfs Databases.

Managing ObjectStore on Multiple Platforms

When you manage a site that runs ObjectStore on a variety of platforms, there are issues to consider that do not exist when you run ObjectStore on a single platform.

Using Multiple File Systems

ObjectStore is not dependent on a particular file system. If the usual file system calls (such as open, read, write, close) work on the file, ObjectStore can use them successfully.

Translating Pathnames

You might run an ObjectStore application on both PCs and UNIX systems. UNIX uses forward slashes (/) in pathnames; PCs use back slashes (\). How does ObjectStore handle this?

Suppose you have a UNIX Server along with some Windows NT clients.

Native pathnames

If you are using something like an NFS client to mount the UNIX file system, you use the client's native syntax. For example, on a PC on which drive Q is NFS-mounted on husky:/desktop1, ObjectStore expands the file name Q:\jet\my.db into a reference to /desktop1/jet/my.db on the Server host husky.

Server-relative pathnames

If you do not use file mounting, you can use Server-relative pathnames of the form husky:/desktop/jet/my.db. ObjectStore interprets the part of the pathname that follows the colon (:) according to the syntax of the Server host (UNIX in this example).

Callback Messages Background

The Cache Manager facilitates concurrent access to data by handling callback messages from the Server to client applications. To understand the way callback messages work, you need to know about ownership and locks.

Note

The terms ownership, encached page, and permit all represent the same concept - a client has permission to read or modify the page.

Read or write ownership

Read ownership exists when a client has permission to read a particular page. Write ownership exists when a client has permission to modify a particular page.

A Server grants read ownership to as many clients as request it. If one client requests write ownership, that client must wait if there are current transactions that are reading that page, or if there is a current transaction that is modifying that page.

Many clients can have read ownership at the same time, but only one client at a time can have write ownership. When a client has write ownership, no clients can have read ownership.

Clients can release ownership in the following situations:

Read or write locks

When a client actually reads or writes a page during a transaction, it places a read or write lock on that page. When a client has a lock on a page, it means that another client cannot receive write permission for that page. A client must have read or write ownership to be able to place a read or write lock on a page. The client releases the lock when the transaction commits.

Ownership and locks

It is important to recognize the difference between ownership and locks. Ownership gives the client permission to read or modify a page. A lock allows the client to actually read or modify the page.

When a client has ownership, it can place a lock on a page without communicating with the Server.

A client can have read ownership without a read lock if the client read the page previously but is not reading the page in the current transaction. The same is true for write ownership and locks.

Lazy release

The client need not give up ownership on pages when the pages are no longer needed. The client keeps ownership in case data on those pages is needed again. In contrast, the client always gives up locks when a transaction commits.

The lazy release is an optimization. If no other client needs the page that your client has ownership of, that client need not request ownership from the Server for that page for as long as the client is active.

Callbacks

When a client requests read ownership for a page and no other client has write ownership, the Server grants read ownership. The Cache Manager is not involved.

The Cache Manager is involved in the following situations:

In these situations, the Server sends a callback message to the Cache Manager on the host of the client that has ownership. The Cache Manager determines whether ownership can be released or the client requesting ownership must wait.

If the client with ownership

If the first client had write ownership, and the second client is requesting read ownership, the Cache Manager downgrades the ownership of the first client from write to read. Otherwise, the client loses ownership.

API for lock management

Typically, ObjectStore performs lock management. There are, however, API features that allow a client to control whether a client waits for a lock. When an application uses these features, ObjectStore still uses the lazy release.

For more information about ownership and locks, see Chapter 2, Advanced Transactions, in the Advanced C++ API User Guide.

ClearCase Virtual File System (MVFS)

If your ObjectStore applications reside in a ClearCase virtual file system (MVFS), they may have trouble locating an ObjectStore Server. To overcome this problem, you should set up locator files or use ObjectStore/Single. See Chapter 5, Using Locator Files to Set Up Server-Remote Databases, for more information on using locator files. See Chapter 6, Working with ObjectStore/Single, in Building ObjectStore C++ Applications for more information about ObjectStore/Single.

Troubleshooting

This section provides examples of problems you might encounter. In general, when you receive an error message you should

These steps allow you to either take a corrective action that resolves the problem or to provide Object Design Technical Support with enough information to resolve it.

Where to begin?

If you have a problem with ObjectStore, the problem might lie in your client application, the Server, or the cache manager. It might also be due to problems with your database(s) or application schema database(s), or it might be due to operating system or network configuration problems.

Debugging the ObjectStore Server

When the Server starts, exits, or encounters a severe error, it records that information in its text output file. Examine this file for error messages. The files to examine are
UNIX

/tmp/ostore/oss_out

Windows

%OS_TMPDIR%\OSSERVER.TXT

If the Server fails to start, you can try starting it by hand with additional arguments to enable debugging output. On UNIX, as root, enter

osserver -F -d 5
On Windows, in a console window, enter

osserver -con -d 5
The Server sends debug printouts to standard output describing its actions. The number after -d is the debug level. The levels available are described in the following paragraphs.

You can confirm that the Server has started successfully by using the ossvrstat command.

If the Server starts successfully and you want to turn on debugging output just before a test run, you can use the ossvrdebug utility with a command such as

ossvrdebug server host name debug level

This command turns on debug output from the named server and ossvrdebug 0 turns it off. The higher the debug level, the more verbose the output and the more Server performance is affected. The levels are
Level 0

Turns ossvrdebug off

Level 1

Reports client connect or disconnect

Level 2

Reports messages received

Levels 3-8

Provide expanded message information

Level 9

Provides full message information

Server Initialization Failed

Following is a message you might receive when you try to start the Server:

Server initialization failed. (orecvery.cc line 2787)
Unknown record type 127528668 at line 1266304
Failed to start ObjectStore server
The resource affected is the Server and the reference to record type might indicate a problem with the log. To obtain more information, you can

It is possible that someone accidentally deleted the log or the log might not have the correct permissions.

While running a client application you might receive this message:

Sample trace file reading

Following is an example of an ossvrdebug 5 trace file:

Mon Jan 25 15:01:12 1999 DEBUG 48416 [03] client #41
 (flurry.odi.com/9325/(unknown)): upgrade_locks2 CLIENT MESSAGE 
315
 RECEIVED
Mon Jan 25 15:01:12 1999 DEBUG 48417 [04] client #41
  (flurry.odi.com/9325/(unknown)): upgrade_locks2(able to abort, wait
  forever for lock)
Mon Jan 25 15:01:12 1999 DEBUG 48418 [05] client #41
  (flurry.odi.com/9325/(unknown)): upgrade_locks2 implicit
  start_transaction(read/write)
Mon Jan 25 15:01:12 1999 DEBUG 48419 [05] client #41
  (flurry.odi.com/9325/(unknown)): upgrade_locks2 write_locking(DB 
  handle 28, segment #42, 0, 16)

Trace annotation

Client #41 has read ownership of the page and wants to write-own the page. It has to wait because clients #36 and #39 have the page owned for read.

Mon Jan 25 15:01:12 1999 DEBUG 48420 [05] Callback Thread
  (flurry.odi.com) client #36: callback for write(pid=9175, DB handle 28,
  segment #42, 0, 16)
Mon Jan 25 15:01:12 1999 DEBUG 48421 [04] Callback Thread 
  (flurry.odi.com) client #36: callback for write(pid=9175, DB handle 28, 
  segment #42, 0, 16) -> POSITIVE

Trace annotation

Client #36 gives up all ownership.

Mon Jan 25 15:01:12 1999 DEBUG 48422 [05] Callback Thread
  (flurry.odi.com) client #39: callback for write(pid=9318, DB handle 28, 
  segment #42, 0, 16)
Mon Jan 25 15:01:12 1999 DEBUG 48423 [04] Callback Thread
  (flurry.odi.com) client #39: callback for write(pid=9318, DB handle 28,
  segment #42, 0, 16) -> NEGATIVE

Trace annotation

Client #39 says no, so client #41 continues to wait.

Additional notes

The following annotations explain some of the trace file activity.

Debugging the Cache Manager

When the cache manager encounters a severe error, it records that information in its text output file. Examine the relevant file for error messages:
UNIX

/tmp/oscm_out

Windows

%OS_TMPDIR%\OSCMGR6.TXT

On UNIX, verify the setuid root. If the cache manager fails to start, you can try starting it by hand with additional arguments to enable debugging output. On UNIX, as root, enter

oscmgr6 0 <debug level> 
On Windows, in a console window, enter

oscmgr6 -con 0 <debug level>
The cache manager sends debug printouts that describe its actions to standard output. The number after -d is the debug level described in the following information.
1

Basic information

10

Client and Server connection information

50

All information

You can confirm that the cache manager has started successfully by using the oscmstat command.

Debugging Cache Manager Autostart

When an ObjectStore client is started, the application checks to see whether the cache manager is running. If the cache manager is not running, the client starts it. This process is called the cache manager autostart. If this process fails, you might see a message such as the following:

Miscellaneous ObjectStore error
Reached end-of-file reading initial message from cache manager
(PID=0) (err_misc)
Segmentation Fault
The resource affected is the Cache Manager. To obtain more information you can

UNIX

If you are mounting the file system that contains the oscminit6 executable, make sure that you do not specify -o nosuid. When you mount the file system, -o suid is the default; you need not specify it. If the mount is in the fstab file, ensure that nosuid does not appear in the mount options field.

Alternate Debugging Technique For the Cache Manager Autostart

Another technique for debugging problems with cache manager autostart is to set the environment variable
OS_DEBUG_CMGR_STARTUP to 1 before starting a client application that launches the cache manager. You can determine whether your application is interfering with cache manager autostart by using ossize to launch the cache manager instead.

Environment Variables Useful for Debugging

The following are environment variables useful for debugging ObjectStore Servers and Cache Managers. Most of these variables are enabled with a value of 1.
OS_DEBUG_NETWORK

Displays information about each network call.

OS_DEBUG_DYNAMIC_NET

Displays information about network initialization. Generates debug information regarding the server's decision about the network protocol (such as TCP/IP or NetBios) to use at start-up.

OS_DEF_EXCEPT_ACTION

Controls the outcome if an unhandled exception is signaled. Useful in debugging unhandled exceptions. You can specify the following values:

On Windows NT: ExitProcess (0x006600);

On UNIX: kill (getpid(), SIGKILL);

OS_DEF_BREAK_ACTION









Sets a hard-coded break point that allows you to obtain a stack trace before the unwinding of the stack.

OS_DEF_MESSAGE_ACTION





Determines the default message action for
_ODI_message (used for unhandled TIX exceptions). You can set this variable to stderr or stdout to send the information there, or you can specify the name of a file to receive the information.

Debugging ObjectStore Client Applications

The following environment variables apply only to client applications.
OS_DEBUG_CMGR_STARTUP

Displays information about a client's attempt to autostart the Cache Manager. Set to any value to display useful dialog information. If running a client, it needs to invoke a Cache Manager.

OS_DEBUG_LOCATOR_FILE

Takes values 1, 2, or 3 to generate varying degrees of output from the locator file mechanism. The higher the value, the more comprehensive the reported information.

OS_TRACE_MISSING_VTBLS

Useful when you are debugging problems with missing vtbls. This environment variable helps determine those classes that need vtbls. Any nonempty value except 0 enables the debugging message. The higher the value, the more comprehensive the reported information.

OS_DEBUG_C0000005





Instructs ObjectStore to display a message box if a fault occurs and the ObjectStore exception handler sees it. The message explains the fault as an attempt to read location 0x1234 from EIP 0x10231023. This can be useful in tracking down access violations in your code.

No Handler for Exception

ObjectStore reports errors by signaling TIX exceptions. If an unexpected error occurs, it is likely that your program does not have a handler for that exception, and your program will exit with the message No handler for exception followed by information on the particular error condition that was signaled. Examples of these kinds of errors appear in the paragraphs that follow.

Database Error

While trying to access a database you might receive this message:

No handler for exception:
ObjectStore internal error Database dbname has fraction length?
(err_internal)
The resource affected is the database or the client application. To obtain more information you can

Cannot Open Application Schema

While trying to access a database you might receive the following message:

No handler for exception:
Cannot open the application schema
<err-0025-0311> The application schema database db.asdb was not 
found
(err_cannot_open_application_schema)
While trying to open the application schema database.
The resource affected is the database. To obtain more information you can

When you move an application to a machine that is not running a Server, leave the application schema database on the Server host. You must then run the ossetasp utility to patch the executable so it can find its application schema database.

The application schema database must be local to a Server. The only exception to this is when you use a locator file. See Chapter 5, Using Locator Files to Set Up Server-Remote Databases.

Invalid Address

When trying to run a client application you might receive a message such as the following:

No handler for exception
ObjectStore internal error
ObjectStore referenced invalid address 0x7fff0028(0)
The resource affected is the client application. To obtain more information you can

This is a case in which you might not be able to figure out the problem but you can obtain enough information for Object Design Technical Support to solve the problem quickly.

Unsupported Server Protocol

If you are running a Release 6 Server and a non-Release 6 Server on the same machine, you might receive the following message when trying to run an application:

Attempt to use unsupported server protocol.
<err-0001-0006> Server elvis does not support version 5.0 clients.
(err_protocol_not_supported)
ObjectStore displays this message when a Release 6 client tries to communicate with a non-Release 6 Server. This error might occur if you did not shut down the non-Release 6 Server while you installed the Release 6 Server. Shutting down and restarting the non-Release 6 Server should correct the situation.

Cannot Commit

You must ensure that when two or more ObjectStore Servers receive modified data in a single transaction, each Server can communicate with each of the other Servers. If all Servers involved in such a transaction cannot communicate with each other, ObjectStore aborts the transaction with err_cannot_commit.

The exception occurs only when a two-phase commit has problems. A two-phase commit usually occurs only if multiple Servers are being written to in that transaction. If a client reads from ServerA in one transaction and writes to ServerB in the same transaction, it is not a two-phase commit and it is not necessary for ServerA and ServerB to be able to communicate across a common network.

Before You Call Object Design Support

When you contact Object Design Technical Support, be prepared to provide



[previous] [next]

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

Updated: 03/11/99 11:18:14