summaryrefslogtreecommitdiff
path: root/storage/archive
diff options
context:
space:
mode:
authorMichael Widenius <monty@askmonty.org>2012-02-20 16:23:18 +0200
committerMichael Widenius <monty@askmonty.org>2012-02-20 16:23:18 +0200
commitae07ec6cbf08e311e538f5149f93385e5bcaa7a6 (patch)
tree4f2dee1467f3c3e3bd8feb6ffb7adf7684bdc653 /storage/archive
parent0c568a99dfe3e528ec5bd09dfe0f2f90acb52db4 (diff)
parentdacaaf22a3f132df5573fe8e58c0617c30c5e9fc (diff)
downloadmariadb-git-ae07ec6cbf08e311e538f5149f93385e5bcaa7a6.tar.gz
Merge with MYSQL 5.1.61
Fixed README with link to source Merged InnoDB change to XtraDB README: Added information of where to find MariaDB code storage/archive/ha_archive.cc: Removed memset() of rows, a MariaDB checksum's doesn't touch not used data.
Diffstat (limited to 'storage/archive')
-rw-r--r--storage/archive/ha_archive.cc37
1 files changed, 28 insertions, 9 deletions
diff --git a/storage/archive/ha_archive.cc b/storage/archive/ha_archive.cc
index ec26ef65321..618fc1ea7f3 100644
--- a/storage/archive/ha_archive.cc
+++ b/storage/archive/ha_archive.cc
@@ -772,6 +772,7 @@ uint32 ha_archive::max_row_length(const uchar *buf)
ptr != end ;
ptr++)
{
+ if (!table->field[*ptr]->is_null())
length += 2 + ((Field_blob*)table->field[*ptr])->get_length();
}
@@ -1599,13 +1600,15 @@ int ha_archive::check(THD* thd, HA_CHECK_OPT* check_opt)
{
int rc= 0;
const char *old_proc_info;
- ha_rows count= share->rows_recorded;
+ ha_rows count;
DBUG_ENTER("ha_archive::check");
old_proc_info= thd_proc_info(thd, "Checking table");
- /* Flush any waiting data */
pthread_mutex_lock(&share->mutex);
- azflush(&(share->archive_write), Z_SYNC_FLUSH);
+ count= share->rows_recorded;
+ /* Flush any waiting data */
+ if (share->archive_write_open)
+ azflush(&(share->archive_write), Z_SYNC_FLUSH);
pthread_mutex_unlock(&share->mutex);
if (init_archive_reader())
@@ -1615,18 +1618,34 @@ int ha_archive::check(THD* thd, HA_CHECK_OPT* check_opt)
start of the file.
*/
read_data_header(&archive);
+ for (ha_rows cur_count= count; cur_count; cur_count--)
+ {
+ if ((rc= get_row(&archive, table->record[0])))
+ goto error;
+ }
+ /*
+ Now read records that may have been inserted concurrently.
+ Acquire share->mutex so tail of the table is not modified by
+ concurrent writers.
+ */
+ pthread_mutex_lock(&share->mutex);
+ count= share->rows_recorded - count;
+ if (share->archive_write_open)
+ azflush(&(share->archive_write), Z_SYNC_FLUSH);
while (!(rc= get_row(&archive, table->record[0])))
count--;
-
- thd_proc_info(thd, old_proc_info);
+ pthread_mutex_unlock(&share->mutex);
if ((rc && rc != HA_ERR_END_OF_FILE) || count)
- {
- share->crashed= FALSE;
- DBUG_RETURN(HA_ADMIN_CORRUPT);
- }
+ goto error;
+ thd_proc_info(thd, old_proc_info);
DBUG_RETURN(HA_ADMIN_OK);
+
+error:
+ thd_proc_info(thd, old_proc_info);
+ share->crashed= FALSE;
+ DBUG_RETURN(HA_ADMIN_CORRUPT);
}
/*