slfan1989 commented on PR #5244:
URL: https://github.com/apache/hadoop/pull/5244#issuecomment-1403352045

   > SQL Server 2008 R2 Enterprise
   
   
   > select @@version
   ```
   Microsoft SQL Server 2008 R2 (SP3) - 10.50.6000.34 (X64) 
        Aug 19 2014 12:21:34 
        Copyright (c) Microsoft Corporation
        Enterprise Edition (64-bit) on Windows NT 6.3 <X64> (Build 9600: )
   ```
   
   > FederationStateStoreDatabase.sql
   ```
   master> IF DB_ID ( '[FederationStateStore]') IS NOT NULL
             DROP DATABASE [FederationStateStore]
   [2023-01-25 17:22:05] completed in 41 ms
   master> CREATE database FederationStateStore
   [2023-01-25 17:22:05] completed in 106 ms
   ```
   
   > FederationStateStoreUser.sql
   ```
   master> USE [FederationStateStore]
   [2023-01-25 17:23:20] [S0001][5701] Changed database context to 
'FederationStateStore'.
   [2023-01-25 17:23:20] completed in 41 ms
   master> CREATE LOGIN FederationUser with password = 'Federation@Password', 
default_database=[FederationStateStore]
   [2023-01-25 17:23:21] completed in 51 ms
   master> CREATE USER FederationUser FOR LOGIN FederationUser WITH 
default_schema=dbo
   [2023-01-25 17:23:21] completed in 41 ms
   master> EXEC sp_addrolemember 'db_owner', 'FederationUser'
   [2023-01-25 17:23:21] completed in 41 ms
   ```
   
   > FederationStateStoreTables.sql
   ```
   ....
   Table delegationTokens exists, no operation required...
   [2023-01-25 17:24:34] completed in 44 ms
   FederationStateStore> IF NOT EXISTS ( SELECT * FROM 
[FederationStateStore].sys.tables
                             WHERE name = 'sequenceTable'
                             AND schema_id = SCHEMA_ID('dbo'))
                             BEGIN
                                 PRINT 'Table sequenceTable does not exist, 
create it...'
                         
                                 SET ANSI_NULLS ON
                         
                                 SET QUOTED_IDENTIFIER ON
                         
                                 SET ANSI_PADDING ON
                         
                                 CREATE TABLE [dbo].[sequenceTable](
                                     sequenceName VARCHAR(255) NOT NULL,
                                     nextVal bigint NOT NULL
                                     CONSTRAINT [pk_sequenceName] PRIMARY KEY
                                     (
                                         [sequenceName]
                                     )
                                 )
                         
                                 SET ANSI_PADDING OFF
                         
                                 PRINT 'Table sequenceTable created.'
                             END
                         ELSE
                             PRINT 'Table sequenceTable exists, no operation 
required...'
   Table sequenceTable does not exist, create it...
   Table sequenceTable created.
   ```
   
   ```
   USE [FederationStateStore]
   GO
   SELECT Name FROM SysObjects Where XType='U' ORDER BY Name
   
   applicationsHomeSubCluster
   delegationTokens
   masterKeys
   membership
   policies
   reservationsHomeSubCluster
   sequenceTable
   ```
   
   > FederationStateStoreStoredProcs.sql
   
   ```
   [2023-01-25 17:53:48] completed in 39 ms
   FederationStateStore> CREATE PROCEDURE [dbo].[sp_deleteDelegationToken]
                             @sequenceNum_IN bigint,
                             @rowCount_OUT int OUTPUT
                         AS BEGIN
                             DECLARE @errorMessage nvarchar(4000)
                         
                             BEGIN TRY
                                 BEGIN TRAN
                         
                                     DELETE FROM [dbo].[delegationTokens]
                                     WHERE [sequenceNum] = @sequenceNum_IN;
                                     SELECT @rowCount_OUT = @@ROWCOUNT;
                         
                                 COMMIT TRAN
                             END TRY
                         
                             BEGIN CATCH
                                 ROLLBACK TRAN
                         
                                 SET @errorMessage = 
dbo.func_FormatErrorMessage(ERROR_MESSAGE(), ERROR_LINE())
                         
                                 /*  raise error and terminate the execution */
                                 RAISERROR(@errorMessage, --- Error Message
                                     1, -- Severity
                                     -1 -- State
                                 ) WITH log
                             END CATCH
                         END;
   [2023-01-25 17:53:48] completed in 44 ms
   ```
   
   
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: common-issues-unsubscr...@hadoop.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: common-issues-unsubscr...@hadoop.apache.org
For additional commands, e-mail: common-issues-h...@hadoop.apache.org

Reply via email to