~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to plugin/archive/ha_archive.h

  • Committer: Jay Pipes
  • Date: 2010-03-09 20:02:29 UTC
  • mto: This revision was merged to the branch mainline in revision 1339.
  • Revision ID: jpipes@serialcoder-20100309200229-dfrliy4fads9vyf4
Fixes Bug #535296 by only incrementing ha_commit_count when its a normal transaction commit.

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
#ifndef PLUGIN_ARCHIVE_HA_ARCHIVE_H
17
17
#define PLUGIN_ARCHIVE_HA_ARCHIVE_H
22
22
  ha_example.h.
23
23
*/
24
24
 
 
25
typedef struct st_archive_record_buffer {
 
26
  unsigned char *buffer;
 
27
  uint32_t length;
 
28
} archive_record_buffer;
 
29
 
 
30
 
25
31
class ArchiveShare {
26
32
public:
27
33
  ArchiveShare();
31
37
  bool prime(uint64_t *auto_increment);
32
38
 
33
39
  std::string table_name;
34
 
  std::string data_file_name;
 
40
  char data_file_name[FN_REFLEN];
35
41
  uint32_t use_count;
36
 
  pthread_mutex_t _mutex;
37
 
  drizzled::THR_LOCK _lock;
 
42
  pthread_mutex_t mutex;
 
43
  drizzled::THR_LOCK lock;
38
44
  azio_stream archive_write;     /* Archive file we are working with */
39
45
  bool archive_write_open;
40
46
  bool dirty;               /* Flag for if a flush should occur */
44
50
  uint64_t  version;
45
51
  drizzled::ha_rows rows_recorded;    /* Number of rows in tables */
46
52
  drizzled::ha_rows version_rows;
47
 
 
48
 
  pthread_mutex_t &mutex()
49
 
  {
50
 
    return _mutex;
51
 
  }
52
53
};
53
54
 
54
55
/*
74
75
  const unsigned char *current_key;
75
76
  uint32_t current_key_len;
76
77
  uint32_t current_k_offset;
77
 
  std::vector <unsigned char> record_buffer;
 
78
  archive_record_buffer *record_buffer;
78
79
  bool archive_reader_open;
79
80
 
 
81
  archive_record_buffer *create_record_buffer(unsigned int length);
 
82
  void destroy_record_buffer(archive_record_buffer *r);
 
83
 
80
84
public:
81
85
  ha_archive(drizzled::plugin::StorageEngine &engine_arg,
82
 
             drizzled::Table &table_arg);
 
86
             drizzled::TableShare &table_arg);
83
87
  ~ha_archive()
84
88
  { }
85
89
 
88
92
  void get_auto_increment(uint64_t, uint64_t, uint64_t,
89
93
                          uint64_t *first_value, uint64_t *nb_reserved_values);
90
94
  drizzled::ha_rows records() { return share->rows_recorded; }
91
 
  int doStartIndexScan(uint32_t keynr, bool sorted);
 
95
  int index_init(uint32_t keynr, bool sorted);
92
96
  virtual int index_read(unsigned char * buf, const unsigned char * key,
93
97
                         uint32_t key_len,
94
98
                         drizzled::ha_rkey_function find_flag);
 
99
  virtual int index_read_idx(unsigned char * buf, uint32_t index,
 
100
                             const unsigned char * key,
 
101
                             uint32_t key_len,
 
102
                             drizzled::ha_rkey_function find_flag);
95
103
  int index_next(unsigned char * buf);
96
 
  int doOpen(const drizzled::identifier::Table &identifier, int mode, uint32_t test_if_locked);
97
104
  int open(const char *name, int mode, uint32_t test_if_locked);
98
105
  int close(void);
99
 
  int doInsertRecord(unsigned char * buf);
 
106
  int write_row(unsigned char * buf);
100
107
  int real_write_row(unsigned char *buf, azio_stream *writer);
101
108
  int delete_all_rows();
102
 
  int doStartTableScan(bool scan=1);
 
109
  int rnd_init(bool scan=1);
103
110
  int rnd_next(unsigned char *buf);
104
111
  int rnd_pos(unsigned char * buf, unsigned char *pos);
105
112
  ArchiveShare *get_share(const char *table_name, int *rc);
118
125
public:
119
126
  void start_bulk_insert(drizzled::ha_rows rows);
120
127
  int end_bulk_insert();
121
 
 
 
128
  enum drizzled::row_type get_row_type() const
 
129
  {
 
130
    return drizzled::ROW_TYPE_COMPRESSED;
 
131
  }
122
132
  drizzled::THR_LOCK_DATA **store_lock(drizzled::Session *session,
123
133
                                       drizzled::THR_LOCK_DATA **to,
124
134
                                       drizzled::thr_lock_type lock_type);