Uploaded image for project: 'Percona XtraDB Cluster'
  1. Percona XtraDB Cluster
  2. PXC-3211

Replace hard coded numbers with appropriate data structures in PXC source code

Details

    • Admin & Maintenance Task
    • Status: Done
    • Low
    • Resolution: Done
    • 8.0.x
    • 8.0.32-24 (Q1 2023)
    • None

    Description

      Currently, in the PXC source code, we are using the hard coded version numbers for special handling and for checking compatibility between versions.

      Something like below.

      if (wsrep_protocol_version < 3) {
       tmp_length = charset->coll->strnxfrm(
       charset, str, str_length,
       str_length, tmp_str, tmp_length, 0);
       DBUG_ASSERT(tmp_length <= str_length);
       } else {

      This may work well for now. But, it becomes difficult to search for its occurrences or such checks when the version changes in the future.

      This ticket aims at replacing all such hard coded numbers with a more meaningful enum which is not only type-safe, also makes the code more readable and easily discoverable. 

      Something like:

       

      enum enum_wsrep_version { 
        WSREP_VERSION_V2 = 2,
        WSREP_VERSION_V3 = 3,
        WSREP_VERSION_V4 = 4
      };
      

       

      Attachments

        Activity

          People

            varun.nagaraju Varun Nagaraju (Inactive)
            venkatesh.prasad Venkatesh Prasad
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Smart Checklist