~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to plugin/myisam/myisam_priv.h

This patch completes the first step in the splitting of
the XA resource manager API from the storage engine API,
as outlined in the specification here:

http://drizzle.org/wiki/XaStorageEngine

* Splits plugin::StorageEngine into a base StorageEngine
  class and two derived classes, TransactionalStorageEngine
  and XaStorageEngine.  XaStorageEngine derives from
  TransactionalStorageEngine and creates the XA Resource
  Manager API for storage engines.

  - The methods moved from StorageEngine to TransactionalStorageEngine
    include releaseTemporaryLatches(), startConsistentSnapshot(), 
    commit(), rollback(), setSavepoint(), releaseSavepoint(),
    rollbackToSavepoint() and hasTwoPhaseCommit()
  - The methods moved from StorageEngine to XaStorageEngine
    include recover(), commitXid(), rollbackXid(), and prepare()

* Places all static "EngineVector"s into their proper
  namespaces (typedefs belong in header files, not implementation files)
  and places all static methods corresponding
  to either only transactional engines or only XA engines
  into their respective files in /drizzled/plugin/

* Modifies the InnoDB "handler" files to extend plugin::XaStorageEngine
  and not plugin::StorageEngine

The next step, as outlined in the wiki spec page above, is to isolate
the XA Resource Manager API into its own plugin class and modify
plugin::XaStorageEngine to implement plugin::XaResourceManager via
composition.  This is necessary to enable building plugins which can
participate in an XA transaction *without having to have that plugin
implement the entire storage engine API*

Show diffs side-by-side

added added

removed removed

Lines of Context:
11
11
 
12
12
   You should have received a copy of the GNU General Public License
13
13
   along with this program; if not, write to the Free Software
14
 
   Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA */
 
14
   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA */
15
15
 
16
16
/* This file is included by all internal myisam files */
17
17
 
18
18
#ifndef PLUGIN_MYISAM_MYISAM_PRIV_H
19
19
#define PLUGIN_MYISAM_MYISAM_PRIV_H
20
20
 
21
 
#include <config.h>
22
 
 
 
21
#include "config.h"
23
22
#include "myisam.h"                     /* Structs & some defines */
24
23
#include "myisampack.h"                 /* packing of keys */
25
 
#include <drizzled/tree.h>
26
 
#include <drizzled/internal/my_pthread.h>
 
24
#include "drizzled/my_tree.h"
 
25
#include "drizzled/internal/my_pthread.h"
27
26
#include <drizzled/thr_lock.h>
28
27
#include <drizzled/common.h>
29
 
#include <drizzled/enum.h>
30
28
 
31
29
#include <assert.h>
32
30
#include <fcntl.h>
33
31
#include <string.h>
34
32
#include <list>
35
33
 
36
 
#include <boost/thread/mutex.hpp>
37
 
 
38
34
#if defined(my_write)
39
35
#undef my_write                         /* undef map from my_nosys; We need test-if-disk full */
40
36
#endif
41
37
 
42
 
/* Typical key cash */
43
 
static const uint32_t KEY_CACHE_SIZE= 8*1024*1024;
44
 
 
45
 
/* Default size of a key cache block  */
46
 
static const uint32_t KEY_CACHE_BLOCK_SIZE= 1024;
47
 
 
48
38
typedef struct st_mi_status_info
49
39
{
50
40
  drizzled::ha_rows records;                    /* Rows in table */
187
177
  char  *data_file_name,                /* Resolved path names from symlinks */
188
178
        *index_file_name;
189
179
  unsigned char *file_map;                      /* mem-map of file if possible */
190
 
private:
191
 
  drizzled::KEY_CACHE key_cache;                        /* ref to the current key cache */
192
 
public:
193
 
  drizzled::KEY_CACHE *getKeyCache()
194
 
  {
195
 
    return &key_cache;
196
 
  }
197
 
 
198
 
  void setKeyCache();
199
 
 
 
180
  drizzled::KEY_CACHE *key_cache;                       /* ref to the current key cache */
200
181
  MI_DECODE_TREE *decode_trees;
201
182
  uint16_t *decode_tables;
202
183
  int (*read_record)(struct st_myisam_info*, drizzled::internal::my_off_t, unsigned char*);
214
195
  ulong this_process;                   /* processid */
215
196
  ulong last_process;                   /* For table-change-check */
216
197
  ulong last_version;                   /* Version on start */
217
 
  uint64_t options;                     /* Options used */
 
198
  ulong options;                        /* Options used */
218
199
  ulong min_pack_length;                /* Theese are used by packed data */
219
200
  ulong max_pack_length;
220
201
  ulong state_diff_length;
236
217
    not_flushed,
237
218
    temporary,delay_key_write,
238
219
    concurrent_insert;
 
220
  drizzled::THR_LOCK lock;
 
221
  pthread_mutex_t intern_lock;          /* Locking for use with _locking */
 
222
  pthread_rwlock_t *key_root_lock;
239
223
  drizzled::internal::my_off_t mmaped_length;
240
224
  uint32_t     nonmmaped_inserts;           /* counter of writing in non-mmaped
241
225
                                           area */
 
226
  pthread_rwlock_t mmap_lock;
242
227
} MYISAM_SHARE;
243
228
 
244
229
 
474
459
#define MI_UNIQUE_HASH_TYPE     HA_KEYTYPE_ULONG_INT
475
460
#define mi_unique_store(A,B)    mi_int4store((A),(B))
476
461
 
477
 
extern boost::mutex THR_LOCK_myisam;
 
462
extern pthread_mutex_t THR_LOCK_myisam;
478
463
 
479
464
        /* Some extern variables */
480
465
 
688
673
                                    int file, drizzled::internal::my_off_t filepos);
689
674
extern void _my_store_blob_length(unsigned char *pos,uint32_t pack_length,uint32_t length);
690
675
extern void mi_report_error(int errcode, const char *file_name);
691
 
extern void mi_report_error(drizzled::error_t errcode, const char *file_name);
692
676
extern size_t mi_mmap_pread(MI_INFO *info, unsigned char *Buffer,
693
677
                            size_t Count, drizzled::internal::my_off_t offset, drizzled::myf MyFlags);
694
678
extern size_t mi_mmap_pwrite(MI_INFO *info, const unsigned char *Buffer,
720
704
                           const unsigned char *record, drizzled::internal::my_off_t pos);
721
705
int mi_unique_comp(MI_UNIQUEDEF *def, const unsigned char *a, const unsigned char *b,
722
706
                   bool null_are_equal);
 
707
void mi_get_status(void* param, int concurrent_insert);
 
708
void mi_update_status(void* param);
 
709
void mi_restore_status(void* param);
 
710
void mi_copy_status(void* to,void *from);
 
711
bool mi_check_status(void* param);
723
712
 
724
713
extern MI_INFO *test_if_reopen(char *filename);
725
714
bool check_table_is_closed(const char *name, const char *where);
738
727
void mi_check_print_info(MI_CHECK *param, const char *fmt,...);
739
728
int flush_pending_blocks(MI_SORT_PARAM *param);
740
729
int thr_write_keys(MI_SORT_PARAM *sort_param);
 
730
/* needs extern "C" because we pass it to pthread_create */
 
731
extern "C" pthread_handler_t thr_find_all_keys(void *arg);
741
732
int flush_blocks(MI_CHECK *param, drizzled::KEY_CACHE *key_cache, int file);
742
733
 
743
734
int sort_write_record(MI_SORT_PARAM *sort_param);