Commit 185eefea authored by unknown's avatar unknown

Formailized the row buffer structure, implemented new streaming format.


mysql-test/r/archive.result:
  Added cleanup for additional tables
mysql-test/t/archive.test:
  Added cleanup for additional tables.
storage/archive/ha_archive.cc:
  Rows are now proceeded with length. Added new record buffer structure and methods.
storage/archive/ha_archive.h:
  New structure for buffer
parent b8992fd7
drop table if exists t1,t2,t3; drop table if exists t1,t2,t3,t4,t5;
CREATE TABLE t1 ( CREATE TABLE t1 (
Period smallint(4) unsigned zerofill DEFAULT '0000' NOT NULL, Period smallint(4) unsigned zerofill DEFAULT '0000' NOT NULL,
Varor_period smallint(4) unsigned DEFAULT '0' NOT NULL Varor_period smallint(4) unsigned DEFAULT '0' NOT NULL
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
-- source include/have_binlog_format_mixed_or_statement.inc -- source include/have_binlog_format_mixed_or_statement.inc
--disable_warnings --disable_warnings
drop table if exists t1,t2,t3; drop table if exists t1,t2,t3,t4,t5;
--enable_warnings --enable_warnings
CREATE TABLE t1 ( CREATE TABLE t1 (
......
This diff is collapsed.
...@@ -27,6 +27,12 @@ ...@@ -27,6 +27,12 @@
ha_example.h. ha_example.h.
*/ */
typedef struct st_archive_record_buffer {
byte *buffer;
int length;
} archive_record_buffer;
typedef struct st_archive_share { typedef struct st_archive_share {
char *table_name; char *table_name;
char data_file_name[FN_REFLEN]; char data_file_name[FN_REFLEN];
...@@ -43,18 +49,23 @@ typedef struct st_archive_share { ...@@ -43,18 +49,23 @@ typedef struct st_archive_share {
ulonglong forced_flushes; ulonglong forced_flushes;
ulonglong mean_rec_length; ulonglong mean_rec_length;
char real_path[FN_REFLEN]; char real_path[FN_REFLEN];
uint meta_version;
uint data_version;
} ARCHIVE_SHARE; } ARCHIVE_SHARE;
/* /*
Version for file format. Version for file format.
1 - Initial Version 1 - Initial Version (Never Released)
2 - Stream Compression, seperate blobs, no packing
3 - One steam (row and blobs), with packing
*/ */
#define ARCHIVE_VERSION 2 #define ARCHIVE_VERSION 3
class ha_archive: public handler class ha_archive: public handler
{ {
THR_LOCK_DATA lock; /* MySQL lock */ THR_LOCK_DATA lock; /* MySQL lock */
ARCHIVE_SHARE *share; /* Shared lock info */ ARCHIVE_SHARE *share; /* Shared lock info */
azio_stream archive; /* Archive file we are working with */ azio_stream archive; /* Archive file we are working with */
my_off_t current_position; /* The position of the row we just read */ my_off_t current_position; /* The position of the row we just read */
byte byte_buffer[IO_SIZE]; /* Initial buffer for our string */ byte byte_buffer[IO_SIZE]; /* Initial buffer for our string */
...@@ -65,6 +76,10 @@ class ha_archive: public handler ...@@ -65,6 +76,10 @@ class ha_archive: public handler
const byte *current_key; const byte *current_key;
uint current_key_len; uint current_key_len;
uint current_k_offset; uint current_k_offset;
archive_record_buffer *record_buffer;
archive_record_buffer *create_record_buffer(ulonglong length);
void destroy_record_buffer(archive_record_buffer *r);
public: public:
ha_archive(handlerton *hton, TABLE_SHARE *table_arg); ha_archive(handlerton *hton, TABLE_SHARE *table_arg);
...@@ -105,7 +120,10 @@ class ha_archive: public handler ...@@ -105,7 +120,10 @@ class ha_archive: public handler
int rnd_next(byte *buf); int rnd_next(byte *buf);
int rnd_pos(byte * buf, byte *pos); int rnd_pos(byte * buf, byte *pos);
int get_row(azio_stream *file_to_read, byte *buf); int get_row(azio_stream *file_to_read, byte *buf);
int get_row_version2(azio_stream *file_to_read, byte *buf);
int get_row_version3(azio_stream *file_to_read, byte *buf);
int read_meta_file(File meta_file, ha_rows *rows, int read_meta_file(File meta_file, ha_rows *rows,
uint *meta_version,
ulonglong *auto_increment, ulonglong *auto_increment,
ulonglong *forced_flushes, ulonglong *forced_flushes,
char *real_path); char *real_path);
...@@ -137,5 +155,9 @@ class ha_archive: public handler ...@@ -137,5 +155,9 @@ class ha_archive: public handler
bool is_crashed() const; bool is_crashed() const;
int check(THD* thd, HA_CHECK_OPT* check_opt); int check(THD* thd, HA_CHECK_OPT* check_opt);
bool check_and_repair(THD *thd); bool check_and_repair(THD *thd);
int max_row_length(const byte *buf);
bool fix_rec_buff(int length);
int unpack_row(azio_stream *file_to_read, char *record);
int pack_row(const byte *record);
}; };
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment