mariadb/BitKeeper/triggers/post-commit
unknown 28131daa26 Fix for BUG#35351 "Maria: R-tree index does not return all expected rows"
BitKeeper/triggers/post-commit:
  commits to Maria public list
mysql-test/r/maria-gis-rtree.result:
  result is good now, similar to MyISAM's (gis-rtree.result)
storage/maria/ma_rt_index.c:
  R-tree key-reading code used info->buff as a cache for the next key read,
  but between key read and next key read, there is record read, which
  uses info->buff too. In detail, during a SELECT:
  First key read: maria_rfirst() is called, which calls maria_rtree_find_first() which calls 
  maria_rtree_find_req() which comes here
          if (after_key < last)
          {
            // ! the list of keys is copied to info->buff
            // and info->buff is remembered in info->int_keypos
            info->int_keypos= info->buff;
            info->int_maxpos= info->buff + (last - after_key);
            memcpy(info->buff, after_key, last - after_key);
            info->keyread_buff_used= 0;
          }
  Then record read:
  _ma_read_block_record() (as well as some other functions of
  ma_blockrec.c) overwrites info->buff:
    if (!(buff= pagecache_read(share->pagecache,
                               &info->dfile, ma_recordpos_to_page(record_pos), 0,
                               info->buff, share->page_type,
                               PAGECACHE_LOCK_LEFT_UNLOCKED, 0)))
  So, this has the effect that the keys saved by maria_rtree_find_req() are now lost:
  info->int_keypos now contains a copy of a data page!
  Then maria_rnext_same() runs (to find second row), calls maria_rtree_find_next() which
  does:
    if (!info->keyread_buff_used)
    {
      uchar *key= info->int_keypos;
      while (key < info->int_maxpos)
      {
        if (!maria_rtree_key_cmp(keyinfo->seg,
                                 info->first_mbr_key, key,
                                 info->last_rkey_length, search_flag))
  
  i.e. maria_rtree_key_cmp() is doing comparisons on values it reads from the data page.
  Naturally this is bad and no row is found.
  Origin of the bug: MARIA_HA::keyread_buff is new in Maria.
  Solution: use keyread_buff instead of buff (like _ma_search_next() does),
  in R-tree code. Note that ma_blockrec.c functions also use keyread_buff
  but they all are write-functions, which should not be running close
  to next-key-read. Also note that some ma_rt_index.c functions still
  use info->buff, but they are about writes too.
  Thanks Monty for the idea.
2008-04-11 11:53:21 +02:00

134 lines
2.9 KiB
Bash
Executable file

#!/bin/sh
#shift
if [ -n "$BK_USER" ]
then
COMMITTER=$BK_USER
else
COMMITTER=$USER
fi
FROM=$COMMITTER@mysql.com
COMMITS=maria@lists.mysql.com
DOCS=docs-commit@mysql.com
LIMIT=10000
VERSION="maria"
BKROOT=`bk root`
if [ -x /usr/sbin/sendmail ]; then
SENDMAIL=/usr/sbin/sendmail
else
SENDMAIL=sendmail
fi
if [ "$REAL_EMAIL" = "" ]
then
echo "Warning: you must set REAL_EMAIL in your profile"
else
FROM=$REAL_EMAIL
fi
BK_STATUS=$BK_STATUS$BK_COMMIT
if [ "$BK_STATUS" = OK ]
then
HAS_ACTUAL_CHANGES=`bk cset -r+ -d | grep -v "^#"`
if [ "$HAS_ACTUAL_CHANGES" = "" ]
then
echo ChangeSet had no real changes, not sending emails
exit
fi
IS_MERGE=`bk changes -r+ -k -m`
if [ "$IS_MERGE" = "" ]
then
echo Merge changeset, not sending mails
exit
fi
CHANGESET=`bk -R prs -r+ -h -d':P:::I:' ChangeSet`
CSETKEY=`bk -R prs -r+ -h -d':KEY:' ChangeSet`
#
# composing subject lines of commit mails.
# if a fix targets to a WL and there is a bug referred
# then X-Bug mail header will contain the first found bug's number
#
BUG=`bk -R prs -r+ -h -d':C:' ChangeSet | \
sed -ne 's/[Bb][Uu][Gg] *# *\([0-9][0-9]*\).*$/BUG#\1/
s/.*BUG#\([0-9][0-9]*\)/\1/p'`
WL=`bk -R prs -r+ -h -d':C:' ChangeSet | \
sed -ne 's/[Ww][Ll] *# *\([0-9][0-9]*\).*$/WL#\1/
s/.*\(WL#[0-9][0-9]*\)/ \1/p'`
if [ "$BUG" = "" ]
then
# TO=dev-public@mysql.com
BS=""
BH=""
else
# TO=dev-bugs@mysql.com
BS=" BUG#$BUG"
# need newline here
BH="X-Bug: $BUG
"
fi
#++
# maria@ or dev-private@ mail
#--
LIST="commits"
TO="maria@lists.mysql.com"
if [ -f .tree-is-private ]
then
LIST="dev-private"
TO="dev-private@mysql.com"
fi
echo "Notifying $LIST list at $TO"
(
cat <<EOF
List-ID: <bk.mysql-$VERSION>
From: $FROM
To: $TO
Subject: bk commit into $VERSION tree ($CHANGESET)$BS
X-CSetKey: <$CSETKEY>
$BH
Below is the list of changes that have just been committed into a local
$VERSION repository of $COMMITTER. When $COMMITTER does a push these changes
will be propagated to the main repository and, within 24 hours after the
push, to the public repository.
For information on how to access the public repository
see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html
EOF
bk changes -v -r+
bk rset -r+ -ah | bk gnupatch -h -dup -T
) > $BKROOT/BitKeeper/tmp/commits.txt
$SENDMAIL -t < $BKROOT/BitKeeper/tmp/commits.txt
#++
# docs-commit@ mail
# Picks up anything under the Docs subdirectory (relevant for docs team).
#--
bk changes -v -r+ | grep -q " Docs/"
if [ $? -eq 0 ]
then
echo "Notifying docs list at $DOCS"
(
cat <<EOF
List-ID: <bk.mysql-$VERSION>
From: $FROM
To: $DOCS
Subject: bk commit - $VERSION tree (Manual) ($CHANGESET)$BS
EOF
bk changes -v -r+
bk rset -r+ -ah | bk gnupatch -h -dup -T
) > $BKROOT/BitKeeper/tmp/docs.txt
$SENDMAIL -t < $BKROOT/BitKeeper/tmp/docs.txt
fi
else
echo "commit failed because '$BK_STATUS', you may need to re-clone..."
fi