Database Format
The format of the ObjectStore database has changed for Release 6.0. To upgrade an existing ObjectStore database, you must use the dump/load facility, as described in the Advanced C++ API User Guide, Chapter 8. dump/load facility
The dump/load facility is available in Release 6.0. However, the migration facility that is built on top of dump/load is not available for this Beta release. Incompatible database format
The format of databases created with Beta versions of ObjectStore might not be compatible with the database format of subsequent betas or the GA release. Beta users should expect to have to discard databases that have been created with beta versions of the software. Opening and Closing Databases
ObjectStore databases can be opened repeatedly without being closed, so long as each succeeding call to open() specifies the same mode: MVCC, read-only, or update. ObjectStore maintains an open count, which calls to open() increment and calls to close() decrement. The database is closed when the count reaches 0.
static void set_union_variant(
void *address,
const char *type_name,
os_unsigned_int16 variant
);
The arguments have the following meanings:
static os_unsigned_int16 get_union_variant(
void *address,
const char *type_name
);
The arguments have the following meanings:
Consider the following class declaration, which has a data member whose value is a union:
class kgraph {
private:
union kg_union {
kgraph* kg_kg;
os_int32 kg_int;
} kg;
os_int16 kg_type;
public:
kgraph()
{
kg_type = 0;
}
void set_kg( kgraph* new_kg)
{
kg_type = 1;
if (objectstore::is_persistent(this))
objectstore::set_union_variant( this, "kg_union", 1 );
kg.kg_kg = new_kg;
}
void set_int( int new_int )
{
kg_type = 2;
if (objectstore::is_persistent(this))
objectstore::set_union_variant( this, "kg_union", 2 );
kg.kg_int = new_int;
}
os_boolean verify()
{
os_int16 uv = objectstore::get_union_variant( this, "kg_
union");
if (kg_type != uv)
cout << "union variant verification failed: expected "
<< kg_type << " but returned " << uv << endl;
return (kg_type == uv);
}
static os_typespec *get_os_typespec();
};
Whenever either kgraph::set_kg() or kgraph::set_int() is called, the embedded call to objectstore::set_union_variant() records the currently active member object. An exception occurs if any of the following is true:
In Release 6.0, implicit updates are replaced by explicit calls to the os_database::affiliate() method. This method affiliates this database with a target database by adding the path of the target to the pathname pool of this database. The affiliate() method must be called once for each target database.
affiliate() starts and commits a transaction if one is not already in progress. Until the end of the top-level transaction, the pathname pool of this database is write-locked and (if the deep argument is set to true) the pathname pool of the target database is read-locked. The pathname pool of this database is updated to include the target database.
Operator new Overloads
Release 6.0 provides two additional overloadings of operator new:
void *::operator new(size_t, os_cluster, os_typespec) void *::operator new(size_t, os_cluster_with, os_typespec)
This overloading of new requires an os_cluster object; see os_cluster. If your program does not have one at hand, call os_cluster::of(object), which returns an os_cluster object for the cluster of object; see os_cluster::of(). If the object to be allocated is greater than 64K, it is allocated in a new cluster in the same segment as object; see Clusters and Allocation Size.
It is the user's responsibility to delete the os_cluster object.
os_cluster_with Overload
The os_cluster_with overload of new is useful grouping (clustering) related objects. It tries to allocate storage for an object as close as possible to another object; see os_cluster_with. To obtain an os_cluster_with object, call os_cluster::with(object); see os_cluster::with().
If the object to be allocated is greater than 64K, it is allocated in a new cluster in the same segment as object; see Clusters and Allocation Size.
foo* x = new( os_cluster::with( this ), foo::get_os_typespec() ) foo;does not require the user application to deallocate the os_cluster_with object returned by os_cluster::with().
| 51025 | Client to Server communication |
| 51041 | Client to Cache Manager communication |
| 51031 | Cache Manager to Server communication |
| 51050 | Cache Manager notification communication |
For other port designations and information about adjusting port numbers, see Managing ObjectStore.
Transactions
The following sections describe changes to ObjectStore's support for transactions. For changes to the os_transaction API, see os_transaction.
Global and Local Transactions
Release 6.0 supports both local and global transactions. By default, all transactions are local. All lexical transactions are always and only local. (A lexical transaction is delimited by the OS_BEGIN_TXN and OS_END_TXN macros.)
Global Transactions
For multithreaded applications that do not use the sessions facility, starting a global transaction in one thread causes all other concurrent threads to enter the same global transaction. For multithreaded applications that use the sessions facility, starting a transaction in one thread causes all other concurrent threads in the calling thread's current session to enter the same global transaction.
Applications that use the sessions facility must synchronize access to persistent data by threads in the same session; ObjectStore synchronizes access to persistent data by threads in different sessions.
Existing applications that depend on transaction consistency across aborted nested transactions will have to be changed. (Applications should never depend on state that was read during any aborted transaction.)
Consider the following example:
start outer txn
start nested txn
read persistent var x
abort nested txn
start nested txn
read persistent var x
commit nested txn
commit outer txn
Previously, the two reads of x would see the same value. In Release 6.0, they are not guaranteed to see the same value -another client could change the value of x in the interval between the abort of the first nested transaction and the next read of x.
int main (int argc, char** argv) {
OS_ESTABLISH_FAULT_HANDLER
// your code ...
OS_END_FAULT_HANDLER
return some_value;
}
Braces and semicolons are not necessary; they are part of the macros. For more information about these macros, see the C++ API Reference, Chapter 4.
Notification Services
Closing a database discards all subscriptions within that database. You must reopen and resubscribe in order to continue receiving subscriptions.
oscmgr4
The oscmgr4 utility has been renamed to oscmgr6. For information about changes to the Cache Manager, see Cache Manager.
oscminit
The oscminit utility has been renamed to oscminit6. There is no change in behavior. This UNIX executable starts oscmgr6. The oscminit6 utility generally runs automatically to start the Cache Manager. oscmstat
The Cache Manager status information displayed by the oscmstat utility has changed for Release 6.0. For each Server to which the Cache Manager is connected, oscmstat displays
oscp
The oscp utility is not supported in Release 6.0 and is replaced by the oscopy utility. The oscopy utility makes a copy of an ObjectStore database. A key benefit of oscopy is that it performs transaction-consistent database copying without incurring locking conflicts. osdump
The dump/load facility has changed in Release 6.0. Refer to the descriptions of osdump and osload in Managing ObjectStore. For information about using the dump/load facility to migrate a 5.1 database to Release 6.0, see Migrating a 5.1 Database to Release 6.0.
osprmgc
The osprmgc utility is not supported in Release 6.0. The problem it was devised to cure (PRM bloat) is no longer an issue; see Relocation Optimization. The os_dbutil::osprmgc() method is also not supported.
ossg
The following paragraphs describe to the neutralization options supported by the ossg utility. New -arch options
The architecture sets named setn have been replaced with all, all32, and all64. The new sets contain all supported 32-bit and 64-bit platforms respectively. Different names, same size
A new option, -portable_type_name, has been added to neutralize schemas in which different types names denote integral types of the same size on different platforms. For example, Solaris and SGI use long long to mean 64-bit integers, Visual C++ uses __int64, and other 64-bit platforms use long.
-portable_type_name name sizename is the name of your type and size is the type's size in bytes.
The following example shows how to process a schema that uses a 64-bit integer called foo on Solaris and Windows platforms
#if defined __OS_SOL2 typedef long long foo #else typedef __int64 foo #endif
-portable_type_name foo 8
You can now verify a range of clusters in each segment, using the new -start_cluster and -end_cluster options. The -start_offset and-end_offset options have been changed to refer to offsets within clusters instead of segments.
The -info_sector_tag_verify_opt option has been removed.
For details about osverifydb, see osverifydb: Verifying Pointers and References in a Database in Chapter 4 of Managing ObjectStore.
Default Cache and Log files
ObjectStore/Single automatically creates default cache and log files. Previous releases required you to set the ObjectStore/Single environment variables OS_CACHE_FILE and OS_LOG_FILE and to call
objectstore::set_cache_file objectstore::set_log_filein order to create the files.
Both environment variables are still supported in Release 6.0; however, objectstore::set_cache_file has no effect on Windows platforms.
The user should pay special attention to objects of the following classes:
Collections APIs Not Supported in Release 6.0
Classes
os_collection_size os_coll_rep_descriptor os_rDictionary os_rep os_rep_class os_rep_policy
os_collection::maintain_cursors os_Collection::maintain_cursors os_collection::associate_policy os_collection::be_an_array os_collection::dont_associate_policy os_collection::dont_verify os_collection::safe os_collection::signal_cardinality os_collection::unsafe os_collection::verify
os_index_path::destroy() os_coll_query::destroy() os_collection::change_behavior() os_collection::change_rep() os_collection::get_rep() os_collection::get_thread_locking() os_collection::set_thread_locking()
OS_MARK_RDICTIONARY() OS_TRANSIENT_RDICTIONARY()
New Collections APIs in Release 6.0
The following diagram shows the hierarchical relationship among the ObjectStore collection classes.
New classes
os_nlist and os_nList allow you to customize the os_list and os_List internal representations. These new classes replace the os_chained_list customization macros. Using new and delete with Collections
In earlier versions of ObjectStore, the recommended way to create collections and collections subtypes, such as arrays and bags, was to call the os_collection::create() function. You did not use new to create collections. Likewise, the recommended way to destroy collections and its subtypes was to call the os_collection::destroy() function, and not use delete.
| Collections Class | Maintain Element Order | Allow Duplicates | Signal Duplicates |
|---|---|---|---|
| os_Set | No | No | No |
| os_Bag | No | Yes | No |
| os_List | Yes | Yes | No |
| os_Array | Yes | Yes | No |
| os_Dictionary, unordered | No | Yes | No |
| os_Dictionary, ordered | No | Yes | No |
Cursor Behavior
There are no safe cursors in Release 6.0. For compatibility with earlier releases, you can use the Release 5.1 API to create a safe cursor, but it is not actually a safe cursor. Instead, ObjectStore creates an update-insensitive cursor. No Distinction Between Reference-Based and Pointer-Based Collections
In Release 5.1, some classes, provided reference-based collections. In Release 6.0, all collections behave like reference-based collections. There is no distinction between reference-based and pointer-based collections, because both are implemented using soft pointers; see Soft Pointers.
For example, in Release 5.1, you could use the os_vdyn_bag and os_vdyn_hash classes as ObjectStore collection representations. In Release 6.0, you should use os_bag or os_set instead.
os_rDictionary Not Supported
The os_rDictionary class has been removed from ObjectStore. It is replaced by the os_Dictionary class, which is now both reference-based and pointer-based. See No Distinction Between Reference-Based and Pointer-Based Collections.
Updated: 03/11/99 12:16:55