You are viewing a plain text version of this content. The canonical link for it is here.
Posted to common-commits@hadoop.apache.org by cu...@apache.org on 2017/08/02 00:25:23 UTC
[41/50] [abbrv] hadoop git commit: YARN-6821. Move
FederationStateStore SQL DDL files from test resource to sbin.
YARN-6821. Move FederationStateStore SQL DDL files from test resource to sbin.
Project: http://git-wip-us.apache.org/repos/asf/hadoop/repo
Commit: http://git-wip-us.apache.org/repos/asf/hadoop/commit/cd9db822
Tree: http://git-wip-us.apache.org/repos/asf/hadoop/tree/cd9db822
Diff: http://git-wip-us.apache.org/repos/asf/hadoop/diff/cd9db822
Branch: refs/heads/YARN-2915
Commit: cd9db822f0c1efc52005b1c069d52910d88038d9
Parents: 8820693
Author: Subru Krishnan <su...@apache.org>
Authored: Thu Jul 13 18:53:21 2017 -0700
Committer: Carlo Curino <cu...@apache.org>
Committed: Tue Aug 1 17:22:13 2017 -0700
----------------------------------------------------------------------
.../resources/assemblies/hadoop-yarn-dist.xml | 1 +
.../FederationStateStoreStoreProcs.sql | 511 +++++++++++++++++++
.../SQLServer/FederationStateStoreTables.sql | 122 +++++
.../FederationStateStoreStoreProcs.sql | 511 -------------------
.../SQLServer/FederationStateStoreTables.sql | 122 -----
5 files changed, 634 insertions(+), 633 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/hadoop/blob/cd9db822/hadoop-assemblies/src/main/resources/assemblies/hadoop-yarn-dist.xml
----------------------------------------------------------------------
diff --git a/hadoop-assemblies/src/main/resources/assemblies/hadoop-yarn-dist.xml b/hadoop-assemblies/src/main/resources/assemblies/hadoop-yarn-dist.xml
index 74ce9bc..289061f 100644
--- a/hadoop-assemblies/src/main/resources/assemblies/hadoop-yarn-dist.xml
+++ b/hadoop-assemblies/src/main/resources/assemblies/hadoop-yarn-dist.xml
@@ -61,6 +61,7 @@
<include>stop-yarn.sh</include>
<include>start-yarn.cmd</include>
<include>stop-yarn.cmd</include>
+ <include>FederationStateStore**/**</include>
</includes>
<fileMode>0755</fileMode>
</fileSet>
http://git-wip-us.apache.org/repos/asf/hadoop/blob/cd9db822/hadoop-yarn-project/hadoop-yarn/bin/FederationStateStore/SQLServer/FederationStateStoreStoreProcs.sql
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/bin/FederationStateStore/SQLServer/FederationStateStoreStoreProcs.sql b/hadoop-yarn-project/hadoop-yarn/bin/FederationStateStore/SQLServer/FederationStateStoreStoreProcs.sql
new file mode 100644
index 0000000..66d6f0e
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/bin/FederationStateStore/SQLServer/FederationStateStoreStoreProcs.sql
@@ -0,0 +1,511 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+USE [FederationStateStore]
+GO
+
+IF OBJECT_ID ( '[sp_addApplicationHomeSubCluster]', 'P' ) IS NOT NULL
+ DROP PROCEDURE [sp_addApplicationHomeSubCluster];
+GO
+
+CREATE PROCEDURE [dbo].[sp_addApplicationHomeSubCluster]
+ @applicationId VARCHAR(64),
+ @homeSubCluster VARCHAR(256),
+ @storedHomeSubCluster VARCHAR(256) OUTPUT,
+ @rowCount int OUTPUT
+AS BEGIN
+ DECLARE @errorMessage nvarchar(4000)
+
+ BEGIN TRY
+ BEGIN TRAN
+ -- If application to sub-cluster map doesn't exist, insert it.
+ -- Otherwise don't change the current mapping.
+ IF NOT EXISTS (SELECT TOP 1 *
+ FROM [dbo].[applicationsHomeSubCluster]
+ WHERE [applicationId] = @applicationId)
+
+ INSERT INTO [dbo].[applicationsHomeSubCluster] (
+ [applicationId],
+ [homeSubCluster])
+ VALUES (
+ @applicationId,
+ @homeSubCluster);
+ -- End of the IF block
+
+ SELECT @rowCount = @@ROWCOUNT;
+
+ SELECT @storedHomeSubCluster = [homeSubCluster]
+ FROM [dbo].[applicationsHomeSubCluster]
+ WHERE [applicationId] = @applicationId;
+
+ 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;
+GO
+
+IF OBJECT_ID ( '[sp_updateApplicationHomeSubCluster]', 'P' ) IS NOT NULL
+ DROP PROCEDURE [sp_updateApplicationHomeSubCluster];
+GO
+
+CREATE PROCEDURE [dbo].[sp_updateApplicationHomeSubCluster]
+ @applicationId VARCHAR(64),
+ @homeSubCluster VARCHAR(256),
+ @rowCount int OUTPUT
+AS BEGIN
+ DECLARE @errorMessage nvarchar(4000)
+
+ BEGIN TRY
+ BEGIN TRAN
+
+ UPDATE [dbo].[applicationsHomeSubCluster]
+ SET [homeSubCluster] = @homeSubCluster
+ WHERE [applicationId] = @applicationid;
+ SELECT @rowCount = @@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;
+GO
+
+IF OBJECT_ID ( '[sp_getApplicationsHomeSubCluster]', 'P' ) IS NOT NULL
+ DROP PROCEDURE [sp_getApplicationsHomeSubCluster];
+GO
+
+CREATE PROCEDURE [dbo].[sp_getApplicationsHomeSubCluster]
+AS BEGIN
+ DECLARE @errorMessage nvarchar(4000)
+
+ BEGIN TRY
+ SELECT [applicationId], [homeSubCluster], [createTime]
+ FROM [dbo].[applicationsHomeSubCluster]
+ END TRY
+
+ BEGIN CATCH
+ 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;
+GO
+
+IF OBJECT_ID ( '[sp_getApplicationHomeSubCluster]', 'P' ) IS NOT NULL
+ DROP PROCEDURE [sp_getApplicationHomeSubCluster];
+GO
+
+CREATE PROCEDURE [dbo].[sp_getApplicationHomeSubCluster]
+ @applicationId VARCHAR(64),
+ @homeSubCluster VARCHAR(256) OUTPUT
+AS BEGIN
+ DECLARE @errorMessage nvarchar(4000)
+
+ BEGIN TRY
+
+ SELECT @homeSubCluster = [homeSubCluster]
+ FROM [dbo].[applicationsHomeSubCluster]
+ WHERE [applicationId] = @applicationid;
+
+ END TRY
+
+ BEGIN CATCH
+
+ 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;
+GO
+
+IF OBJECT_ID ( '[sp_deleteApplicationHomeSubCluster]', 'P' ) IS NOT NULL
+ DROP PROCEDURE [sp_deleteApplicationHomeSubCluster];
+GO
+
+CREATE PROCEDURE [dbo].[sp_deleteApplicationHomeSubCluster]
+ @applicationId VARCHAR(64),
+ @rowCount int OUTPUT
+AS BEGIN
+ DECLARE @errorMessage nvarchar(4000)
+
+ BEGIN TRY
+ BEGIN TRAN
+
+ DELETE FROM [dbo].[applicationsHomeSubCluster]
+ WHERE [applicationId] = @applicationId;
+ SELECT @rowCount = @@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;
+GO
+
+IF OBJECT_ID ( '[sp_registerSubCluster]', 'P' ) IS NOT NULL
+ DROP PROCEDURE [sp_registerSubCluster];
+GO
+
+CREATE PROCEDURE [dbo].[sp_registerSubCluster]
+ @subClusterId VARCHAR(256),
+ @amRMServiceAddress VARCHAR(256),
+ @clientRMServiceAddress VARCHAR(256),
+ @rmAdminServiceAddress VARCHAR(256),
+ @rmWebServiceAddress VARCHAR(256),
+ @state VARCHAR(32),
+ @lastStartTime BIGINT,
+ @capability VARCHAR(6000),
+ @rowCount int OUTPUT
+AS BEGIN
+ DECLARE @errorMessage nvarchar(4000)
+
+ BEGIN TRY
+ BEGIN TRAN
+
+ DELETE FROM [dbo].[membership]
+ WHERE [subClusterId] = @subClusterId;
+ INSERT INTO [dbo].[membership] (
+ [subClusterId],
+ [amRMServiceAddress],
+ [clientRMServiceAddress],
+ [rmAdminServiceAddress],
+ [rmWebServiceAddress],
+ [lastHeartBeat],
+ [state],
+ [lastStartTime],
+ [capability] )
+ VALUES (
+ @subClusterId,
+ @amRMServiceAddress,
+ @clientRMServiceAddress,
+ @rmAdminServiceAddress,
+ @rmWebServiceAddress,
+ GETUTCDATE(),
+ @state,
+ @lastStartTime,
+ @capability);
+ SELECT @rowCount = @@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;
+GO
+
+IF OBJECT_ID ( '[sp_getSubClusters]', 'P' ) IS NOT NULL
+ DROP PROCEDURE [sp_getSubClusters];
+GO
+
+CREATE PROCEDURE [dbo].[sp_getSubClusters]
+AS BEGIN
+ DECLARE @errorMessage nvarchar(4000)
+
+ BEGIN TRY
+ SELECT [subClusterId], [amRMServiceAddress], [clientRMServiceAddress],
+ [rmAdminServiceAddress], [rmWebServiceAddress], [lastHeartBeat],
+ [state], [lastStartTime], [capability]
+ FROM [dbo].[membership]
+ END TRY
+
+ BEGIN CATCH
+ 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;
+GO
+
+IF OBJECT_ID ( '[sp_getSubCluster]', 'P' ) IS NOT NULL
+ DROP PROCEDURE [sp_getSubCluster];
+GO
+
+CREATE PROCEDURE [dbo].[sp_getSubCluster]
+ @subClusterId VARCHAR(256),
+ @amRMServiceAddress VARCHAR(256) OUTPUT,
+ @clientRMServiceAddress VARCHAR(256) OUTPUT,
+ @rmAdminServiceAddress VARCHAR(256) OUTPUT,
+ @rmWebServiceAddress VARCHAR(256) OUTPUT,
+ @lastHeartbeat DATETIME2 OUTPUT,
+ @state VARCHAR(256) OUTPUT,
+ @lastStartTime BIGINT OUTPUT,
+ @capability VARCHAR(6000) OUTPUT
+AS BEGIN
+ DECLARE @errorMessage nvarchar(4000)
+
+ BEGIN TRY
+ BEGIN TRAN
+
+ SELECT @subClusterId = [subClusterId],
+ @amRMServiceAddress = [amRMServiceAddress],
+ @clientRMServiceAddress = [clientRMServiceAddress],
+ @rmAdminServiceAddress = [rmAdminServiceAddress],
+ @rmWebServiceAddress = [rmWebServiceAddress],
+ @lastHeartBeat = [lastHeartBeat],
+ @state = [state],
+ @lastStartTime = [lastStartTime],
+ @capability = [capability]
+ FROM [dbo].[membership]
+ WHERE [subClusterId] = @subClusterId
+
+ 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;
+GO
+
+
+IF OBJECT_ID ( '[sp_subClusterHeartbeat]', 'P' ) IS NOT NULL
+ DROP PROCEDURE [sp_subClusterHeartbeat];
+GO
+
+CREATE PROCEDURE [dbo].[sp_subClusterHeartbeat]
+ @subClusterId VARCHAR(256),
+ @state VARCHAR(256),
+ @capability VARCHAR(6000),
+ @rowCount int OUTPUT
+AS BEGIN
+ DECLARE @errorMessage nvarchar(4000)
+
+ BEGIN TRY
+ BEGIN TRAN
+
+ UPDATE [dbo].[membership]
+ SET [state] = @state,
+ [lastHeartbeat] = GETUTCDATE(),
+ [capability] = @capability
+ WHERE [subClusterId] = @subClusterId;
+ SELECT @rowCount = @@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;
+GO
+
+IF OBJECT_ID ( '[sp_deregisterSubCluster]', 'P' ) IS NOT NULL
+ DROP PROCEDURE [sp_deregisterSubCluster];
+GO
+
+CREATE PROCEDURE [dbo].[sp_deregisterSubCluster]
+ @subClusterId VARCHAR(256),
+ @state VARCHAR(256),
+ @rowCount int OUTPUT
+AS BEGIN
+ DECLARE @errorMessage nvarchar(4000)
+
+ BEGIN TRY
+ BEGIN TRAN
+
+ UPDATE [dbo].[membership]
+ SET [state] = @state
+ WHERE [subClusterId] = @subClusterId;
+ SELECT @rowCount = @@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;
+GO
+
+IF OBJECT_ID ( '[sp_setPolicyConfiguration]', 'P' ) IS NOT NULL
+ DROP PROCEDURE [sp_setPolicyConfiguration];
+GO
+
+CREATE PROCEDURE [dbo].[sp_setPolicyConfiguration]
+ @queue VARCHAR(256),
+ @policyType VARCHAR(256),
+ @params VARBINARY(512),
+ @rowCount int OUTPUT
+AS BEGIN
+ DECLARE @errorMessage nvarchar(4000)
+
+ BEGIN TRY
+ BEGIN TRAN
+
+ DELETE FROM [dbo].[policies]
+ WHERE [queue] = @queue;
+ INSERT INTO [dbo].[policies] (
+ [queue],
+ [policyType],
+ [params])
+ VALUES (
+ @queue,
+ @policyType,
+ @params);
+ SELECT @rowCount = @@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;
+GO
+
+IF OBJECT_ID ( '[sp_getPolicyConfiguration]', 'P' ) IS NOT NULL
+ DROP PROCEDURE [sp_getPolicyConfiguration];
+GO
+
+CREATE PROCEDURE [dbo].[sp_getPolicyConfiguration]
+ @queue VARCHAR(256),
+ @policyType VARCHAR(256) OUTPUT,
+ @params VARBINARY(6000) OUTPUT
+AS BEGIN
+ DECLARE @errorMessage nvarchar(4000)
+
+ BEGIN TRY
+
+ SELECT @policyType = [policyType],
+ @params = [params]
+ FROM [dbo].[policies]
+ WHERE [queue] = @queue
+
+ END TRY
+
+ BEGIN CATCH
+
+ 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;
+GO
+
+IF OBJECT_ID ( '[sp_getPoliciesConfigurations]', 'P' ) IS NOT NULL
+ DROP PROCEDURE [sp_getPoliciesConfigurations];
+GO
+
+CREATE PROCEDURE [dbo].[sp_getPoliciesConfigurations]
+AS BEGIN
+ DECLARE @errorMessage nvarchar(4000)
+
+ BEGIN TRY
+ SELECT [queue], [policyType], [params] FROM [dbo].[policies]
+ END TRY
+
+ BEGIN CATCH
+ 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;
+GO
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/hadoop/blob/cd9db822/hadoop-yarn-project/hadoop-yarn/bin/FederationStateStore/SQLServer/FederationStateStoreTables.sql
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/bin/FederationStateStore/SQLServer/FederationStateStoreTables.sql b/hadoop-yarn-project/hadoop-yarn/bin/FederationStateStore/SQLServer/FederationStateStoreTables.sql
new file mode 100644
index 0000000..a97385b
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/bin/FederationStateStore/SQLServer/FederationStateStoreTables.sql
@@ -0,0 +1,122 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+USE [FederationStateStore]
+GO
+
+IF NOT EXISTS ( SELECT * FROM [FederationStateStore].sys.tables
+ WHERE name = 'applicationsHomeSubCluster'
+ AND schema_id = SCHEMA_ID('dbo'))
+ BEGIN
+ PRINT 'Table applicationsHomeSubCluster does not exist, create it...'
+
+ SET ANSI_NULLS ON
+
+ SET QUOTED_IDENTIFIER ON
+
+ SET ANSI_PADDING ON
+
+ CREATE TABLE [dbo].[applicationsHomeSubCluster](
+ applicationId VARCHAR(64) COLLATE Latin1_General_100_BIN2 NOT NULL,
+ homeSubCluster VARCHAR(256) NOT NULL,
+ createTime DATETIME2 NOT NULL CONSTRAINT ts_createAppTime DEFAULT GETUTCDATE(),
+
+ CONSTRAINT [pk_applicationId] PRIMARY KEY
+ (
+ [applicationId]
+ )
+ )
+
+ SET ANSI_PADDING OFF
+
+ PRINT 'Table applicationsHomeSubCluster created.'
+ END
+ELSE
+ PRINT 'Table applicationsHomeSubCluster exists, no operation required...'
+ GO
+GO
+
+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]
+ )
+ )
+
+ SET ANSI_PADDING OFF
+
+ PRINT 'Table membership created.'
+ END
+ELSE
+ PRINT 'Table membership exists, no operation required...'
+ GO
+GO
+
+IF NOT EXISTS ( SELECT * FROM [FederationStateStore].sys.tables
+ WHERE name = 'policies'
+ AND schema_id = SCHEMA_ID('dbo'))
+ BEGIN
+ PRINT 'Table policies does not exist, create it...'
+
+ SET ANSI_NULLS ON
+
+ SET QUOTED_IDENTIFIER ON
+
+ SET ANSI_PADDING ON
+
+ CREATE TABLE [dbo].[policies](
+ queue VARCHAR(256) COLLATE Latin1_General_100_BIN2 NOT NULL,
+ policyType VARCHAR(256) NOT NULL,
+ params VARBINARY(6000) NOT NULL,
+
+ CONSTRAINT [pk_queue] PRIMARY KEY
+ (
+ [queue]
+ )
+ )
+
+ SET ANSI_PADDING OFF
+
+ PRINT 'Table policies created.'
+ END
+ELSE
+ PRINT 'Table policies exists, no operation required...'
+ GO
+GO
http://git-wip-us.apache.org/repos/asf/hadoop/blob/cd9db822/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-common/src/test/resources/FederationStateStore/SQLServer/FederationStateStoreStoreProcs.sql
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-common/src/test/resources/FederationStateStore/SQLServer/FederationStateStoreStoreProcs.sql b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-common/src/test/resources/FederationStateStore/SQLServer/FederationStateStoreStoreProcs.sql
deleted file mode 100644
index 66d6f0e..0000000
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-common/src/test/resources/FederationStateStore/SQLServer/FederationStateStoreStoreProcs.sql
+++ /dev/null
@@ -1,511 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-USE [FederationStateStore]
-GO
-
-IF OBJECT_ID ( '[sp_addApplicationHomeSubCluster]', 'P' ) IS NOT NULL
- DROP PROCEDURE [sp_addApplicationHomeSubCluster];
-GO
-
-CREATE PROCEDURE [dbo].[sp_addApplicationHomeSubCluster]
- @applicationId VARCHAR(64),
- @homeSubCluster VARCHAR(256),
- @storedHomeSubCluster VARCHAR(256) OUTPUT,
- @rowCount int OUTPUT
-AS BEGIN
- DECLARE @errorMessage nvarchar(4000)
-
- BEGIN TRY
- BEGIN TRAN
- -- If application to sub-cluster map doesn't exist, insert it.
- -- Otherwise don't change the current mapping.
- IF NOT EXISTS (SELECT TOP 1 *
- FROM [dbo].[applicationsHomeSubCluster]
- WHERE [applicationId] = @applicationId)
-
- INSERT INTO [dbo].[applicationsHomeSubCluster] (
- [applicationId],
- [homeSubCluster])
- VALUES (
- @applicationId,
- @homeSubCluster);
- -- End of the IF block
-
- SELECT @rowCount = @@ROWCOUNT;
-
- SELECT @storedHomeSubCluster = [homeSubCluster]
- FROM [dbo].[applicationsHomeSubCluster]
- WHERE [applicationId] = @applicationId;
-
- 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;
-GO
-
-IF OBJECT_ID ( '[sp_updateApplicationHomeSubCluster]', 'P' ) IS NOT NULL
- DROP PROCEDURE [sp_updateApplicationHomeSubCluster];
-GO
-
-CREATE PROCEDURE [dbo].[sp_updateApplicationHomeSubCluster]
- @applicationId VARCHAR(64),
- @homeSubCluster VARCHAR(256),
- @rowCount int OUTPUT
-AS BEGIN
- DECLARE @errorMessage nvarchar(4000)
-
- BEGIN TRY
- BEGIN TRAN
-
- UPDATE [dbo].[applicationsHomeSubCluster]
- SET [homeSubCluster] = @homeSubCluster
- WHERE [applicationId] = @applicationid;
- SELECT @rowCount = @@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;
-GO
-
-IF OBJECT_ID ( '[sp_getApplicationsHomeSubCluster]', 'P' ) IS NOT NULL
- DROP PROCEDURE [sp_getApplicationsHomeSubCluster];
-GO
-
-CREATE PROCEDURE [dbo].[sp_getApplicationsHomeSubCluster]
-AS BEGIN
- DECLARE @errorMessage nvarchar(4000)
-
- BEGIN TRY
- SELECT [applicationId], [homeSubCluster], [createTime]
- FROM [dbo].[applicationsHomeSubCluster]
- END TRY
-
- BEGIN CATCH
- 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;
-GO
-
-IF OBJECT_ID ( '[sp_getApplicationHomeSubCluster]', 'P' ) IS NOT NULL
- DROP PROCEDURE [sp_getApplicationHomeSubCluster];
-GO
-
-CREATE PROCEDURE [dbo].[sp_getApplicationHomeSubCluster]
- @applicationId VARCHAR(64),
- @homeSubCluster VARCHAR(256) OUTPUT
-AS BEGIN
- DECLARE @errorMessage nvarchar(4000)
-
- BEGIN TRY
-
- SELECT @homeSubCluster = [homeSubCluster]
- FROM [dbo].[applicationsHomeSubCluster]
- WHERE [applicationId] = @applicationid;
-
- END TRY
-
- BEGIN CATCH
-
- 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;
-GO
-
-IF OBJECT_ID ( '[sp_deleteApplicationHomeSubCluster]', 'P' ) IS NOT NULL
- DROP PROCEDURE [sp_deleteApplicationHomeSubCluster];
-GO
-
-CREATE PROCEDURE [dbo].[sp_deleteApplicationHomeSubCluster]
- @applicationId VARCHAR(64),
- @rowCount int OUTPUT
-AS BEGIN
- DECLARE @errorMessage nvarchar(4000)
-
- BEGIN TRY
- BEGIN TRAN
-
- DELETE FROM [dbo].[applicationsHomeSubCluster]
- WHERE [applicationId] = @applicationId;
- SELECT @rowCount = @@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;
-GO
-
-IF OBJECT_ID ( '[sp_registerSubCluster]', 'P' ) IS NOT NULL
- DROP PROCEDURE [sp_registerSubCluster];
-GO
-
-CREATE PROCEDURE [dbo].[sp_registerSubCluster]
- @subClusterId VARCHAR(256),
- @amRMServiceAddress VARCHAR(256),
- @clientRMServiceAddress VARCHAR(256),
- @rmAdminServiceAddress VARCHAR(256),
- @rmWebServiceAddress VARCHAR(256),
- @state VARCHAR(32),
- @lastStartTime BIGINT,
- @capability VARCHAR(6000),
- @rowCount int OUTPUT
-AS BEGIN
- DECLARE @errorMessage nvarchar(4000)
-
- BEGIN TRY
- BEGIN TRAN
-
- DELETE FROM [dbo].[membership]
- WHERE [subClusterId] = @subClusterId;
- INSERT INTO [dbo].[membership] (
- [subClusterId],
- [amRMServiceAddress],
- [clientRMServiceAddress],
- [rmAdminServiceAddress],
- [rmWebServiceAddress],
- [lastHeartBeat],
- [state],
- [lastStartTime],
- [capability] )
- VALUES (
- @subClusterId,
- @amRMServiceAddress,
- @clientRMServiceAddress,
- @rmAdminServiceAddress,
- @rmWebServiceAddress,
- GETUTCDATE(),
- @state,
- @lastStartTime,
- @capability);
- SELECT @rowCount = @@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;
-GO
-
-IF OBJECT_ID ( '[sp_getSubClusters]', 'P' ) IS NOT NULL
- DROP PROCEDURE [sp_getSubClusters];
-GO
-
-CREATE PROCEDURE [dbo].[sp_getSubClusters]
-AS BEGIN
- DECLARE @errorMessage nvarchar(4000)
-
- BEGIN TRY
- SELECT [subClusterId], [amRMServiceAddress], [clientRMServiceAddress],
- [rmAdminServiceAddress], [rmWebServiceAddress], [lastHeartBeat],
- [state], [lastStartTime], [capability]
- FROM [dbo].[membership]
- END TRY
-
- BEGIN CATCH
- 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;
-GO
-
-IF OBJECT_ID ( '[sp_getSubCluster]', 'P' ) IS NOT NULL
- DROP PROCEDURE [sp_getSubCluster];
-GO
-
-CREATE PROCEDURE [dbo].[sp_getSubCluster]
- @subClusterId VARCHAR(256),
- @amRMServiceAddress VARCHAR(256) OUTPUT,
- @clientRMServiceAddress VARCHAR(256) OUTPUT,
- @rmAdminServiceAddress VARCHAR(256) OUTPUT,
- @rmWebServiceAddress VARCHAR(256) OUTPUT,
- @lastHeartbeat DATETIME2 OUTPUT,
- @state VARCHAR(256) OUTPUT,
- @lastStartTime BIGINT OUTPUT,
- @capability VARCHAR(6000) OUTPUT
-AS BEGIN
- DECLARE @errorMessage nvarchar(4000)
-
- BEGIN TRY
- BEGIN TRAN
-
- SELECT @subClusterId = [subClusterId],
- @amRMServiceAddress = [amRMServiceAddress],
- @clientRMServiceAddress = [clientRMServiceAddress],
- @rmAdminServiceAddress = [rmAdminServiceAddress],
- @rmWebServiceAddress = [rmWebServiceAddress],
- @lastHeartBeat = [lastHeartBeat],
- @state = [state],
- @lastStartTime = [lastStartTime],
- @capability = [capability]
- FROM [dbo].[membership]
- WHERE [subClusterId] = @subClusterId
-
- 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;
-GO
-
-
-IF OBJECT_ID ( '[sp_subClusterHeartbeat]', 'P' ) IS NOT NULL
- DROP PROCEDURE [sp_subClusterHeartbeat];
-GO
-
-CREATE PROCEDURE [dbo].[sp_subClusterHeartbeat]
- @subClusterId VARCHAR(256),
- @state VARCHAR(256),
- @capability VARCHAR(6000),
- @rowCount int OUTPUT
-AS BEGIN
- DECLARE @errorMessage nvarchar(4000)
-
- BEGIN TRY
- BEGIN TRAN
-
- UPDATE [dbo].[membership]
- SET [state] = @state,
- [lastHeartbeat] = GETUTCDATE(),
- [capability] = @capability
- WHERE [subClusterId] = @subClusterId;
- SELECT @rowCount = @@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;
-GO
-
-IF OBJECT_ID ( '[sp_deregisterSubCluster]', 'P' ) IS NOT NULL
- DROP PROCEDURE [sp_deregisterSubCluster];
-GO
-
-CREATE PROCEDURE [dbo].[sp_deregisterSubCluster]
- @subClusterId VARCHAR(256),
- @state VARCHAR(256),
- @rowCount int OUTPUT
-AS BEGIN
- DECLARE @errorMessage nvarchar(4000)
-
- BEGIN TRY
- BEGIN TRAN
-
- UPDATE [dbo].[membership]
- SET [state] = @state
- WHERE [subClusterId] = @subClusterId;
- SELECT @rowCount = @@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;
-GO
-
-IF OBJECT_ID ( '[sp_setPolicyConfiguration]', 'P' ) IS NOT NULL
- DROP PROCEDURE [sp_setPolicyConfiguration];
-GO
-
-CREATE PROCEDURE [dbo].[sp_setPolicyConfiguration]
- @queue VARCHAR(256),
- @policyType VARCHAR(256),
- @params VARBINARY(512),
- @rowCount int OUTPUT
-AS BEGIN
- DECLARE @errorMessage nvarchar(4000)
-
- BEGIN TRY
- BEGIN TRAN
-
- DELETE FROM [dbo].[policies]
- WHERE [queue] = @queue;
- INSERT INTO [dbo].[policies] (
- [queue],
- [policyType],
- [params])
- VALUES (
- @queue,
- @policyType,
- @params);
- SELECT @rowCount = @@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;
-GO
-
-IF OBJECT_ID ( '[sp_getPolicyConfiguration]', 'P' ) IS NOT NULL
- DROP PROCEDURE [sp_getPolicyConfiguration];
-GO
-
-CREATE PROCEDURE [dbo].[sp_getPolicyConfiguration]
- @queue VARCHAR(256),
- @policyType VARCHAR(256) OUTPUT,
- @params VARBINARY(6000) OUTPUT
-AS BEGIN
- DECLARE @errorMessage nvarchar(4000)
-
- BEGIN TRY
-
- SELECT @policyType = [policyType],
- @params = [params]
- FROM [dbo].[policies]
- WHERE [queue] = @queue
-
- END TRY
-
- BEGIN CATCH
-
- 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;
-GO
-
-IF OBJECT_ID ( '[sp_getPoliciesConfigurations]', 'P' ) IS NOT NULL
- DROP PROCEDURE [sp_getPoliciesConfigurations];
-GO
-
-CREATE PROCEDURE [dbo].[sp_getPoliciesConfigurations]
-AS BEGIN
- DECLARE @errorMessage nvarchar(4000)
-
- BEGIN TRY
- SELECT [queue], [policyType], [params] FROM [dbo].[policies]
- END TRY
-
- BEGIN CATCH
- 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;
-GO
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/hadoop/blob/cd9db822/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-common/src/test/resources/FederationStateStore/SQLServer/FederationStateStoreTables.sql
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-common/src/test/resources/FederationStateStore/SQLServer/FederationStateStoreTables.sql b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-common/src/test/resources/FederationStateStore/SQLServer/FederationStateStoreTables.sql
deleted file mode 100644
index a97385b..0000000
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-common/src/test/resources/FederationStateStore/SQLServer/FederationStateStoreTables.sql
+++ /dev/null
@@ -1,122 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-USE [FederationStateStore]
-GO
-
-IF NOT EXISTS ( SELECT * FROM [FederationStateStore].sys.tables
- WHERE name = 'applicationsHomeSubCluster'
- AND schema_id = SCHEMA_ID('dbo'))
- BEGIN
- PRINT 'Table applicationsHomeSubCluster does not exist, create it...'
-
- SET ANSI_NULLS ON
-
- SET QUOTED_IDENTIFIER ON
-
- SET ANSI_PADDING ON
-
- CREATE TABLE [dbo].[applicationsHomeSubCluster](
- applicationId VARCHAR(64) COLLATE Latin1_General_100_BIN2 NOT NULL,
- homeSubCluster VARCHAR(256) NOT NULL,
- createTime DATETIME2 NOT NULL CONSTRAINT ts_createAppTime DEFAULT GETUTCDATE(),
-
- CONSTRAINT [pk_applicationId] PRIMARY KEY
- (
- [applicationId]
- )
- )
-
- SET ANSI_PADDING OFF
-
- PRINT 'Table applicationsHomeSubCluster created.'
- END
-ELSE
- PRINT 'Table applicationsHomeSubCluster exists, no operation required...'
- GO
-GO
-
-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]
- )
- )
-
- SET ANSI_PADDING OFF
-
- PRINT 'Table membership created.'
- END
-ELSE
- PRINT 'Table membership exists, no operation required...'
- GO
-GO
-
-IF NOT EXISTS ( SELECT * FROM [FederationStateStore].sys.tables
- WHERE name = 'policies'
- AND schema_id = SCHEMA_ID('dbo'))
- BEGIN
- PRINT 'Table policies does not exist, create it...'
-
- SET ANSI_NULLS ON
-
- SET QUOTED_IDENTIFIER ON
-
- SET ANSI_PADDING ON
-
- CREATE TABLE [dbo].[policies](
- queue VARCHAR(256) COLLATE Latin1_General_100_BIN2 NOT NULL,
- policyType VARCHAR(256) NOT NULL,
- params VARBINARY(6000) NOT NULL,
-
- CONSTRAINT [pk_queue] PRIMARY KEY
- (
- [queue]
- )
- )
-
- SET ANSI_PADDING OFF
-
- PRINT 'Table policies created.'
- END
-ELSE
- PRINT 'Table policies exists, no operation required...'
- GO
-GO
---------------------------------------------------------------------
To unsubscribe, e-mail: common-commits-unsubscribe@hadoop.apache.org
For additional commands, e-mail: common-commits-help@hadoop.apache.org