ss_m Class Reference

Inherits smlevel_top.

Collaboration diagram for ss_m:

Collaboration graph
[legend]
List of all members.

Detailed Description

This is the SHORE Storage Manager API.

Most of the API for using the storage manager is through this interface class.

Examples:

create_rec.cpp, log_exceed.cpp, sort_stream.cpp, startstop.cpp, and vtable_example.cpp.

Definition at line 619 of file sm.h.

Public Types

typedef smlevel_0::LOG_WARN_CALLBACK_FUNC LOG_WARN_CALLBACK_FUNC
typedef smlevel_0::LOG_ARCHIVED_CALLBACK_FUNC LOG_ARCHIVED_CALLBACK_FUNC
typedef smlevel_0::ndx_t ndx_t
typedef smlevel_0::concurrency_t concurrency_t
typedef smlevel_1::xct_state_t xct_state_t
typedef sm_store_property_t store_property_t
typedef ssm_sort::sort_keys_t sort_keys_t

Public Member Functions

 ss_m (LOG_WARN_CALLBACK_FUNC warn=NULL, LOG_ARCHIVED_CALLBACK_FUNC get=NULL)
 Initialize the storage manager.
 ~ss_m ()
 Shut down the storage manager.

Static Public Member Functions

static rc_t setup_options (option_group_t *grp)
 Add storage manager options to the given options group.
static void set_shutdown_flag (bool clean)
 Cause the storage manager's shutting down do be done cleanly or to simulate a crash.
static rc_t log_file_was_archived (const char *logfile)
 Notify storage manager when a log file was archived by a LOG_WARN_CALLBACK_FUNC.
static rc_t begin_xct (timeout_in_ms timeout=WAIT_SPECIFIED_BY_THREAD)
 Begin a transaction.
static rc_t begin_xct (sm_stats_info_t *stats, timeout_in_ms timeout=WAIT_SPECIFIED_BY_THREAD)
 Begin an instrumented transaction.
static rc_t begin_xct (tid_t &tid, timeout_in_ms timeout=WAIT_SPECIFIED_BY_THREAD)
 Begin a transaction and return the transaction id.
static rc_t enter_2pc (const gtid_t &gtid)
 Make the attached transaction a thread of a distributed transaction.
static rc_t set_coordinator (const server_handle_t &h)
 Assign a coordinator handle to this distributed transaction.
static rc_t prepare_xct (sm_stats_info_t *&stats, vote_t &vote)
 Prepare a thread of a distributed transaction.
static rc_t prepare_xct (vote_t &vote)
 Prepare a thread of a distributed transaction.
static rc_t force_vote_readonly ()
 Force the transaction to vote "read-only" in a two-phase commit.
static rc_t recover_2pc (const gtid_t &gtid, bool mayblock, tid_t &local)
 Given a global transaction id, find the local prepared transaction associated with it.
static rc_t query_prepared_xct (int &numtids)
 Return the number of prepared transactions.
static rc_t query_prepared_xct (int numtids, gtid_t l[])
 Return the global transaction IDs of in-doubt transactions.
static rc_t commit_xct (bool lazy=false, lsn_t *plastlsn=NULL)
 Commit a transaction.
static rc_t commit_xct (sm_stats_info_t *&stats, bool lazy=false, lsn_t *plastlsn=NULL)
 Commit an instrumented transaction and get its statistics.
static rc_t chain_xct (sm_stats_info_t *&stats, bool lazy=false)
 Commit an instrumented transaction and start a new one.
static rc_t chain_xct (bool lazy=false)
 Commit a transaction and start a new one, inheriting locks.
static rc_t abort_xct (sm_stats_info_t *&stats)
 Abort an instrumented transaction and get its statistics.
static rc_t abort_xct ()
 Abort a transaction.
static rc_t save_work (sm_save_point_t &sp)
 Populate a save point.
static rc_t rollback_work (const sm_save_point_t &sp)
 Roll back to a savepoint.
static w_base_t::uint4_t num_active_xcts ()
 Return the number of transactions in active state.
static void attach_xct (xct_t *x)
 Attach the given transaction to the currently-running smthread_t.
static void detach_xct ()
 Detach any attached from the currently-running smthread_t.
