diff options
author | Sergei Golubchik <serg@mariadb.org> | 2015-01-31 21:48:47 +0100 |
---|---|---|
committer | Sergei Golubchik <serg@mariadb.org> | 2015-01-31 21:48:47 +0100 |
commit | 4b21cd21fef2763d757aa15681c9c9a7ed5db3c9 (patch) | |
tree | e9e233392b47f93de12cecce1f7f403ce26057b0 /storage/innobase/btr | |
parent | 0b049b40124d72d77c008d4441e4db2e77f0f127 (diff) | |
parent | a06624d61f36c70edd63adcfe2803bb7a8564de5 (diff) | |
download | mariadb-git-4b21cd21fef2763d757aa15681c9c9a7ed5db3c9.tar.gz |
Merge branch '10.0' into merge-wip
Diffstat (limited to 'storage/innobase/btr')
-rw-r--r-- | storage/innobase/btr/btr0cur.cc | 65 |
1 files changed, 37 insertions, 28 deletions
diff --git a/storage/innobase/btr/btr0cur.cc b/storage/innobase/btr/btr0cur.cc index b030fd7da79..e68179a5c19 100644 --- a/storage/innobase/btr/btr0cur.cc +++ b/storage/innobase/btr/btr0cur.cc @@ -2369,6 +2369,38 @@ btr_cur_pess_upd_restore_supremum( } /*************************************************************//** +Check if the total length of the modified blob for the row is within 10% +of the total redo log size. This constraint on the blob length is to +avoid overwriting the redo logs beyond the last checkpoint lsn. +@return DB_SUCCESS or DB_TOO_BIG_RECORD. */ +static +dberr_t +btr_check_blob_limit(const big_rec_t* big_rec_vec) +{ + const ib_uint64_t redo_size = srv_n_log_files * srv_log_file_size + * UNIV_PAGE_SIZE; + const ulint redo_10p = redo_size / 10; + ulint total_blob_len = 0; + dberr_t err = DB_SUCCESS; + + /* Calculate the total number of bytes for blob data */ + for (ulint i = 0; i < big_rec_vec->n_fields; i++) { + total_blob_len += big_rec_vec->fields[i].len; + } + + if (total_blob_len > redo_10p) { + ib_logf(IB_LOG_LEVEL_ERROR, "The total blob data" + " length (" ULINTPF ") is greater than" + " 10%% of the total redo log size (" UINT64PF + "). Please increase total redo log size.", + total_blob_len, redo_size); + err = DB_TOO_BIG_RECORD; + } + + return(err); +} + +/*************************************************************//** Performs an update of a record on a page of a tree. It is assumed that mtr holds an x-latch on the tree and on the cursor page. If the update is made on the leaf level, to avoid deadlocks, mtr must also @@ -2583,26 +2615,14 @@ make_external: } if (big_rec_vec) { - const ulint redo_10p = srv_log_file_size * UNIV_PAGE_SIZE / 10; - ulint total_blob_len = 0; - /* Calculate the total number of bytes for blob data */ - for (ulint i = 0; i < big_rec_vec->n_fields; i++) { - total_blob_len += big_rec_vec->fields[i].len; - } + err = btr_check_blob_limit(big_rec_vec); - if (total_blob_len > redo_10p) { - ib_logf(IB_LOG_LEVEL_ERROR, "The total blob data" - " length (" ULINTPF ") is greater than" - " 10%% of the redo log file size (" UINT64PF - "). Please increase innodb_log_file_size.", - total_blob_len, srv_log_file_size); + if (err != DB_SUCCESS) { if (n_reserved > 0) { fil_space_release_free_extents( index->space, n_reserved); } - - err = DB_TOO_BIG_RECORD; goto err_exit; } } @@ -4474,7 +4494,6 @@ btr_store_big_rec_extern_fields( buf_block_t** freed_pages = NULL; ulint n_freed_pages = 0; dberr_t error = DB_SUCCESS; - ulint total_blob_len = 0; ut_ad(rec_offs_validate(rec, index, offsets)); ut_ad(rec_offs_any_extern(offsets)); @@ -4494,21 +4513,11 @@ btr_store_big_rec_extern_fields( rec_page_no = buf_block_get_page_no(rec_block); ut_a(fil_page_get_type(page_align(rec)) == FIL_PAGE_INDEX); - const ulint redo_10p = (srv_log_file_size * UNIV_PAGE_SIZE / 10); + error = btr_check_blob_limit(big_rec_vec); - /* Calculate the total number of bytes for blob data */ - for (ulint i = 0; i < big_rec_vec->n_fields; i++) { - total_blob_len += big_rec_vec->fields[i].len; - } - - if (total_blob_len > redo_10p) { + if (error != DB_SUCCESS) { ut_ad(op == BTR_STORE_INSERT); - ib_logf(IB_LOG_LEVEL_ERROR, "The total blob data length" - " (" ULINTPF ") is greater than 10%% of the" - " redo log file size (" UINT64PF "). Please" - " increase innodb_log_file_size.", - total_blob_len, srv_log_file_size); - return(DB_TOO_BIG_RECORD); + return(error); } if (page_zip) { |