• unknown's avatar
    Bug#25673 - spatial index corruption, error 126 · 548a39a1
    unknown authored
              incorrect key file for table
    
    In certain cases it could happen that deleting a row could
    corrupt an RTREE index.
    
    According to Guttman's algorithm, page underflow is handled
    by storing the page in a list for later re-insertion. The
    keys from the stored pages have to be inserted into the
    remaining pages of the same level of the tree. Hence the
    level number is stored in the re-insertion list together
    with the page.
    
    In the MySQL RTree implementation the level counts from zero
    at the root page, increasing numbers for levels down the tree.
    
    If during re-insertion of the keys the tree height grows, all
    level numbers become invalid. The remaining keys will be
    inserted at the wrong level.
    
    The fix is to increment the level numbers stored in the
    reinsert list after a split of the root block during reinsertion.
    
    
    myisam/rt_index.c:
      Bug#25673 - spatial index corruption, error 126
                  incorrect key file for table
      Added a loop in rtree_delete() to increment the level numbers
      stored in the reinsert list after a split of the root block
      during reinsertion.
      Added comments and DBUG statements.
    myisam/rt_key.c:
      Bug#25673 - spatial index corruption, error 126
                  incorrect key file for table
      Added DBUG statements.
    myisam/rt_split.c:
      Bug#25673 - spatial index corruption, error 126
                  incorrect key file for table
      Added DBUG statements.
    mysql-test/r/gis-rtree.result:
      Bug#25673 - spatial index corruption, error 126
                  incorrect key file for table
      Added the test result.
    mysql-test/t/gis-rtree.test:
      Bug#25673 - spatial index corruption, error 126
                  incorrect key file for table
      Added a test.
    548a39a1
gis-rtree.result 74.3 KB