Uploaded image for project: 'Hadoop YARN'
  1. Hadoop YARN
  2. YARN-11296

Fix SQLFederationStateStore#Sql script bug

    XMLWordPrintableJSON

Details

    • Reviewed

    Description

      MySQL:

      FederationStateStoreTables.sql cannot create membership table, both in MySQL 5.7 and MySQL 8.0.

       

      CREATE TABLE membership(
         subClusterId varchar(256) NOT NULL,
         amRMServiceAddress varchar(256) NOT NULL,
         clientRMServiceAddress varchar(256) NOT NULL,
         rmAdminServiceAddress varchar(256) NOT NULL,
         rmWebServiceAddress varchar(256) NOT NULL,
         lastHeartBeat datetime NOT NULL,
         state varchar(32) NOT NULL,
         lastStartTime bigint NULL,
         capability varchar(6000),
         CONSTRAINT pk_subClusterId PRIMARY KEY (subClusterId), -- missing comma    UNIQUE(lastStartTime)
      ); 

       

      SQLServer:

      FederationStateStoreTables.sql

       

      IF NOT EXISTS ( SELECT * FROM [FederationStateStore].sys.tables
          WHERE name = 'membership'
          AND schema_id = SCHEMA_ID('dbo'))
          BEGIN
              PRINT 'Table membership does not exist, create it...'
      
              SET ANSI_NULLS ON
      
              SET QUOTED_IDENTIFIER ON
      
              SET ANSI_PADDING ON
      
              CREATE TABLE [dbo].[membership](
                  [subClusterId]            VARCHAR(256) COLLATE Latin1_General_100_BIN2 NOT NULL,
                  [amRMServiceAddress]      VARCHAR(256) NOT NULL,
                  [clientRMServiceAddress]  VARCHAR(256) NOT NULL,
                  [rmAdminServiceAddress]   VARCHAR(256) NOT NULL,
                  [rmWebServiceAddress]     VARCHAR(256) NOT NULL,
                  [lastHeartBeat]           DATETIME2 NOT NULL,
                  [state]                   VARCHAR(32) NOT NULL,
                  [lastStartTime]           BIGINT NOT NULL,
                  [capability]              VARCHAR(6000) NOT NULL,
      
                  CONSTRAINT [pk_subClusterId] PRIMARY KEY
                  (
                      [subClusterId]
                  ), -- missing comma
                  CONSTRAINT [uc_lastStartTime] UNIQUE
                  (
                      [lastStartTime]
                  )
              )
      
              SET ANSI_PADDING OFF
      
              PRINT 'Table membership created.'
          END
      ELSE
          PRINT 'Table membership exists, no operation required...'
          GO
      GO 

       

       

      Attachments

        Issue Links

          Activity

            People

              slfan1989 Shilun Fan
              slfan1989 Shilun Fan
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: