summaryrefslogtreecommitdiff
path: root/storage
diff options
context:
space:
mode:
authorunknown <brian@zim.(none)>2006-08-14 15:24:29 -0700
committerunknown <brian@zim.(none)>2006-08-14 15:24:29 -0700
commit948a89432738e4d3b9c4d2f8287573f97e81ecb3 (patch)
tree2e163bcaefab8eeba55ac25ca6707e3181740da8 /storage
parent45a5ca85f35d1c13528140b449a27d6b2a47d09d (diff)
parent61d5563ba413c18b2674e97016093c082b9918d0 (diff)
downloadmariadb-git-948a89432738e4d3b9c4d2f8287573f97e81ecb3.tar.gz
Merge zim.(none):/home/brian/mysql/dep-5.0
into zim.(none):/home/brian/mysql/dep-5.1 client/mysql.cc: Auto merged mysql-test/r/grant.result: Auto merged mysql-test/r/grant2.result: Auto merged mysql-test/r/heap_btree.result: Auto merged mysql-test/t/grant.test: Auto merged mysql-test/t/grant2.test: Auto merged mysql-test/t/mysqlbinlog.test: Auto merged mysql-test/t/repair.test: Auto merged scripts/fill_func_tables.sh: Auto merged scripts/mysql_install_db.sh: Auto merged sql/field.cc: Auto merged sql/field.h: Auto merged sql/mysqld.cc: Auto merged sql/set_var.cc: Auto merged sql/sql_update.cc: Auto merged storage/heap/hp_delete.c: Auto merged storage/myisam/mi_update.c: Auto merged storage/myisam/sort.c: Auto merged mysql-test/r/mysqldump.result: Fixing Result mysql-test/r/repair.result: Fixing result mysql-test/t/mysqldump.test: Merging change storage/archive/ha_archive.cc: Merging in change
Diffstat (limited to 'storage')
-rw-r--r--storage/archive/ha_archive.cc22
-rw-r--r--storage/heap/hp_delete.c3
-rw-r--r--storage/myisam/mi_update.c12
-rw-r--r--storage/myisam/sort.c12
4 files changed, 41 insertions, 8 deletions
diff --git a/storage/archive/ha_archive.cc b/storage/archive/ha_archive.cc
index 6c0796e3bdc..de8b50fd2f3 100644
--- a/storage/archive/ha_archive.cc
+++ b/storage/archive/ha_archive.cc
@@ -901,6 +901,28 @@ int ha_archive::write_row(byte *buf)
if (init_archive_writer())
DBUG_RETURN(HA_ERR_CRASHED_ON_USAGE);
+ /*
+ Varchar structures are constant in size but are not cleaned up request
+ to request. The following sets all unused space to null to improve
+ compression.
+ */
+ for (Field **field=table->field ; *field ; field++)
+ {
+ DBUG_PRINT("archive",("Pack is %d\n", (*field)->pack_length()));
+ DBUG_PRINT("archive",("MyPack is %d\n", (*field)->data_length((char*) buf + (*field)->offset())));
+ if ((*field)->real_type() == MYSQL_TYPE_VARCHAR)
+ {
+ uint actual_length= (*field)->data_length((char*) buf + (*field)->offset());
+ uint offset= (*field)->offset() + actual_length +
+ (actual_length > 255 ? 2 : 1);
+ DBUG_PRINT("archive",("Offset is %d -> %d\n", actual_length, offset));
+ /*
+ if ((*field)->pack_length() + (*field)->offset() != offset)
+ bzero(buf + offset, (size_t)((*field)->pack_length() + (actual_length > 255 ? 2 : 1) - (*field)->data_length));
+ */
+ }
+ }
+
share->rows_recorded++;
rc= real_write_row(buf, &(share->archive_write));
error:
diff --git a/storage/heap/hp_delete.c b/storage/heap/hp_delete.c
index f37db2588f3..f18c5e7054c 100644
--- a/storage/heap/hp_delete.c
+++ b/storage/heap/hp_delete.c
@@ -73,7 +73,10 @@ int hp_rb_delete_key(HP_INFO *info, register HP_KEYDEF *keyinfo,
int res;
if (flag)
+ {
info->last_pos= NULL; /* For heap_rnext/heap_rprev */
+ info->lastkey_len= 0;
+ }
custom_arg.keyseg= keyinfo->seg;
custom_arg.key_length= hp_rb_make_key(keyinfo, info->recbuf, record, recpos);
diff --git a/storage/myisam/mi_update.c b/storage/myisam/mi_update.c
index f8b5cf55406..9ddda3f5ea9 100644
--- a/storage/myisam/mi_update.c
+++ b/storage/myisam/mi_update.c
@@ -172,7 +172,17 @@ int mi_update(register MI_INFO *info, const byte *oldrec, byte *newrec)
info->update= (HA_STATE_CHANGED | HA_STATE_ROW_CHANGED | HA_STATE_AKTIV |
key_changed);
myisam_log_record(MI_LOG_UPDATE,info,newrec,info->lastpos,0);
- VOID(_mi_writeinfo(info,key_changed ? WRITEINFO_UPDATE_KEYFILE : 0));
+ /*
+ Every myisam function that updates myisam table must end with
+ call to _mi_writeinfo(). If operation (second param of
+ _mi_writeinfo()) is not 0 it sets share->changed to 1, that is
+ flags that data has changed. If operation is 0, this function
+ equals to no-op in this case.
+
+ mi_update() must always pass !0 value as operation, since even if
+ there is no index change there could be data change.
+ */
+ VOID(_mi_writeinfo(info, WRITEINFO_UPDATE_KEYFILE));
allow_break(); /* Allow SIGHUP & SIGINT */
if (info->invalidator != 0)
{
diff --git a/storage/myisam/sort.c b/storage/myisam/sort.c
index 44e7e8b464e..099c3173396 100644
--- a/storage/myisam/sort.c
+++ b/storage/myisam/sort.c
@@ -484,13 +484,6 @@ int thr_write_keys(MI_SORT_PARAM *sort_param)
if (!got_error)
{
mi_set_key_active(share->state.key_map, sinfo->key);
- if (param->testflag & T_STATISTICS)
- update_key_parts(sinfo->keyinfo, rec_per_key_part, sinfo->unique,
- param->stats_method == MI_STATS_METHOD_IGNORE_NULLS?
- sinfo->notnull: NULL,
- (ulonglong) info->state->records);
-
-
if (!sinfo->buffpek.elements)
{
if (param->testflag & T_VERBOSE)
@@ -502,6 +495,11 @@ int thr_write_keys(MI_SORT_PARAM *sort_param)
flush_ft_buf(sinfo) || flush_pending_blocks(sinfo))
got_error=1;
}
+ if (!got_error && param->testflag & T_STATISTICS)
+ update_key_parts(sinfo->keyinfo, rec_per_key_part, sinfo->unique,
+ param->stats_method == MI_STATS_METHOD_IGNORE_NULLS?
+ sinfo->notnull: NULL,
+ (ulonglong) info->state->records);
}
my_free((gptr) sinfo->sort_keys,MYF(0));
my_free(mi_get_rec_buff_ptr(info, sinfo->rec_buff),