summaryrefslogtreecommitdiff
path: root/sql/records.cc
diff options
context:
space:
mode:
authorunknown <monty@hundin.mysql.fi>2001-11-26 02:16:38 +0200
committerunknown <monty@hundin.mysql.fi>2001-11-26 02:16:38 +0200
commit4615e50093d635f07f2940bb9fbe7e1c327b8ebb (patch)
tree1f8e0f608f035ad5906f6ea2dbbb3006ea2703bd /sql/records.cc
parent7ef7d93726929ec678a8b07bed1be7bb56ad4b10 (diff)
downloadmariadb-git-4615e50093d635f07f2940bb9fbe7e1c327b8ebb.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. Docs/manual.texi: Cleanup configure.in: Version number change mysql-test/t/backup.test: drop used tables mysql-test/t/bdb-crash.test: cleanup mysys/thr_lock.c: cleanup sql/mysqld.cc: safety fix sql/records.cc: Fixed bug where one got an empty set instead of a DEADLOCK error when using BDB tables. sql/sql_table.cc: Fix race condition in ANALYZE TABLE.
Diffstat (limited to 'sql/records.cc')
-rw-r--r--sql/records.cc44
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;
}