summaryrefslogtreecommitdiff
path: root/storage/myisam
diff options
context:
space:
mode:
authorSergei Golubchik <sergii@pisem.net>2014-06-06 00:07:27 +0200
committerSergei Golubchik <sergii@pisem.net>2014-06-06 00:07:27 +0200
commite27c338634739ef56a6888e7948e04c0fa0ba677 (patch)
treead63ccae614f3dd77509825d1905fd815ef322cb /storage/myisam
parent2a5905141a3c509a7c34c3d370fb146dbc1c965f (diff)
parent6d75570e99fbf070cdbeefdfbcfc94d1c7b3ad1f (diff)
downloadmariadb-git-e27c338634739ef56a6888e7948e04c0fa0ba677.tar.gz
5.5.38 merge
Diffstat (limited to 'storage/myisam')
-rw-r--r--storage/myisam/mi_open.c7
-rw-r--r--storage/myisam/myisampack.c11
2 files changed, 12 insertions, 6 deletions
diff --git a/storage/myisam/mi_open.c b/storage/myisam/mi_open.c
index c6af5195f82..060017f10ad 100644
--- a/storage/myisam/mi_open.c
+++ b/storage/myisam/mi_open.c
@@ -475,13 +475,11 @@ MI_INFO *mi_open(const char *name, int mode, uint open_flags)
share->blobs[j].offset=offset;
j++;
}
-#if MYSQL_VERSION_ID <= 60100
- /* This is to detect old checksum option */
+ /* This is to detect how to calculate checksums */
if (share->rec[i].null_bit)
share->has_null_fields= 1;
if (share->rec[i].type == FIELD_VARCHAR)
share->has_varchar_fields= 1;
-#endif
offset+=share->rec[i].length;
}
share->rec[i].type=(int) FIELD_LAST; /* End marker */
@@ -775,7 +773,8 @@ void mi_setup_functions(register MYISAM_SHARE *share)
share->read_record=_mi_read_pack_record;
share->read_rnd=_mi_read_rnd_pack_record;
if ((share->options &
- (HA_OPTION_PACK_RECORD | HA_OPTION_NULL_FIELDS)))
+ (HA_OPTION_PACK_RECORD | HA_OPTION_NULL_FIELDS)) ||
+ share->has_varchar_fields)
share->calc_checksum= mi_checksum;
else
share->calc_checksum= mi_static_checksum;
diff --git a/storage/myisam/myisampack.c b/storage/myisam/myisampack.c
index 8854a85c3d3..966edc877cd 100644
--- a/storage/myisam/myisampack.c
+++ b/storage/myisam/myisampack.c
@@ -417,6 +417,11 @@ static MI_INFO *open_isam_file(char *name,int mode)
if (verbose)
puts("Recompressing already compressed table");
share->options&= ~HA_OPTION_READ_ONLY_DATA; /* We are modifing it */
+
+ /* We want to use the new checksums if we have null fields */
+ if (share->has_null_fields)
+ share->options|= HA_OPTION_NULL_FIELDS;
+
}
if (! force_pack && share->state.state.records != 0 &&
(share->state.state.records <= 1 ||
@@ -2966,7 +2971,8 @@ static int save_state(MI_INFO *isam_file,PACK_MRG_INFO *mrg,my_off_t new_length,
uint key;
DBUG_ENTER("save_state");
- options|= HA_OPTION_COMPRESS_RECORD | HA_OPTION_READ_ONLY_DATA;
+ options|= (HA_OPTION_COMPRESS_RECORD | HA_OPTION_READ_ONLY_DATA |
+ (share->options & HA_OPTION_NULL_FIELDS));
mi_int2store(share->state.header.options,options);
share->state.state.data_file_length=new_length;
@@ -3015,7 +3021,8 @@ static int save_state_mrg(File file,PACK_MRG_INFO *mrg,my_off_t new_length,
state= isam_file->s->state;
options= (mi_uint2korr(state.header.options) | HA_OPTION_COMPRESS_RECORD |
- HA_OPTION_READ_ONLY_DATA);
+ HA_OPTION_READ_ONLY_DATA |
+ (isam_file->s->options & HA_OPTION_NULL_FIELDS));
mi_int2store(state.header.options,options);
state.state.data_file_length=new_length;
state.state.del=0;