Uploaded image for project: 'MariaDB Server'
  1. MariaDB Server
  2. MDEV-41041

CONNECT FIX-table index: A corrupted record position is silently treated as "not found" instead of being rejected as invalid

    XMLWordPrintable

Details

    • Can result in unexpected behaviour

    Description

      INSTALL SONAME 'ha_connect';
       
      let $MYSQLD_DATADIR= `select @@datadir`;
       
      CREATE TABLE t1 (id INT(4) NOT NULL FIELD_FORMAT='Z', val CHAR(10) NOT NULL, KEY(id)) ENGINE=CONNECT TABLE_TYPE=FIX FILE_NAME='deeptest5_idx.txt' ENDING=1;
      INSERT INTO t1 VALUES (50,'row50'),(10,'row10'),(90,'row90'),(30,'row30'),(70,'row70');
       
      --echo # Index works correctly before any corruption
      SELECT COUNT(*) AS baseline_where90 FROM t1 WHERE id=90;
      SELECT COUNT(*) AS baseline_all FROM t1;
       
      FLUSH TABLES;
       
      --echo # Corrupt .fnx index file
      --let $IDXFILE= $MYSQLD_DATADIR/test/deeptest5_idx.fnx
      --exec perl -e 'open(F,"+<","'$IDXFILE'") or exit 1; binmode F; seek(F,128,0); print F "\xff\xff\xff\xff"; close F;'
       
      FLUSH TABLES;
       
      --echo # BUG: silently reports 0 rows for a value that still exists in the data file. It should either still be 1, or raise a clean corruption error
      SELECT COUNT(*) AS after_corruption_where90 FROM t1 WHERE id=90;
      --echo # Proves the row is still physically present -- only the indexed lookup is wrong
      SELECT COUNT(*) AS after_corruption_all FROM t1;
      SELECT * FROM t1 ORDER BY id;
       
      DROP TABLE t1;
      --remove_file $MYSQLD_DATADIR/test/deeptest5_idx.txt
      

      Attachments

        Activity

          People

            sanja Oleksandr Byelkin
            ramesh Ramesh Sivaraman
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:

              Time Tracking

                Estimated:
                Original Estimate - Not Specified
                Not Specified
                Remaining:
                Remaining Estimate - 0d
                0d
                Logged:
                Time Spent - 0.5h
                0.5h

                Git Integration

                  Error rendering 'com.xiplink.jira.git.jira_git_plugin:git-issue-webpanel'. Please contact your Jira administrators.