static xct_ttid_to_xct (const tid_t &tid)
 Get the transaction structure for a given a transaction id.
static tid_t xct_to_tid (const xct_t *x)
 Get the transaction ID for a given a transaction structure.
static rc_t dump_xcts (ostream &o)
 Print transaction information to an output stream.
static xct_state_t state_xct (const xct_t *x)
 Get the transaction state for a given transaction (structure).
static smlevel_0::fileoff_t xct_log_space_needed ()
 Return the amount of log this transaction would consume if it rolled back.

If a transaction aborts with eOUTOFLOGSPACE this function can be used in conjunction with xct_reserve_log_space to pre-allocate the needed amount of log space before retrying.

static rc_t xct_reserve_log_space (fileoff_t amt)
 Require the specified amount of log space to be available for this transaction before continuing.

If a transaction risks running out of log space it can pre-request some or all of the needed amount before starting in order to improve its chances of success. Other new transactions will be unable to acquire log space before this request is granted (existing ones will be able to commit, unless they also run out of space, because that tends to free up log space and avoids wasting work).

static concurrency_t xct_lock_level ()
 Get the locking granularity for the attached transaction.
static void set_xct_lock_level (concurrency_t l)
 Set the default locking level for the attached transaction.
static rc_t xct_collect (vtable_t &v, bool names_too=true)
 Collect transaction information in a virtual table.
static rc_t bp_collect (vtable_t &v, bool names_too=true)
 Collect buffer pool information in a virtual table.
static rc_t lock_collect (vtable_t &v, bool names_too=true)
 Collect lock table information in a virtual table.
static rc_t thread_collect (vtable_t &v, bool names_too=true)
 Collect thread information in a virtual table.
static rc_t checkpoint ()
 Take a checkpoint.
static rc_t force_buffers (bool invalidate=false)
 Force the buffer pool to flush its pages to disk.
static rc_t force_vol_hdr_buffers (const vid_t &vid)
 Force the buffer pool to flush the volume header page(s) to disk.
static rc_t force_store_buffers (const stid_t &stid, bool invalidate)
 Force the buffer pool to flush to disk all pages for the given store.
static rc_t gather_xct_stats (sm_stats_info_t &stats, bool reset=false)
 Get a copy of the statistics from an attached instrumented transaction.
static rc_t gather_stats (sm_stats_info_t &stats)
 Get a copy of the global statistics.
static rc_t config_info (sm_config_info_t &info)
 Get a copy of configuration-dependent information.
static rc_t set_disk_delay (u_int milli_sec)
 Set sleep time before I/O operations.
static rc_t format_dev (const char *device, smksize_t quota_in_KB, bool force)
 Format a device.
static rc_t mount_dev (const char *device, u_int &vol_cnt, devid_t &devid, vid_t local_vid=vid_t::null)
 Mount a device.
static rc_t dismount_dev (const char *device)
 Dismount a device.
static rc_t dismount_all ()
 Dismount all mounted devices.
static rc_t list_devices (const char **&dev_list, devid_t *&devid_list, u_int &dev_cnt)
 Return a list of all mounted devices.
static rc_t list_volumes (const char *device, lvid_t *&lvid_list, u_int &lvid_cnt)
 Return a list of all volume on a device.
static rc_t get_device_quota (const char *device, smksize_t &quota_KB, smksize_t &quota_used_KB)
 Get the device quota.
static rc_t set_fake_disk_latency (vid_t vid, const int adelay)
 Change the fake disk latency before I/Os on this volume, for debugging purposes.
static rc_t enable_fake_disk_latency (vid_t vid)
 Enable the fake disk latency before I/Os on this volume, for debugging purposes.
static rc_t disable_fake_disk_latency (vid_t vid)
 Disable the fake disk latency before I/Os on this volume, for debugging purposes.
static rc_t generate_new_lvid (lvid_t &lvid)
 Add a volume to a device.
static rc_t create_vol (const char *device_name, const lvid_t &lvid, smksize_t quota_KB, bool skip_raw_init=false, vid_t local_vid=vid_t::null, const bool apply_fake_io_latency=false, const int fake_disk_latency=0)
 Add a volume to a device.
