Uploaded image for project: 'MariaDB MaxScale'
  1. MariaDB MaxScale
  2. MXS-5190

dotnet EntityFrameworkCore generates insert queries that are getting routed to all nodes as session write

    XMLWordPrintable

Details

    Description

      (Reproduction Notes: Just doing the query in the mariadb commandline client will not repo.
      it has to be sent over as a single multiple statement query, where as the mariadb-client cli seems to sends them over as separate statements.)

      Maxscale reads this insert query as a session query and sends it to all nodes.

      SET AUTOCOMMIT = 1; 
      INSERT INTO `CompileJobs` (
      `DMApiMajorVersion`, `DMApiMinorVersion`, `DMApiPatchVersion`, `DirectoryName`, `DmeName`, `EngineVersion`, `GitHubDeploymentId`, `GitHubRepoId`, `JobId`, `MinimumSecurityLevel`, `Output`, `RepositoryOrigin`, `RevisionInformationId`
      ) VALUES (
      5, 9, 0, '5066f759-730a-42c4-bff7-da06c1359fb2', 'tgmc', '515.1633', 1699326356, 158907057, 3831, 0, '-SNIPPED FOR READABILITY-', 'https://github.com/tgstation/TerraGov-Marine-Corps.git', 5445) 
      RETURNING `Id`;
      

      This leads to either duplicated inserts or all but one of the nodes generating an error if it has a unique column:

      2024-08-05 11:07:00   info   : (1) [readwritesplit] (MainCluster); Reply complete from 'us-dos', discarding it: Error: 1062, 23000 Duplicate entry '3831' for key 'IX_CompileJobs_JobId'
      

      (jobid is a 1:1 relationship FK to the job's table, not this table's primary key.)

      Sending `SET AUTOCOMMIT = 1` as a separate query seems to keep it from repoing (see repo notes above)

      Attachments

        1. empty_schema_sql.sql
          19 kB
          MrStonedOne
        2. maxscale.censored.cnf
          2 kB
          MrStonedOne
        3. maxscale.snipped.log
          2 kB
          MrStonedOne

        Issue Links

          Activity

            People

              markus makela markus makela
              MrStonedOne MrStonedOne
              Votes:
              1 Vote for this issue
              Watchers:
              3 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.