Bug #35273 Corrupted table if using GIS index

Submitted: 13 Mar 2008 16:02 Modified: 17 Mar 2008 22:11
Reporter: Guilhem Bichot Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Maria storage engine Severity:S3 (Non-critical)
Version:5.1-maria OS:Any
Assigned to: Guilhem Bichot CPU Architecture:Any

[13 Mar 2008 16:02] Guilhem Bichot
Description:
Use this (taken from gis-rtree.test):

-- source include/have_geometry.inc

set storage_engine=maria;

#
# test of rtree (using with spatial data)
#
--disable_warnings
DROP TABLE IF EXISTS t1, t2;
--enable_warnings

CREATE TABLE t1 (
  fid INT NOT NULL AUTO_INCREMENT PRIMARY KEY, 
  g GEOMETRY NOT NULL,
  SPATIAL KEY(g)
) Transactional=0;

SHOW CREATE TABLE t1;

let $1=150;
let $2=150;
while ($1)
{
  eval INSERT INTO t1 (g) VALUES (GeomFromText('LineString($1 $1, $2 $2)'));
  dec $1;
  inc $2;
}

It will say in the error log that t1.MAI is corrupted

How to repeat:
see description

Suggested fix:
at the end of one INSERT, the table is unlocked, which causes a flush of all index pages (expected, table is not transactional) and this flush fails because it finds one page is pinned. This page was pinned by a ma_write_keypage(). Either it should not have been pinned, or it should have been unpinned before the flush (I assume the latter is the good solution).
[13 Mar 2008 16:24] Guilhem Bichot
When this bug is fixed, please run the attached maria-gis-rtree.test to see if there are next bugs.
[13 Mar 2008 16:24] Guilhem Bichot
test file for GIS Maria bugs

Attachment: maria-g (application/octet-stream, text), 0 bytes.

[13 Mar 2008 16:25] Guilhem Bichot
test file for GIS Maria bugs

Attachment: maria-gis-rtree.test (application/octet-stream, text), 41.47 KiB.

[17 Mar 2008 21:32] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/44157

ChangeSet@1.2617, 2008-03-17 22:31:50+01:00, guilhem@gbichot4.local +3 -0
  Fix for BUG#35273 "Corrupted table if using GIS index":
  when modifying R-tree indices we forgot to unpin pages (causing
  flush at-end-of-statement to fail - because page is pinned - and thus
  mark table corrupted) and also to unlock key_del (causing assertion
  failure info->used_key_del==0 at maria_close()).

Portions of this website are copyright © 2001, 2002 The PHP Group

Page generated in 0.040 sec. using MySQL 8.4.7-u6-cloud

Timestamp references displayed by the system are UTC.
Content reproduced on this site is the property of the respective copyright holders.
It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.