static rc_t destroy_vol (const lvid_t &lvid)
 Destroy a volume.
static rc_t get_volume_quota (const lvid_t &lvid, smksize_t &quota_KB, smksize_t &quota_used_KB)
 Gets the quotas associated with the volume.
static rc_t get_du_statistics (vid_t vid, sm_du_stats_t &du, bool audit=true)
 Analyze a volume and report statistics regarding disk usage.
static rc_t get_du_statistics (const stid_t &stid, sm_du_stats_t &du, bool audit=true)
 Analyze a store and report statistics regarding disk usage.
static rc_t get_volume_meta_stats (vid_t vid, SmVolumeMetaStats &volume_stats, concurrency_t cc=t_cc_none)
 Analyze a volume and collect brief statistics about its usage.
static rc_t get_file_meta_stats (vid_t vid, w_base_t::uint4_t num_files, SmFileMetaStats *file_stats, bool batch_calculate=false, concurrency_t cc=t_cc_none)
 Analyze a volume and collect brief statistics about its usage.
static rc_t vol_root_index (const vid_t &v, stid_t &iid)
 Get the index ID of the root index of the volume.
static rc_t set_store_property (stid_t stid, store_property_t property)
 Change the store property of a file or index.
static rc_t get_store_property (stid_t stid, store_property_t &property)
 Get the store property of a file or index.
static rc_t get_store_info (const stid_t &stid, sm_store_info_t &info)
 Get various store information of a file or index.
static rc_t create_index (vid_t vid, ndx_t ntype, store_property_t property, const char *key_desc, concurrency_t cc, stid_t &stid)
 Create a B+-Tree index.
static rc_t create_index (vid_t vid, ndx_t ntype, store_property_t property, const char *key_desc, stid_t &stid)
 Create a B+-Tree or R*-Tree index.
static rc_t destroy_index (const stid_t &iid)
 Destroy a B+-Tree index.
static rc_t bulkld_index (const stid_t &stid, int nsrcs, const stid_t *source, sm_du_stats_t &stats, bool sort_duplicates=true, bool lexify_keys=true)
 Bulk-load a B+-Tree index from multiple data sources.
static rc_t bulkld_index (const stid_t &stid, const stid_t &source, sm_du_stats_t &stats, bool sort_duplicates=true, bool lexify_keys=true)
 Bulk-load a B+-Tree index from a single data source.
static rc_t bulkld_index (const stid_t &stid, sort_stream_i &sorted_stream, sm_du_stats_t &stats)
 Bulk-load a B+-Tree index from a single data stream.
static rc_t create_assoc (stid_t stid, const vec_t &key, const vec_t &el)
 Create an entry in a B+-Tree index.
static rc_t destroy_assoc (stid_t stid, const vec_t &key, const vec_t &el)
 Remove an entry from a B+-Tree index.
static rc_t destroy_all_assoc (stid_t stid, const vec_t &key, int &num_removed)
 Destroy all entries associated with a key in a B+-Tree index.
static rc_t find_assoc (stid_t stid, const vec_t &key, void *el, smsize_t &elen, bool &found)
 Find an entry associated with a key in a B+-Tree index.
static rc_t create_md_index (vid_t vid, ndx_t ntype, store_property_t property, stid_t &stid, int2_t dim=2)
 Create an R*-Tree (multi-dimensional spatial) index.
static rc_t destroy_md_index (const stid_t &iid)
 Destroy an R*-Tree index.
static rc_t bulkld_md_index (const stid_t &stid, int nsrcs, const stid_t *source, sm_du_stats_t &stats, int2_t hff=75, int2_t hef=120, nbox_t *universe=NULL)
 Bulk-load a multi-dimensional index from multiple sources.
static rc_t bulkld_md_index (const stid_t &stid, const stid_t &source, sm_du_stats_t &stats, int2_t hff=75, int2_t hef=120, nbox_t *universe=NULL)
 Bulk-load a multi-dimensional index from a single source.
static rc_t bulkld_md_index (const stid_t &stid, sort_stream_i &sorted_stream, sm_du_stats_t &stats, int2_t hff=75, int2_t hef=120, nbox_t *universe=NULL)
 Bulk-load a multi-dimensional index from a sorted stream source.
