summaryrefslogtreecommitdiff
path: root/storage/csv/ha_tina.h
diff options
context:
space:
mode:
authorunknown <petr@mysql.com>2006-03-13 19:36:34 +0300
committerunknown <petr@mysql.com>2006-03-13 19:36:34 +0300
commitecba6dc67bfd8f837fb76d63e0c15d9988ca1c86 (patch)
tree16df6bda76911bdd1dae072cff2c449de65a4318 /storage/csv/ha_tina.h
parent7e2a9aa45938da567035af4f54e731f4a69c8e8e (diff)
downloadmariadb-git-ecba6dc67bfd8f837fb76d63e0c15d9988ca1c86.tar.gz
WL#3154 "Enable REPAIR for CSV tables".
This is the first commit. Cleanups are likely to follow after the merge. mysql-test/r/csv.result: update result mysql-test/t/csv.test: add tests for CSV REPAIR/RESTORE. storage/csv/ha_tina.cc: add repair/check and a meta-file processing for it storage/csv/ha_tina.h: add new functions required for tina repair/check
Diffstat (limited to 'storage/csv/ha_tina.h')
-rw-r--r--storage/csv/ha_tina.h22
1 files changed, 21 insertions, 1 deletions
diff --git a/storage/csv/ha_tina.h b/storage/csv/ha_tina.h
index 572d05cb779..ab02ce67aff 100644
--- a/storage/csv/ha_tina.h
+++ b/storage/csv/ha_tina.h
@@ -19,9 +19,16 @@
#include <my_dir.h>
#define DEFAULT_CHAIN_LENGTH 512
+/*
+ Version for file format.
+ 1 - Initial Version. That is, the version when the metafile was introduced.
+*/
+
+#define TINA_VERSION 1
typedef struct st_tina_share {
char *table_name;
+ char data_file_name[FN_REFLEN];
byte *mapped_file; /* mapped region of file */
uint table_name_length, use_count;
/*
@@ -39,6 +46,9 @@ typedef struct st_tina_share {
off_t saved_data_file_length;
pthread_mutex_t mutex;
THR_LOCK lock;
+ File meta_file; /* Meta file we use */
+ bool crashed; /* Meta file is crashed */
+ ha_rows rows_recorded; /* Number of rows in tables */
} TINA_SHARE;
typedef struct tina_set {
@@ -108,7 +118,7 @@ public:
ulong type, TABLE *table,
uint count,
bool called_by_logger_thread);
- int open(const char *name, int mode, uint test_if_locked);
+ int open(const char *name, int mode, uint open_options);
int close(void);
int write_row(byte * buf);
int update_row(const byte * old_data, byte * new_data);
@@ -116,7 +126,17 @@ public:
int rnd_init(bool scan=1);
int rnd_next(byte *buf);
int rnd_pos(byte * buf, byte *pos);
+ bool check_and_repair(THD *thd);
+ int check(THD* thd, HA_CHECK_OPT* check_opt);
+ bool is_crashed() const;
+ int read_meta_file(File meta_file, ha_rows *rows);
+ int write_meta_file(File meta_file, ha_rows rows, bool dirty);
+ TINA_SHARE *get_share(const char *table_name, TABLE *table, int *rc);
+ int free_share(TINA_SHARE *share);
int rnd_end();
+ int repair(THD* thd, HA_CHECK_OPT* check_opt);
+ /* This is required for SQL layer to know that we support autorepair */
+ bool auto_repair() const { return 1; }
void position(const byte *record);
void info(uint);
int extra(enum ha_extra_function operation);