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

NEXTVAL on nocache sequence encounter "ERROR 1213 (40001): Deadlock found when trying to get lock; try restarting transaction" in Galera

    XMLWordPrintable

Details

    • Bug
    • Status: Closed (View Workflow)
    • Major
    • Resolution: Not a Bug
    • 10.6.14
    • N/A
    • Galera, Server
    • None
    • redhat 7 on VMware

    Description

      One of our DB is using 2 DB nodes + 1 aribtrator architecture with HAProxy on top. Found nextval error when sequence object is using nocache. Increment is 0 as Galera requirement.
      ERROR 1213 (40001): Deadlock found when trying to get lock; try restarting transaction

      DB nodes are using MariaDB version 10.6.14 and Galera 26.4.12.

      Below is the test case. One node will encounter error easily.

      # create sequence with nocache
      drop   sequence s ;
      create sequence s increment=0 cache=0 ;
      show create sequence s ;
       
       
      # create procedure for the test
      DROP PROCEDURE IF EXISTS seq_test;
       
      DELIMITER $$
      CREATE PROCEDURE seq_test(IN num_of_turn int, IN slp float)
      BEGIN
          DECLARE finished  char(1);
      	DECLARE cnt int;
      	
      	SET cnt=0;
      	
          WHILE cnt <= num_of_turn DO
              SELECT NEXTVAL(s);
       
              SET cnt=cnt+1;
       
              SELECT SLEEP(slp);
          END WHILE;
      END $$
       
      DELIMITER ;
       
       
      # node 1
      call seq_test(1000, 0.3);
       
       
      # node 2
      call seq_test(1000, 0.2);
      
      

      Attachments

        Activity

          People

            janlindstrom Jan Lindström
            frelist William Wong
            Votes:
            0 Vote for this issue
            Watchers:
            2 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.