From d331a2a0c2e430030bf82ba44b677b13cc8e8bc5 Mon Sep 17 00:00:00 2001 From: Giovanni Matteo Fumarola Date: Fri, 3 May 2019 15:05:17 -0700 Subject: [PATCH] YARN-9528. Federation RMs starting up at the same time can give duplicate application IDs. Contributed by Young Chen. --- .../FederationStateStore/MySQL/FederationStateStoreTables.sql | 1 + .../SQLServer/FederationStateStoreTables.sql | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/hadoop-yarn-project/hadoop-yarn/bin/FederationStateStore/MySQL/FederationStateStoreTables.sql b/hadoop-yarn-project/hadoop-yarn/bin/FederationStateStore/MySQL/FederationStateStoreTables.sql index 57cecb2e33d..3a255f06bc3 100644 --- a/hadoop-yarn-project/hadoop-yarn/bin/FederationStateStore/MySQL/FederationStateStoreTables.sql +++ b/hadoop-yarn-project/hadoop-yarn/bin/FederationStateStore/MySQL/FederationStateStoreTables.sql @@ -37,6 +37,7 @@ CREATE TABLE membership( lastStartTime bigint NULL, capability varchar(6000), CONSTRAINT pk_subClusterId PRIMARY KEY (subClusterId) + UNIQUE(lastStartTime) ); CREATE TABLE policies( diff --git a/hadoop-yarn-project/hadoop-yarn/bin/FederationStateStore/SQLServer/FederationStateStoreTables.sql b/hadoop-yarn-project/hadoop-yarn/bin/FederationStateStore/SQLServer/FederationStateStoreTables.sql index a97385b4962..c16091ccf14 100644 --- a/hadoop-yarn-project/hadoop-yarn/bin/FederationStateStore/SQLServer/FederationStateStoreTables.sql +++ b/hadoop-yarn-project/hadoop-yarn/bin/FederationStateStore/SQLServer/FederationStateStoreTables.sql @@ -78,6 +78,10 @@ IF NOT EXISTS ( SELECT * FROM [FederationStateStore].sys.tables ( [subClusterId] ) + CONSTRAINT [uc_lastStartTime] UNIQUE + ( + [lastStartTime] + ) ) SET ANSI_PADDING OFF