sm_int_3.h

00001 /*<std-header orig-src='shore' incl-file-exclusion='SM_INT_3_H'>
00002 
00003  $Id: sm_int_3.h,v 1.10 2010/05/26 01:20:43 nhall Exp $
00004 
00005 SHORE -- Scalable Heterogeneous Object REpository
00006 
00007 Copyright (c) 1994-99 Computer Sciences Department, University of
00008                       Wisconsin -- Madison
00009 All Rights Reserved.
00010 
00011 Permission to use, copy, modify and distribute this software and its
00012 documentation is hereby granted, provided that both the copyright
00013 notice and this permission notice appear in all copies of the
00014 software, derivative works or modified versions, and any portions
00015 thereof, and that both notices appear in supporting documentation.
00016 
00017 THE AUTHORS AND THE COMPUTER SCIENCES DEPARTMENT OF THE UNIVERSITY
00018 OF WISCONSIN - MADISON ALLOW FREE USE OF THIS SOFTWARE IN ITS
00019 "AS IS" CONDITION, AND THEY DISCLAIM ANY LIABILITY OF ANY KIND
00020 FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
00021 
00022 This software was developed with support by the Advanced Research
00023 Project Agency, ARPA order number 018 (formerly 8230), monitored by
00024 the U.S. Army Research Laboratory under contract DAAB07-91-C-Q518.
00025 Further funding for this work was provided by DARPA through
00026 Rome Research Laboratory Contract No. F30602-97-2-0247.
00027 
00028 */
00029 
00030 #ifndef SM_INT_3_H
00031 #define SM_INT_3_H
00032 
00033 #include "w_defines.h"
00034 
00035 /*  -- do not edit anything above this line --   </std-header>*/
00036 
00037 #if defined(SM_SOURCE) && !defined(SM_LEVEL)
00038 #    define SM_LEVEL 3
00039 #endif
00040 
00041 #ifndef SM_INT_2_H
00042 #include "sm_int_2.h"
00043 #endif
00044 
00045 class dir_m;
00046 
00047 /**\cond skip */
00048 class smlevel_3 : public smlevel_2 {
00049 public:
00050 /**\endcond  skip */
00051     /**\brief Store property that controls logging of pages in the store.
00052      * \ingroup SSMSTORE
00053      * \details
00054      * - t_regular: All pages in the store are fully logged for ACID properties.
00055      * - t_temporary: Structural changes to the store are guaranteed by
00056      *             logging but user data are not.   In the case of indexes,
00057      *             the ihtegrity of the index is not guaranteed: only the
00058      *             integrity of the store is guaranteed. In the event of
00059      *             abort, the index must be destroyed.
00060      *             Temporary stores are destroyed when a volume is mounted or
00061      *             dismounted, so they do not survive restart, regardless
00062      *             whether a crash occurred.
00063      * - t_load_file: A store that is created with this property starts out
00064      *             as a t_tempory store and is converted to a t_regular
00065      *             store upon commit.
00066      * - t_insert_file: Updates to existing pages are fully logged (as if the
00067      *             store were t_regular), but pages allocated while the 
00068      *             store has t_insert_file are not logged. This is useful for
00069      *             bulk-loading, e.g., a store is bulk-loaded in one 
00070      *             transaction (t_load_file), which commits (now the file is
00071      *             t_regular); subsequent appends to the file would incur
00072      *             full logging, so the subsequent transaction can change the
00073      *             store's property to t_insert_file, append the data, 
00074      *             and change the store's property back to t_regular.
00075      *
00076      * \verbatim
00077      * ------------------------------------------------------------
00078      * ------------------------------------------------------------
00079      * Permissible uses of store property by storage manager client:
00080      * ------------------------------------------------------------
00081      * Create a btree index: | Change it to:
00082      *    t_tmp NO
00083      *    t_load_file YES    | tmp NO load_file NO insert_file NO regular YES
00084      *    t_insert_file YES  | tmp NO load_file NO insert_file YES regular YES
00085      *    t_regular YES      | tmp NO load_file NO insert_file NO regular YES
00086      *
00087      * Create an rtree index:
00088      *    t_tmp YES          | tmp NO load_file NO insert_file NO regular YES
00089      *    t_load_file YES    | tmp NO load_file NO insert_file NO regular YES
00090      *    t_insert_file YES  | tmp NO load_file NO insert_file YES regular YES
00091      *    t_regular YES      | tmp NO load_file NO insert_file NO regular YES
00092      *
00093      * Create a file:        | Change it to:
00094      *    t_tmp YES          | tmp NO load_file NO insert_file YES regular YES
00095      *    t_load_file YES    | tmp NO load_file NO insert_file YES regular YES
00096      *    t_insert_file YES  | tmp NO load_file NO insert_file YES regular YES
00097      *    t_regular YES      | tmp NO load_file NO insert_file YES regular YES
00098      * ------------------------------------------------------------
00099      * Effects of changing a file to regular:
00100      *    This causes the buffer pool to 
00101      *    force to disk all dirty pages for the store, and 
00102      *    to discard (evict from the buffer pool) all the store's 
00103      *    pages, clean or dirty.  When these pages are next read 
00104      *    into the buffer pool, they will be tagged as regular. 
00105      * ------------------------------------------------------------
00106      * Effects of commit:
00107      *    t_tmp              remains t_tmp  
00108      *    t_load_file        store is t_regular**
00109      *    t_insert_file      store is t_regular**
00110      *    t_regular          ACID
00111      *          ** Upon creation of such a store, the storage manager pushes
00112      *          this store on a list to traverse and convert to regular
00113      *          upon commit.
00114      *          Upon changing a store's property to t_insert_file,
00115      *          the storage manager pushes the store on this same list. 
00116      * ------------------------------------------------------------
00117      * Effects of abort on user data:
00118      *    t_tmp              undefined: client must remove store
00119      *    t_load_file        undefined: client must remove store
00120      *    t_insert_file      undefined: client must remove store
00121      *    t_regular          ACID
00122      * ------------------------------------------------------------
00123      * Effects of dismount/mount/restart:
00124      *    t_tmp              store removed
00125      *    t_load_file        undefined if not commited
00126      *    t_insert_file      undefined if not commited
00127      *    t_regular          ACID
00128      * ------------------------------------------------------------
00129      * \endverbatim
00130      */
00131     enum sm_store_property_t {
00132     // NB: this had better match store_flag_t!!! (sm_base.h)
00133     t_regular     = 0x1,
00134 
00135     /// allowed only in create
00136     t_temporary    = 0x2,
00137 
00138     /// allowed only in create, these files start out
00139     /// as temp and are converted to regular on commit
00140     t_load_file    = 0x4,    
00141 
00142     /// current pages logged, new pages not logged
00143     /// EX lock is acquired on file.
00144     /// only valid with a normal file, not indices.
00145     t_insert_file = 0x08,    
00146 
00147     t_bad_storeproperty = 0x80// no bits in common with good properties
00148     };
00149 /**\cond skip */
00150     static dir_m*    dir;
00151 };
00152 /**\endcond  skip */
00153 
00154 ostream&
00155 operator<<(ostream& o, smlevel_3::sm_store_property_t p);
00156 
00157 #if (SM_LEVEL >= 3)
00158 #    include <dir.h>
00159 #endif
00160 
00161 /*<std-footer incl-file-exclusion='SM_INT_3_H'>  -- do not edit anything below this line -- */
00162 
00163 #endif          /*</std-footer>*/

Generated on Wed Jul 7 17:22:32 2010 for Shore Storage Manager by  doxygen 1.4.7