diff --git a/mysql-test/r/maria.result b/mysql-test/r/maria.result index 710cb5ec094..8c1cb5f3a2f 100644 --- a/mysql-test/r/maria.result +++ b/mysql-test/r/maria.result @@ -1966,3 +1966,10 @@ select t1,t2,length(t3),length(t4),length(t5),length(t6),t7,t8 from t2; t1 t2 length(t3) length(t4) length(t5) length(t6) t7 t8 1 a 256 256 4096 4096 drop table t1,t2; +CREATE TABLE t1 (seq int, s1 int, s2 blob); +insert into t1 values (1, 1, MD5(1)); +update t1 set s1=2 where seq=1; +check table t1 extended; +Table Op Msg_type Msg_text +test.t1 check status OK +drop table t1; diff --git a/mysql-test/t/maria.test b/mysql-test/t/maria.test index d45f4c2ec6b..a98e2a8acf4 100644 --- a/mysql-test/t/maria.test +++ b/mysql-test/t/maria.test @@ -1254,6 +1254,14 @@ check table t1,t2; select t1,t2,length(t3),length(t4),length(t5),length(t6),t7,t8 from t2; drop table t1,t2; +# Test UPDATE with small BLOB which fits on head page + +CREATE TABLE t1 (seq int, s1 int, s2 blob); +insert into t1 values (1, 1, MD5(1)); +update t1 set s1=2 where seq=1; +check table t1 extended; +drop table t1; + # End of 5.2 tests --disable_result_log diff --git a/storage/maria/ma_blockrec.c b/storage/maria/ma_blockrec.c index 2558450b663..96e8663bfc8 100644 --- a/storage/maria/ma_blockrec.c +++ b/storage/maria/ma_blockrec.c @@ -1909,7 +1909,8 @@ static my_bool write_block_record(MARIA_HA *info, { /* Still room on page; Copy as many blobs we can into this page */ data= tmp_data; - for (; column < end_column && *blob_lengths < (ulong) (end_of_data - data); + for (; column < end_column && + *blob_lengths <= (ulong)(end_of_data - data); column++, blob_lengths++) { uchar *tmp_pos; diff --git a/storage/maria/ma_recovery.c b/storage/maria/ma_recovery.c index 2f951b0b776..5989adfd0d9 100644 --- a/storage/maria/ma_recovery.c +++ b/storage/maria/ma_recovery.c @@ -1193,7 +1193,7 @@ prototype_redo_exec_hook(UNDO_ROW_INSERT) if (info == NULL) return 0; set_undo_lsn_for_active_trans(rec->short_trid, rec->lsn); - if (cmp_translog_addr(rec->lsn, info->s->state.is_of_horizon) > 0) + if (cmp_translog_addr(rec->lsn, info->s->state.is_of_horizon) >= 0) { fprintf(tracef, " state older than record, updating rows' count\n"); info->s->state.state.records++; @@ -1216,7 +1216,7 @@ prototype_redo_exec_hook(UNDO_ROW_DELETE) if (info == NULL) return 0; set_undo_lsn_for_active_trans(rec->short_trid, rec->lsn); - if (cmp_translog_addr(rec->lsn, info->s->state.is_of_horizon) > 0) + if (cmp_translog_addr(rec->lsn, info->s->state.is_of_horizon) >= 0) { fprintf(tracef, " state older than record, updating rows' count\n"); info->s->state.state.records--; @@ -1234,7 +1234,7 @@ prototype_redo_exec_hook(UNDO_ROW_UPDATE) if (info == NULL) return 0; set_undo_lsn_for_active_trans(rec->short_trid, rec->lsn); - if (cmp_translog_addr(rec->lsn, info->s->state.is_of_horizon) > 0) + if (cmp_translog_addr(rec->lsn, info->s->state.is_of_horizon) >= 0) { info->s->state.changed|= STATE_CHANGED | STATE_NOT_ANALYZED | STATE_NOT_OPTIMIZED_KEYS | STATE_NOT_SORTED_PAGES; @@ -1295,7 +1295,7 @@ prototype_redo_exec_hook(CLR_END) set_undo_lsn_for_active_trans(rec->short_trid, previous_undo_lsn); fprintf(tracef, " CLR_END was about %s, undo_lsn now LSN (%lu,0x%lx)\n", log_desc->name, LSN_IN_PARTS(previous_undo_lsn)); - if (cmp_translog_addr(rec->lsn, info->s->state.is_of_horizon) > 0) + if (cmp_translog_addr(rec->lsn, info->s->state.is_of_horizon) >= 0) { fprintf(tracef, " state older than record, updating rows' count\n"); switch (undone_record_type) {