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

CONNECT Engine - (1040) Too many connections when running in trigger

    XMLWordPrintable

Details

    Description

      I tried creating the following tables on 2 servers:

      // Master
      CREATE DATABASE IF NOT EXISTS test;
       
      CREATE TABLE IF NOT EXISTS test.test_data (
          id 							INT,
          content						VARCHAR(255),
          PRIMARY KEY (id)
      )  ENGINE=INNODB;
       
      INSERT INTO test.test_data
      VALUES
      (1, "Test 01"),
      (2, "Test 02");
      

      // Slave
      CREATE DATABASE IF NOT EXISTS test;
       
      CREATE TABLE IF NOT EXISTS test.test_data (
          id 							INT,
          content						VARCHAR(255)
      )   ENGINE=CONNECT TABLE_TYPE=MYSQL OPTION_LIST='connect=server_connect'
      SRCDEF='SELECT id, content FROM test.test_data WHERE %s';
       
      CREATE TABLE IF NOT EXISTS test.test_trigger (
          id 							INT,
          content						VARCHAR(255),
          PRIMARY KEY (id)
      )   ENGINE=INNODB;
       
      DELIMITER //
       
      DROP TRIGGER IF EXISTS  test.after_test_trigger;
      //
      CREATE TRIGGER  test.after_test_trigger
      AFTER INSERT ON  test.test_trigger
      FOR EACH ROW
      BEGIN
      SET @test_content = (
      SELECT td.content
      FROM  test.test_data td
      WHERE
      td.id = NEW.id
      );
      END //
      INSERT INTO test.test_trigger
      VALUES
      (1, "Test 01"),
      (2, "Test 02");
      

      I've attached general log below. You'll find only the last statement that quit this connection "208", the rest won't. Therefore, when I update 200 rows, it exceeds 200 connections and show error "Too many connections".
      Thanks.

      Attachments

        Issue Links

          Activity

            People

              bertrandop Olivier Bertrand
              nhokworm nhokworm
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:

                Git Integration

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