From 3411bfe05a2a77c6c5b9911237792eb436f16543 Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 1 Mar 2007 18:23:58 +0100 Subject: merge from MyISAM into Maria (last step of merge of 5.1 into Maria). Tests: "maria" and "ps_maria" fail like before merge (assertions), "ma_test_all" fails like before merge (ma_test2 segfaults, I'll try to find out why). mysys/mf_pagecache.c: using a more distinctive tag storage/maria/ha_maria.cc: merge from MyISAM into Maria storage/maria/ma_check.c: merge from MyISAM into Maria storage/maria/ma_close.c: TODO as a word storage/maria/ma_create.c: merge from MyISAM into Maria storage/maria/ma_delete_all.c: TODO as a word storage/maria/ma_delete_table.c: TODO as a word storage/maria/ma_dynrec.c: merge from MyISAM into Maria storage/maria/ma_extra.c: merge from MyISAM into Maria storage/maria/ma_ft_boolean_search.c: merge from MyISAM into Maria storage/maria/ma_locking.c: merge from MyISAM into Maria storage/maria/ma_loghandler.c: fix for compiler warning storage/maria/ma_open.c: merge from MyISAM into Maria. I will ask Monty to check the ASKMONTY-marked piece of code. storage/maria/ma_packrec.c: merge from MyISAM into Maria storage/maria/ma_range.c: merge from MyISAM into Maria storage/maria/ma_rename.c: TODO as a word storage/maria/ma_rt_index.c: merge from MyISAM into Maria storage/maria/ma_rt_split.c: merge from MyISAM into Maria storage/maria/ma_search.c: merge from MyISAM into Maria storage/maria/ma_sort.c: merge from MyISAM into Maria storage/maria/ma_update.c: merge from MyISAM into Maria storage/maria/ma_write.c: merge from MyISAM into Maria storage/maria/maria_chk.c: merge from MyISAM into Maria storage/maria/maria_def.h: merge from MyISAM into Maria storage/maria/maria_pack.c: merge from MyISAM into Maria storage/maria/unittest/ma_test_loghandler_pagecache-t.c: fix for compiler warning storage/myisam/ha_myisam.cc: merge from MyISAM into Maria storage/myisammrg/ha_myisammrg.cc: merge from MyISAM into Maria --- storage/maria/ma_dynrec.c | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) (limited to 'storage/maria/ma_dynrec.c') diff --git a/storage/maria/ma_dynrec.c b/storage/maria/ma_dynrec.c index c3d0bf1fb0a..52780ab4f6f 100644 --- a/storage/maria/ma_dynrec.c +++ b/storage/maria/ma_dynrec.c @@ -69,6 +69,14 @@ my_bool _ma_dynmap_file(MARIA_HA *info, my_off_t size) DBUG_PRINT("warning", ("File is too large for mmap")); DBUG_RETURN(1); } + /* + Ingo wonders if it is good to use MAP_NORESERVE. From the Linux man page: + MAP_NORESERVE + Do not reserve swap space for this mapping. When swap space is + reserved, one has the guarantee that it is possible to modify the + mapping. When swap space is not reserved one might get SIGSEGV + upon a write if no physical memory is available. + */ info->s->file_map= (byte*) my_mmap(0, (size_t)(size + MEMMAP_EXTRA_MARGIN), info->s->mode==O_RDONLY ? PROT_READ : @@ -252,7 +260,7 @@ my_bool _ma_write_blob_record(MARIA_HA *info, const byte *record) _ma_calc_total_blob_length(info,record)+ extra); if (!(rec_buff=(byte*) my_alloca(reclength))) { - my_errno=ENOMEM; + my_errno= HA_ERR_OUT_OF_MEM; /* purecov: inspected */ return(1); } reclength2= _ma_rec_pack(info, @@ -289,7 +297,7 @@ my_bool _ma_update_blob_record(MARIA_HA *info, MARIA_RECORD_POS pos, #endif if (!(rec_buff=(byte*) my_alloca(reclength))) { - my_errno=ENOMEM; + my_errno= HA_ERR_OUT_OF_MEM; /* purecov: inspected */ return(1); } reclength= _ma_rec_pack(info,rec_buff+ALIGN_SIZE(MARIA_MAX_DYN_BLOCK_HEADER), @@ -1225,8 +1233,10 @@ ulong _ma_rec_unpack(register MARIA_HA *info, register byte *to, byte *from, { uint size_length=rec_length- maria_portable_sizeof_char_ptr; ulong blob_length= _ma_calc_blob_length(size_length,from); - if ((ulong) (from_end-from) - size_length < blob_length || - min_pack_length > (uint) (from_end -(from+size_length+blob_length))) + ulong from_left= (ulong) (from_end - from); + if (from_left < size_length || + from_left - size_length < blob_length || + from_left - size_length - blob_length < min_pack_length) goto err; memcpy((byte*) to,(byte*) from,(size_t) size_length); from+=size_length; -- cgit v1.2.1