diff options
author | monty@hundin.mysql.fi <> | 2001-11-26 02:16:38 +0200 |
---|---|---|
committer | monty@hundin.mysql.fi <> | 2001-11-26 02:16:38 +0200 |
commit | 5738117970c8007fd9db6143e874e896ae913cfa (patch) | |
tree | 1f8e0f608f035ad5906f6ea2dbbb3006ea2703bd /sql/records.cc | |
parent | a2a838f88769dea90a0ba5a7196057eec6ca8c11 (diff) | |
download | mariadb-git-5738117970c8007fd9db6143e874e896ae913cfa.tar.gz |
Fix race condition in ANALYZE TABLE.
Fixed bug where one got an empty set instead of a DEADLOCK error when using BDB tables.
Diffstat (limited to 'sql/records.cc')
-rw-r--r-- | sql/records.cc | 44 |
1 files changed, 32 insertions, 12 deletions
diff --git a/sql/records.cc b/sql/records.cc index 0f49b3fa45e..d436f4f58fe 100644 --- a/sql/records.cc +++ b/sql/records.cc @@ -132,8 +132,13 @@ static int rr_quick(READ_RECORD *info) { if (tmp == HA_ERR_END_OF_FILE) tmp= -1; - else if (info->print_error) - info->file->print_error(tmp,MYF(0)); + else + { + if (info->print_error) + info->file->print_error(tmp,MYF(0)); + if (tmp < 0) // Fix negative BDB errno + tmp=1; + } } return tmp; } @@ -153,8 +158,13 @@ static int rr_sequential(READ_RECORD *info) { if (tmp == HA_ERR_END_OF_FILE) tmp= -1; - else if (info->print_error) - info->table->file->print_error(tmp,MYF(0)); + else + { + if (info->print_error) + info->table->file->print_error(tmp,MYF(0)); + if (tmp < 0) // Fix negative BDB errno + tmp=1; + } break; } } @@ -168,21 +178,27 @@ static int rr_from_tempfile(READ_RECORD *info) tryNext: if (my_b_read(info->io_cache,info->ref_pos,info->ref_length)) return -1; /* End of file */ - tmp=info->file->rnd_pos(info->record,info->ref_pos); - if (tmp) + if ((tmp=info->file->rnd_pos(info->record,info->ref_pos))) { if (tmp == HA_ERR_END_OF_FILE) tmp= -1; else if (tmp == HA_ERR_RECORD_DELETED) goto tryNext; - else if (info->print_error) - info->file->print_error(tmp,MYF(0)); + else + { + if (info->print_error) + info->file->print_error(tmp,MYF(0)); + if (tmp < 0) // Fix negative BDB errno + tmp=1; + } } return tmp; } /* rr_from_tempfile */ + static int rr_from_pointers(READ_RECORD *info) { + int tmp; byte *cache_pos; tryNext: if (info->cache_pos == info->cache_end) @@ -190,15 +206,19 @@ tryNext: cache_pos=info->cache_pos; info->cache_pos+=info->ref_length; - int tmp=info->file->rnd_pos(info->record,cache_pos); - if (tmp) + if ((tmp=info->file->rnd_pos(info->record,cache_pos))) { if (tmp == HA_ERR_END_OF_FILE) tmp= -1; else if (tmp == HA_ERR_RECORD_DELETED) goto tryNext; - else if (info->print_error) - info->file->print_error(tmp,MYF(0)); + else + { + if (info->print_error) + info->file->print_error(tmp,MYF(0)); + if (tmp < 0) // Fix negative BDB errno + tmp=1; + } } return tmp; } |