summaryrefslogtreecommitdiff
path: root/innobase/log
diff options
context:
space:
mode:
authorunknown <heikki@hundin.mysql.fi>2003-01-05 21:58:06 +0200
committerunknown <heikki@hundin.mysql.fi>2003-01-05 21:58:06 +0200
commitdb060cb713edaccfc447dda687a5e58c5b5b4e7a (patch)
tree1a95ba64aba9a5a6add93dc1d971557a3c6d1cfd /innobase/log
parente3c7f4d85ec4caf59fc408cf5643e5dc64e9a3d4 (diff)
downloadmariadb-git-db060cb713edaccfc447dda687a5e58c5b5b4e7a.tar.gz
btr0pcur.c:
Fix bug: an index cursor can theoretically be restored in a wrong place log0log.c: Fix bug: if combined log file size is >= 2 GB in a 32-bit computer InnoDB can write log to a wrong position innobase/log/log0log.c: Fix bug: if combined log file size is >= 2 GB in a 32-bit computer InnoDB can write log to a wrong position innobase/btr/btr0pcur.c: Fix bug: an index cursor can theoretically be restored in a wrong place
Diffstat (limited to 'innobase/log')
-rw-r--r--innobase/log/log0log.c32
1 files changed, 21 insertions, 11 deletions
diff --git a/innobase/log/log0log.c b/innobase/log/log0log.c
index f9b785ccbd5..539cde337bd 100644
--- a/innobase/log/log0log.c
+++ b/innobase/log/log0log.c
@@ -437,25 +437,29 @@ log_group_calc_lsn_offset(
dulint lsn, /* in: lsn, must be within 4 GB of group->lsn */
log_group_t* group) /* in: log group */
{
- dulint gr_lsn;
- ulint gr_lsn_size_offset;
- ulint difference;
- ulint group_size;
- ulint offset;
+ dulint gr_lsn;
+ ib_longlong gr_lsn_size_offset;
+ ib_longlong difference;
+ ib_longlong group_size;
+ ib_longlong offset;
ut_ad(mutex_own(&(log_sys->mutex)));
+ /* If total log file size is > 2 GB we can easily get overflows
+ with 32-bit integers. Use 64-bit integers instead. */
+
gr_lsn = group->lsn;
- gr_lsn_size_offset = log_group_calc_size_offset(group->lsn_offset,
- group);
- group_size = log_group_get_capacity(group);
+ gr_lsn_size_offset = (ib_longlong)
+ log_group_calc_size_offset(group->lsn_offset, group);
+
+ group_size = (ib_longlong) log_group_get_capacity(group);
if (ut_dulint_cmp(lsn, gr_lsn) >= 0) {
- difference = ut_dulint_minus(lsn, gr_lsn);
+ difference = (ib_longlong) ut_dulint_minus(lsn, gr_lsn);
} else {
- difference = ut_dulint_minus(gr_lsn, lsn);
+ difference = (ib_longlong) ut_dulint_minus(gr_lsn, lsn);
difference = difference % group_size;
@@ -464,7 +468,13 @@ log_group_calc_lsn_offset(
offset = (gr_lsn_size_offset + difference) % group_size;
- return(log_group_calc_real_offset(offset, group));
+ ut_a(offset <= 0xFFFFFFFF);
+
+ /* printf("Offset is %lu gr_lsn_offset is %lu difference is %lu\n",
+ (ulint)offset,(ulint)gr_lsn_size_offset, (ulint)difference);
+ */
+
+ return(log_group_calc_real_offset((ulint)offset, group));
}
/***********************************************************************