Skip to content
  • Lakshmi Narayanan Sreethar's avatar
    d32fa7c5
    Bug#31601674 CLEAR NDB_SCHEMA_RESULT ROWS DURING · d32fa7c5
    Lakshmi Narayanan Sreethar authored
    MYSQL SERVER RESTART
    
    When there is a MySQL Server shutdown or a cluster failure during a
    schema distribution, where the coordinator is waiting for the
    participants, the schema distribution is aborted halfway. The
    ndb_schema_result rows, so far received by the coordinator, cannot be
    cleaned up at the end of a cluster failure, as the cluster is already
    down. And, during a server shutdown, even if the rows are cleaned up
    before the binlog thread exits, there is always a chance that a slow
    participant could reply after the coordinator has shutdown. So such rows
    related to the schema operation, which has now been aborted, end up left
    behind. There is a chance that these rows might have a conflict with a
    future reply from a participant if a DDL with the same schema op id
    originates from a client with the same node id.
    
    The solution is to clear all such rows on ndb_schema_result during the
    ndbcluster binlog setup. Since the binlog thread will be holding the GSL
    during the setup, it is assured that there are no DDL distributions in
    progress and any rows remaining in ndb_schema_result table are already
    obsolete.
    
    Changes:
    - Added a method delete_all_rows() to the Ndb_util_table class which is
      now called during the binlog setup to clear all the rows in
      ndb_schema_result table.
    - Added a new function ndb_table_scan_and_delete_rows() that scans the
      rows of a given table and, deletes them. Rows can also be optionally
      filtered out by defining a NdbScanFilter.
    - Updated Ndb_schema_event_handler's remove_schema_result_rows() method
      to use the new function mentioned above.
    - Added a new method get_column_num() to the Ndb_util_class which
      returns the column number of a given column within the Ndb table.
    - Updated the retry functions in ndb_retry.h to take in a constant
      reference to the std::function.
    
    Change-Id: Ia96365fd60a84f6257ad0acbcef60d0e168e1995
    d32fa7c5
    Bug#31601674 CLEAR NDB_SCHEMA_RESULT ROWS DURING
    Lakshmi Narayanan Sreethar authored
    MYSQL SERVER RESTART
    
    When there is a MySQL Server shutdown or a cluster failure during a
    schema distribution, where the coordinator is waiting for the
    participants, the schema distribution is aborted halfway. The
    ndb_schema_result rows, so far received by the coordinator, cannot be
    cleaned up at the end of a cluster failure, as the cluster is already
    down. And, during a server shutdown, even if the rows are cleaned up
    before the binlog thread exits, there is always a chance that a slow
    participant could reply after the coordinator has shutdown. So such rows
    related to the schema operation, which has now been aborted, end up left
    behind. There is a chance that these rows might have a conflict with a
    future reply from a participant if a DDL with the same schema op id
    originates from a client with the same node id.
    
    The solution is to clear all such rows on ndb_schema_result during the
    ndbcluster binlog setup. Since the binlog thread will be holding the GSL
    during the setup, it is assured that there are no DDL distributions in
    progress and any rows remaining in ndb_schema_result table are already
    obsolete.
    
    Changes:
    - Added a method delete_all_rows() to the Ndb_util_table class which is
      now called during the binlog setup to clear all the rows in
      ndb_schema_result table.
    - Added a new function ndb_table_scan_and_delete_rows() that scans the
      rows of a given table and, deletes them. Rows can also be optionally
      filtered out by defining a NdbScanFilter.
    - Updated Ndb_schema_event_handler's remove_schema_result_rows() method
      to use the new function mentioned above.
    - Added a new method get_column_num() to the Ndb_util_class which
      returns the column number of a given column within the Ndb table.
    - Updated the retry functions in ndb_retry.h to take in a constant
      reference to the std::function.
    
    Change-Id: Ia96365fd60a84f6257ad0acbcef60d0e168e1995
Loading