diff options
author | Sergei Golubchik <sergii@pisem.net> | 2013-04-09 16:18:33 +0200 |
---|---|---|
committer | Sergei Golubchik <sergii@pisem.net> | 2013-04-09 16:18:33 +0200 |
commit | 02c712aa546df8d6e9c285e6adc95309925673e3 (patch) | |
tree | 8d6654dac2666dcd738db1f10dbd919610087795 /storage/archive/azio.c | |
parent | f6168bb67bb5cab0584809c876c674a92051b5d1 (diff) | |
download | mariadb-git-02c712aa546df8d6e9c285e6adc95309925673e3.tar.gz |
* frm extra2 segment.
* persistent table versions in the extra2
* ha_archive::frm_compare using TABLE_SHARE::tabledef_version
* distinguish between "important" and "optional" extra2 frm values
* write engine-defined attributes (aka "table options") to extra2, not to extra,
but still read from the old location, if they're found there.
Diffstat (limited to 'storage/archive/azio.c')
-rw-r--r-- | storage/archive/azio.c | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/storage/archive/azio.c b/storage/archive/azio.c index c6058af2e3d..4519d15cefc 100644 --- a/storage/archive/azio.c +++ b/storage/archive/azio.c @@ -364,6 +364,8 @@ void read_header(azio_stream *s, unsigned char *buffer) { if (buffer[0] == az_magic[0] && buffer[1] == az_magic[1]) { + uchar tmp[AZ_FRMVER_LEN + 2]; + s->version= (unsigned int)buffer[AZ_VERSION_POS]; s->minor_version= (unsigned int)buffer[AZ_MINOR_VERSION_POS]; s->block_size= 1024 * buffer[AZ_BLOCK_POS]; @@ -379,6 +381,22 @@ void read_header(azio_stream *s, unsigned char *buffer) s->comment_start_pos= (unsigned int)uint4korr(buffer + AZ_COMMENT_POS); s->comment_length= (unsigned int)uint4korr(buffer + AZ_COMMENT_LENGTH_POS); s->dirty= (unsigned int)buffer[AZ_DIRTY_POS]; + + /* + we'll hard-code the current frm format for now, to avoid + changing archive table versions. + */ + if (s->frm_length == 0 || + my_pread(s->file, tmp, sizeof(tmp), s->frm_start_pos + 64, MYF(MY_NABP)) || + tmp[0] != 0 || tmp[1] != AZ_FRMVER_LEN) + { + s->frmver_length= 0; + } + else + { + s->frmver_length= tmp[1]; + memcpy(s->frmver, tmp+2, s->frmver_length); + } } else if (buffer[0] == gz_magic[0] && buffer[1] == gz_magic[1]) { |