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

Update on vector column returns error but modifies the value, results in further ER_KEY_NOT_FOUND

Details

    • Bug
    • Status: Closed (View Workflow)
    • Critical
    • Resolution: Fixed
    • N/A
    • 11.7.1
    • Vector search
    • None

    Description

      CREATE TABLE t (a INT, v BLOB NOT NULL, VECTOR INDEX (v));
      INSERT INTO t VALUES (1,VEC_FROMTEXT('[0]'));
       
      --error ER_TRUNCATED_WRONG_VALUE_FOR_FIELD
      UPDATE t SET v = VEC_FROMTEXT('[0,0]');
       
      SELECT a, VEC_TOTEXT(v) FROM t;
      UPDATE t SET a = 2;
       
      # Cleanup
      DROP TABLE t;
      

      bb-11.6-MDEV-32887-vector f20a1f4e94f5fc700959ff6b7945aa8a5fd0c307

      UPDATE t SET v = VEC_FROMTEXT('[0,0]');
      ERROR 22007: Incorrect vector value: '...' for column `test`.`t`.`v` at row 1
      SELECT a, VEC_TOTEXT(v) FROM t;
      a	VEC_TOTEXT(v)
      1	[0.000000,0.000000]
      UPDATE t SET a = 2;
      bug.vec10-1                              [ fail ]
              Test ended at 2024-09-27 17:16:09
       
      CURRENT_TEST: bug.vec10-1
      mysqltest: At line 8: query 'UPDATE t SET a = 2' failed: ER_KEY_NOT_FOUND (1032): Can't find record in 't'
      

      So, UPDATE from 1 to 2 dimensions failed, but the value was updated nevertheless.
      And the next UPDATE causes a corruption-like error.

      Attachments

        Issue Links

          Activity

            it's a known deficiency, the code has a comment

              // XXX returning an error here will rollback the insert in InnoDB
              // but in MyISAM the row will stay inserted, making the index out of sync:
              // invalid vector values are present in the table but cannot be found
              // via an index. The easiest way to fix it is with a VECTOR(N) type
            

            "easiest" may be a wrong word here, there isn't much we can do for MyISAM, because the vector value is validated after was inserted into the main MyISAM table. With the VECTOR type we can do the validation before and this kind of corruptions will be impossible.

            serg Sergei Golubchik added a comment - it's a known deficiency, the code has a comment // XXX returning an error here will rollback the insert in InnoDB // but in MyISAM the row will stay inserted, making the index out of sync: // invalid vector values are present in the table but cannot be found // via an index. The easiest way to fix it is with a VECTOR(N) type "easiest" may be a wrong word here, there isn't much we can do for MyISAM, because the vector value is validated after was inserted into the main MyISAM table. With the VECTOR type we can do the validation before and this kind of corruptions will be impossible.

            There is the vector type now, so I guess it should be closed or moved to in-testing.

            elenst Elena Stepanova added a comment - There is the vector type now, so I guess it should be closed or moved to in-testing.

            People

              serg Sergei Golubchik
              elenst Elena Stepanova
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Git Integration

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