static rc_t find_md_assoc (stid_t stid, const nbox_t &key, void *el, smsize_t &elen, bool &found)
 Look up an entry in a multi-dimensional index.
static rc_t create_md_assoc (stid_t stid, const nbox_t &key, const vec_t &el)
 Create an entry in a multi-dimensional index.
static rc_t destroy_md_assoc (stid_t stid, const nbox_t &key, const vec_t &el)
 Destroy an entry in a multi-dimensional index.
static rc_t rtree_stats (const stid_t &stid, rtree_stats_t &stat, uint2_t size=0, uint2_t *ovp=NULL, bool audit=false)
 Gather usage statistics about an R*-Tree index.
static rc_t create_file (vid_t vid, stid_t &fid, store_property_t property, shpid_t cluster_hint=0)
 Create a file of records.
static rc_t destroy_file (const stid_t &fid)
 Destroy a file of records.
static rc_t create_rec (const stid_t &fid, const vec_t &hdr, smsize_t len_hint, const vec_t &data, rid_t &new_rid)
 Create a new record.
static rc_t destroy_rec (const rid_t &rid)
 Destroy a record.
static rc_t update_rec (const rid_t &rid, smsize_t start, const vec_t &data)
 Modify the body of an existing record.
static rc_t update_rec_hdr (const rid_t &rid, smsize_t start, const vec_t &hdr)
 Modify the header of an existing record.
static rc_t append_rec (const rid_t &rid, const vec_t &data)
 Append bytes to a record body.
static rc_t truncate_rec (const rid_t &rid, smsize_t amount)
 Chop bytes off the end of a record body.
static rc_t truncate_rec (const rid_t &rid, smsize_t amount, bool &should_forward)
 Chop bytes off the end of a record body.
static rc_t sort_file (const stid_t &fid, const stid_t &sorted_fid, int nvids, const vid_t *vid, sort_keys_t &kl, smsize_t min_rec_sz, int run_size, int temp_space)
 Sort a file.
static rc_t lvid_to_vid (const lvid_t &lvid, vid_t &vid)
 Return the short volume ID of a volume.
static rc_t vid_to_lvid (vid_t vid, lvid_t &lvid)
 Return the long volume ID of a volume.
static rc_t lock (const lockid_t &n, lock_mode_t m, lock_duration_t d=t_long, timeout_in_ms timeout=WAIT_SPECIFIED_BY_XCT)
 Acquire a lock.
static rc_t unlock (const lockid_t &n)
 Release a lock.
static rc_t dont_escalate (const lockid_t &n, bool passOnToDescendants=true)
 Disable lock escalation on the given entity.
static rc_t get_escalation_thresholds (w_base_t::int4_t &toPage, w_base_t::int4_t &toStore, w_base_t::int4_t &toVolume)
 Find the storage-manager-wide escalation thresholds

Default values (used for all transactions until they change their per-transaction thresholds) are determined by the storage-manager-wide options. See List of Run-Time Options.

static rc_t set_escalation_thresholds (w_base_t::int4_t toPage, w_base_t::int4_t toStore, w_base_t::int4_t toVolume)
 Change the storage-manager-wide escalation thresholds

Default values (used for all transactions until they change their per-transaction thresholds) are determined by the storage-manager-wide options. See List of Run-Time Options.

static rc_t query_lock (const lockid_t &n, lock_mode_t &m, bool implicit=false)
 Find out if the attached transaction has an entity locked.
static rc_t set_lock_cache_enable (bool enable)
 Control lock caching for attached transaction.
static rc_t lock_cache_enabled (bool &enabled)
 True if lock cache is enabled for the attached transaction.


Member Function Documentation

static rc_t ss_m::log_file_was_archived ( const char *  logfile  )  [static]

Notify storage manager when a log file was archived by a LOG_WARN_CALLBACK_FUNC.

The arguments:

Parameters:
[in] logfile Character string name of file archived.
Examples:
log_exceed.cpp.


The documentation for this class was generated from the following file:
Generated on Wed Jul 7 17:22:43 2010 for Shore Storage Manager by  doxygen 1.4.7