diff options
author | unknown <monty@hundin.mysql.fi> | 2001-06-15 05:03:15 +0300 |
---|---|---|
committer | unknown <monty@hundin.mysql.fi> | 2001-06-15 05:03:15 +0300 |
commit | e96fcbcfe97c8d9f0b244071575b5ccc3248d5ff (patch) | |
tree | 90883e19e7220eb27c1fa092220fe373c7e82d80 /sql/uniques.cc | |
parent | 8d6348f650b544b65dea17ad853f1127cce78f79 (diff) | |
download | mariadb-git-e96fcbcfe97c8d9f0b244071575b5ccc3248d5ff.tar.gz |
Fixed multi-table-delete
Optimize fixed length MyISAM rows to use pread/pwrite.
BUILD/compile-pentium-debug-max:
Also build embedded server
libmysqld/lib_vio.c:
Add vio_poll_read()
myisam/mi_statrec.c:
Use pread()/pwrite() instead of seek+read/write
mysql-test/r/multi_update.result:
Fix multi-table-delete test
mysql-test/t/multi_update.test:
Fix multi-table-delete test
sql/filesort.cc:
Fix multi-table-delete
sql/mysql_priv.h:
Fix multi-table-delete
sql/sql_class.h:
Fix multi-table-delete
sql/sql_delete.cc:
Fix multi-table-delete
sql/sql_parse.cc:
Fix multi-table-delete
sql/sql_select.cc:
Fix multi-table-delete
sql/sql_table.cc:
cleanup
sql/sql_unions.cc:
cleanup
sql/sql_yacc.yy:
cleanup/ optimize
sql/structs.h:
Fix multi-table-delete
sql/uniques.cc:
Fix multi-table-delete
Diffstat (limited to 'sql/uniques.cc')
-rw-r--r-- | sql/uniques.cc | 25 |
1 files changed, 12 insertions, 13 deletions
diff --git a/sql/uniques.cc b/sql/uniques.cc index c1ffeda1729..cbb67ecbbe5 100644 --- a/sql/uniques.cc +++ b/sql/uniques.cc @@ -44,7 +44,8 @@ Unique::Unique(qsort_cmp2 comp_func, void * comp_func_fixed_arg, /* If the following fail's the next add will also fail */ init_dynamic_array(&file_ptrs, sizeof(BUFFPEK), 16, 16); max_elements= max_in_memory_size / ALIGN_SIZE(sizeof(TREE_ELEMENT)+size); - open_cached_file(&file, mysql_tmpdir,TEMP_PREFIX, DISK_BUFFER_SIZE, MYF(MY_WME)); + open_cached_file(&file, mysql_tmpdir,TEMP_PREFIX, DISK_BUFFER_SIZE, + MYF(MY_WME)); } @@ -95,7 +96,7 @@ bool Unique::get(TABLE *table) SORTPARAM sort_param; table->found_records=elements+tree.elements_in_tree; - if (!my_b_inited(&file)) + if (my_b_tell(&file) == 0) { /* Whole tree is in memory; Don't use disk if you don't need to */ if ((record_pointers=table->record_pointers= (byte*) @@ -110,17 +111,16 @@ bool Unique::get(TABLE *table) if (flush()) return 1; - IO_CACHE *outfile=table->io_cache, tempfile; + IO_CACHE *outfile=table->io_cache; BUFFPEK *file_ptr= (BUFFPEK*) file_ptrs.buffer; uint maxbuffer= file_ptrs.elements - 1; uchar *sort_buffer; my_off_t save_pos; bool error=1; - my_b_clear(&tempfile); - /* Open cached file if it isn't open */ - outfile=table->io_cache=(IO_CACHE*) my_malloc(sizeof(IO_CACHE),MYF(MY_ZEROFILL)); + outfile=table->io_cache=(IO_CACHE*) my_malloc(sizeof(IO_CACHE), + MYF(MY_ZEROFILL)); if (!outfile || ! my_b_inited(outfile) && open_cached_file(outfile,mysql_tmpdir,TEMP_PREFIX,READ_RECORD_BUFFER, @@ -134,25 +134,24 @@ bool Unique::get(TABLE *table) sort_param.keys= max_in_memory_size / sort_param.sort_length; if (!(sort_buffer=(uchar*) my_malloc((sort_param.keys+1) * - sort_param.sort_length, - MYF(0)))) + sort_param.sort_length, + MYF(0)))) return 1; sort_param.unique_buff= sort_buffer+(sort_param.keys* sort_param.sort_length); /* Merge the buffers to one file, removing duplicates */ - if (merge_many_buff(&sort_param,sort_buffer,file_ptr,&maxbuffer,&tempfile)) + if (merge_many_buff(&sort_param,sort_buffer,file_ptr,&maxbuffer,&file)) goto err; - if (flush_io_cache(&tempfile) || - reinit_io_cache(&tempfile,READ_CACHE,0L,0,0)) + if (flush_io_cache(&file) || + reinit_io_cache(&file,READ_CACHE,0L,0,0)) goto err; - if (merge_buffers(&sort_param, &tempfile, outfile, sort_buffer, file_ptr, + if (merge_buffers(&sort_param, &file, outfile, sort_buffer, file_ptr, file_ptr, file_ptr+maxbuffer,0)) goto err; error=0; err: x_free((gptr) sort_buffer); - close_cached_file(&tempfile); if (flush_io_cache(outfile)) error=1; |