Commit 8c2c5767 authored by unknown's avatar unknown

Final cleanup for new archive internal format. All new headers work.


storage/archive/archive_reader.c:
  Added version bit to solve the issue of hitting old archive files when reading them.
storage/archive/azio.c:
  Set the compression back on.
storage/archive/ha_archive.cc:
  Cleaned up memory allocation ( a bit more logical and less tricky ).
  Fixed bug in not setting autoincrement correctly and cleaned up memory usage for optimize
storage/archive/ha_archive.h:
  Clean up.
parent eb7cd8bd
...@@ -26,12 +26,15 @@ int main(int argc, char *argv[]) ...@@ -26,12 +26,15 @@ int main(int argc, char *argv[])
printf("Version :%u\n", reader_handle.version); printf("Version :%u\n", reader_handle.version);
printf("Start position :%llu\n", (unsigned long long)reader_handle.start); printf("Start position :%llu\n", (unsigned long long)reader_handle.start);
printf("Block size :%u\n", reader_handle.block_size); if (reader_handle.version > 2)
printf("Rows: %llu\n", reader_handle.rows); {
printf("Autoincrement: %llu\n", reader_handle.auto_increment); printf("Block size :%u\n", reader_handle.block_size);
printf("Check Point: %llu\n", reader_handle.check_point); printf("Rows: %llu\n", reader_handle.rows);
printf("Forced Flushes: %llu\n", reader_handle.forced_flushes); printf("Autoincrement: %llu\n", reader_handle.auto_increment);
printf("State: %s\n", ( reader_handle.dirty ? "dirty" : "clean")); printf("Check Point: %llu\n", reader_handle.check_point);
printf("Forced Flushes: %llu\n", reader_handle.forced_flushes);
printf("State: %s\n", ( reader_handle.dirty ? "dirty" : "clean"));
}
azclose(&reader_handle); azclose(&reader_handle);
......
...@@ -49,7 +49,7 @@ void read_header(azio_stream *s, unsigned char *buffer); ...@@ -49,7 +49,7 @@ void read_header(azio_stream *s, unsigned char *buffer);
int az_open (azio_stream *s, const char *path, int Flags, File fd) int az_open (azio_stream *s, const char *path, int Flags, File fd)
{ {
int err; int err;
int level = Z_NO_COMPRESSION; /* Z_DEFAULT_COMPRESSION;*/ /* compression level */ int level = Z_DEFAULT_COMPRESSION; /* compression level */
int strategy = Z_DEFAULT_STRATEGY; /* compression strategy */ int strategy = Z_DEFAULT_STRATEGY; /* compression strategy */
s->stream.zalloc = (alloc_func)0; s->stream.zalloc = (alloc_func)0;
...@@ -165,7 +165,6 @@ void write_header(azio_stream *s) ...@@ -165,7 +165,6 @@ void write_header(azio_stream *s)
int4store(ptr + AZ_FRM_POS, 0); /* FRM Block */ int4store(ptr + AZ_FRM_POS, 0); /* FRM Block */
int4store(ptr + AZ_META_POS, 0); /* Meta Block */ int4store(ptr + AZ_META_POS, 0); /* Meta Block */
int8store(ptr + AZ_START_POS, (unsigned long long)s->start); /* Start of Data Block Index Block */ int8store(ptr + AZ_START_POS, (unsigned long long)s->start); /* Start of Data Block Index Block */
printf("ROWS %llu\n", s->rows);
int8store(ptr + AZ_ROW_POS, (unsigned long long)s->rows); /* Start of Data Block Index Block */ int8store(ptr + AZ_ROW_POS, (unsigned long long)s->rows); /* Start of Data Block Index Block */
int8store(ptr + AZ_FLUSH_POS, (unsigned long long)s->forced_flushes); /* Start of Data Block Index Block */ int8store(ptr + AZ_FLUSH_POS, (unsigned long long)s->forced_flushes); /* Start of Data Block Index Block */
int8store(ptr + AZ_CHECK_POS, (unsigned long long)s->check_point); /* Start of Data Block Index Block */ int8store(ptr + AZ_CHECK_POS, (unsigned long long)s->check_point); /* Start of Data Block Index Block */
......
This diff is collapsed.
...@@ -28,7 +28,7 @@ ...@@ -28,7 +28,7 @@
typedef struct st_archive_record_buffer { typedef struct st_archive_record_buffer {
byte *buffer; byte *buffer;
int length; uint32 length;
} archive_record_buffer; } archive_record_buffer;
...@@ -71,7 +71,7 @@ class ha_archive: public handler ...@@ -71,7 +71,7 @@ class ha_archive: public handler
uint current_k_offset; uint current_k_offset;
archive_record_buffer *record_buffer; archive_record_buffer *record_buffer;
archive_record_buffer *create_record_buffer(ulonglong length); archive_record_buffer *create_record_buffer(unsigned int length);
void destroy_record_buffer(archive_record_buffer *r); void destroy_record_buffer(archive_record_buffer *r);
public: public:
...@@ -137,9 +137,9 @@ public: ...@@ -137,9 +137,9 @@ public:
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); uint32 max_row_length(const byte *buf);
bool fix_rec_buff(int length); bool fix_rec_buff(unsigned int length);
int unpack_row(azio_stream *file_to_read, char *record); int unpack_row(azio_stream *file_to_read, char *record);
unsigned int pack_row(const byte *record); unsigned int pack_row(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