mirror of
https://github.com/MariaDB/server.git
synced 2025-02-01 11:31:51 +01:00
a980b544cd
------------------------------------------------------------------------ r2781 | marko | 2008-10-13 13:40:57 +0300 (Mon, 13 Oct 2008) | 1 line branches/zip: page_cur_delete_rec(): Call page_zip_validate_low(). ------------------------------------------------------------------------ r2783 | vasil | 2008-10-13 18:34:34 +0300 (Mon, 13 Oct 2008) | 9 lines branches/zip: Remove mysql-test/patches/bug37312.diff because MySQL "fixed" Bug#37312 by removing the test. http://bugs.mysql.com/37312 http://lists.mysql.com/commits/54462 ------------------------------------------------------------------------ r2784 | marko | 2008-10-13 21:35:30 +0300 (Mon, 13 Oct 2008) | 1 line branches/zip: Add missing NULL check to the assertion added in r2781. ------------------------------------------------------------------------ r2785 | marko | 2008-10-13 22:29:12 +0300 (Mon, 13 Oct 2008) | 2 lines branches/zip: page_cur_delete_rec(): Remove the bogus page_zip_validate_low() assertion that was added in r2781 and explain why it was bogus. ------------------------------------------------------------------------ r2786 | calvin | 2008-10-14 19:14:47 +0300 (Tue, 14 Oct 2008) | 7 lines branches/zip: fix Mantis issue #96 Problem compiling ha_innodb.cc on 64-bit Windows Change the definition of srv_replication_delay from ulint to ulong. ulint is 64-bit on Win64. Approved by: Heikki (on IM) ------------------------------------------------------------------------ r2787 | calvin | 2008-10-14 19:19:41 +0300 (Tue, 14 Oct 2008) | 7 lines branches/zip: fix compiler warning Change the definition of add_on from ulint to ullint, to eliminate the warning in .\btr\btr0cur.c: conversion from 'ullint' to 'ulint', possible loss of data Approved by: Heikki (on IM) ------------------------------------------------------------------------ r2793 | marko | 2008-10-15 10:00:06 +0300 (Wed, 15 Oct 2008) | 2 lines branches/zip: row_create_table_for_mysql(), row_create_index_for_mysql(): Note that the dictionary object will be freed. ------------------------------------------------------------------------ r2794 | marko | 2008-10-15 10:32:40 +0300 (Wed, 15 Oct 2008) | 9 lines branches/zip: When invoking page_zip_copy_recs(), update the lock table and the adaptive hash index. This should fix Issue #95 and Issue #87. page_zip_copy_recs(): Copy PAGE_MAX_TRX_ID as well, to have similar behavior to page_copy_rec_list_start() and page_copy_rec_list_end(). btr_root_raise_and_insert(), btr_page_split_and_insert(), btr_lift_page_up(): Update the lock table and the adaptive hash index. ------------------------------------------------------------------------ r2797 | marko | 2008-10-15 13:21:54 +0300 (Wed, 15 Oct 2008) | 3 lines branches/zip: Introduce UNIV_ZIP_COPY for invoking page_zip_copy_recs() more often in B-tree operations. ------------------------------------------------------------------------ r2799 | marko | 2008-10-15 14:27:42 +0300 (Wed, 15 Oct 2008) | 25 lines branches/zip: When the server crashes while freeing an externally stored column of a compressed table, the BTR_EXTERN_LEN field in the BLOB pointer will be written as 0. Tolerate this in the functions that deal with externally stored columns. This fixes Issue #80 and was posted at rb://26. Note that the clustered index record is always deleted or purged last, after any secondary index records referring to it have been deleted. btr_free_externally_stored_field(): On an uncompressed table, zero out the BTR_EXTERN_LEN, so that half-deleted BLOBs can be detected after crash recovery. btr_copy_externally_stored_field_prefix(): Return 0 if the BLOB has been half-deleted. row_upd_ext_fetch(): Assert that the externally stored column exists. row_ext_cache_fill(): Allow btr_copy_externally_stored_field_prefix() to return 0. row_sel_sec_rec_is_for_blob(): Return FALSE if the BLOB has been half-deleted. This is correct, because the clustered index record would have been deleted or purged last, after any secondary index records referring to it had been deleted. ------------------------------------------------------------------------
98 lines
3 KiB
C
98 lines
3 KiB
C
/******************************************************
|
|
Caching of externally stored column prefixes
|
|
|
|
(c) 2006 Innobase Oy
|
|
|
|
Created September 2006 Marko Makela
|
|
*******************************************************/
|
|
|
|
#include "row0ext.h"
|
|
|
|
#ifdef UNIV_NONINL
|
|
#include "row0ext.ic"
|
|
#endif
|
|
|
|
#include "btr0cur.h"
|
|
|
|
/************************************************************************
|
|
Fills the column prefix cache of an externally stored column. */
|
|
static
|
|
void
|
|
row_ext_cache_fill(
|
|
/*===============*/
|
|
row_ext_t* ext, /* in/out: column prefix cache */
|
|
ulint i, /* in: index of ext->ext[] */
|
|
ulint zip_size,/* compressed page size in bytes, or 0 */
|
|
const dfield_t* dfield) /* in: data field */
|
|
{
|
|
const byte* field = dfield_get_data(dfield);
|
|
ulint f_len = dfield_get_len(dfield);
|
|
byte* buf = ext->buf + i * REC_MAX_INDEX_COL_LEN;
|
|
|
|
ut_ad(i < ext->n_ext);
|
|
ut_ad(dfield_is_ext(dfield));
|
|
ut_a(f_len >= BTR_EXTERN_FIELD_REF_SIZE);
|
|
|
|
if (UNIV_UNLIKELY(!memcmp(field_ref_zero,
|
|
field + f_len - BTR_EXTERN_FIELD_REF_SIZE,
|
|
BTR_EXTERN_FIELD_REF_SIZE))) {
|
|
/* The BLOB pointer is not set: we cannot fetch it */
|
|
ext->len[i] = 0;
|
|
} else {
|
|
/* Fetch at most REC_MAX_INDEX_COL_LEN of the column.
|
|
The column should be non-empty. However,
|
|
trx_rollback_or_clean_all_recovered() may try to
|
|
access a half-deleted BLOB if the server previously
|
|
crashed during the execution of
|
|
btr_free_externally_stored_field(). */
|
|
ext->len[i] = btr_copy_externally_stored_field_prefix(
|
|
buf, REC_MAX_INDEX_COL_LEN, zip_size, field, f_len);
|
|
}
|
|
}
|
|
|
|
/************************************************************************
|
|
Creates a cache of column prefixes of externally stored columns. */
|
|
UNIV_INTERN
|
|
row_ext_t*
|
|
row_ext_create(
|
|
/*===========*/
|
|
/* out,own: column prefix cache */
|
|
ulint n_ext, /* in: number of externally stored columns */
|
|
const ulint* ext, /* in: col_no's of externally stored columns
|
|
in the InnoDB table object, as reported by
|
|
dict_col_get_no(); NOT relative to the records
|
|
in the clustered index */
|
|
const dtuple_t* tuple, /* in: data tuple containing the field
|
|
references of the externally stored
|
|
columns; must be indexed by col_no;
|
|
the clustered index record must be
|
|
covered by a lock or a page latch
|
|
to prevent deletion (rollback or purge). */
|
|
ulint zip_size,/* compressed page size in bytes, or 0 */
|
|
mem_heap_t* heap) /* in: heap where created */
|
|
{
|
|
ulint i;
|
|
row_ext_t* ret = mem_heap_alloc(heap, (sizeof *ret)
|
|
+ (n_ext - 1) * sizeof ret->len);
|
|
|
|
ut_ad(ut_is_2pow(zip_size));
|
|
ut_ad(zip_size <= UNIV_PAGE_SIZE);
|
|
|
|
ret->n_ext = n_ext;
|
|
ret->ext = ext;
|
|
ret->buf = mem_heap_alloc(heap, n_ext * REC_MAX_INDEX_COL_LEN);
|
|
#ifdef UNIV_DEBUG
|
|
memset(ret->buf, 0xaa, n_ext * REC_MAX_INDEX_COL_LEN);
|
|
UNIV_MEM_ALLOC(ret->buf, n_ext * REC_MAX_INDEX_COL_LEN);
|
|
#endif
|
|
|
|
/* Fetch the BLOB prefixes */
|
|
for (i = 0; i < n_ext; i++) {
|
|
const dfield_t* dfield;
|
|
|
|
dfield = dtuple_get_nth_field(tuple, ext[i]);
|
|
row_ext_cache_fill(ret, i, zip_size, dfield);
|
|
}
|
|
|
|
return(ret);
|
|
}
|