Uploaded image for project: 'Percona Server for MySQL'
  1. Percona Server for MySQL
  2. PS-6074

NO_PAD collations should not use the space padded encoding

    XMLWordPrintable

    Details

    • Type: Improvement
    • Status: Done
    • Priority: Medium
    • Resolution: Fixed
    • Affects Version/s: 8.0.12-2rc1, Not 5.6.x, Not 5.7.x
    • Fix Version/s: None
    • Component/s: MyRocks
    • Labels:
      None

      Description

      The new NO_PAD collations should not use the space padded encoding. Instead, it should use the NO_PAD encodings.

       

      In 5.6, only binary was NO_PAD and the NO_PAD encoding callback was called `Rdb_key_def::pack_variable_format`. The space padded encoding was called `Rdb_key_def::pack_with_varchar_encoding`. For varchars, NO_PAD collations should call `Rdb_key_def::pack_variable_format`

       

      I only demonstrate unique key violations below, but the encoding also has implications for sort order as well (they are slightly different).

       

      varchar:

       

      mysql> create table t (v varchar(100) primary key) engine=rocksdb;
      Query OK, 0 rows affected, 1 warning (0.01 sec)
      mysql> insert into t values ("a");
      Query OK, 1 row affected (0.01 sec)
      // Not expected for NO_PAD collations
      mysql> insert into t values ("a ");
      ERROR 1062 (23000): Duplicate entry 'a ' for key 'PRIMARY'
      

       

       

        Smart Checklist

          Attachments

            Issue Links

              Activity

                People

                Assignee:
                przemyslaw.skibinski Przemyslaw Skibinski
                Reporter:
                mung Manuel
                Votes:
                0 Vote for this issue
                Watchers:
                5 Start watching this issue

                  Dates

                  Created:
                  Updated:
                  Resolved:

                    Time Tracking

                    Estimated:
                    Original Estimate - Not Specified
                    Not Specified
                    Remaining:
                    Remaining Estimate - Not Specified
                    Not Specified
                    Logged:
                    Time Spent - 4 hours
                    4h