registry icon indicating copy to clipboard operation
registry copied to clipboard

Error while running Bootstrap script

Open arcticOak2 opened this issue 6 years ago • 0 comments

After running

./bootstrap/bootstrap-storage.sh

log:

Using Configuration file: ./bootstrap/../conf/registry.yaml
######## SQL Query:  -- Copyright 2016 Hortonworks.
--
-- Licensed under the Apache License, Version 2.0 (the "License") 
######## Query executed
######## SQL Query:  -- 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.

-- THE NAMES OF THE TABLE COLUMNS MUST MATCH THE NAMES OF THE CORRESPONDING CLASS MODEL FIELDS

CREATE TABLE IF NOT EXISTS schema_metadata_info (
  id            BIGINT AUTO_INCREMENT NOT NULL,
  type          VARCHAR(256)          NOT NULL,
  schemaGroup   VARCHAR(256)          NOT NULL,
  name          VARCHAR(256)          NOT NULL,
  compatibility VARCHAR(256)          NOT NULL,
  description   TEXT,
  evolve        BOOLEAN               NOT NULL,
  timestamp     BIGINT                NOT NULL,
  PRIMARY KEY (name),
  UNIQUE KEY (id)
) 
######## Query executed
######## SQL Query:  CREATE TABLE IF NOT EXISTS schema_version_info (
  id               BIGINT AUTO_INCREMENT NOT NULL,
  description      TEXT,
  schemaText       TEXT                  NOT NULL,
  fingerprint      TEXT                  NOT NULL,
  version          INT                   NOT NULL,
  schemaMetadataId BIGINT                NOT NULL,
  timestamp        BIGINT                NOT NULL,
  name             VARCHAR(256)          NOT NULL,
  UNIQUE KEY (id),
  UNIQUE KEY `UK_METADATA_ID_VERSION_FK` (schemaMetadataId, version),
  PRIMARY KEY (name, version),
  FOREIGN KEY (schemaMetadataId, name) REFERENCES schema_metadata_info (id, name)
) 
Exception in thread "main" java.sql.SQLException: (conn:22) Failed to add the foreign key constraint. Missing index for constraint 'schema_version_info_ibfk_1' in the referenced table 'schema_metadata_info'
Query is : CREATE TABLE IF NOT EXISTS schema_version_info (
  id               BIGINT AUTO_INCREMENT NOT NULL,
  description      TEXT,
  schemaText       TEXT                  NOT NULL,
  fingerprint      TEXT                  NOT NULL,
  version          INT                   NOT NULL,
  schemaMetadataId BIGINT                NOT NULL,
  timestamp        BIGINT                NOT NULL,
  name             VARCHAR(256)          NOT NULL,
  UNIQUE KEY (id),
  UNIQUE KEY `UK_METADATA_ID_VERSION_FK` (schemaMetadataId, version),
  PRIMARY KEY (name, version),
  FOREIGN KEY (schemaMetadataId, name) REFERENCES schema_metadata_info (id, name)
)
	at org.mariadb.jdbc.internal.util.ExceptionMapper.get(ExceptionMapper.java:145)
	at org.mariadb.jdbc.internal.util.ExceptionMapper.getException(ExceptionMapper.java:101)
	at org.mariadb.jdbc.internal.util.ExceptionMapper.throwAndLogException(ExceptionMapper.java:77)
	at org.mariadb.jdbc.MariaDbStatement.executeQueryEpilog(MariaDbStatement.java:224)
	at org.mariadb.jdbc.MariaDbStatement.executeInternal(MariaDbStatement.java:258)
	at org.mariadb.jdbc.MariaDbStatement.execute(MariaDbStatement.java:271)
	at com.hortonworks.registries.storage.tool.SQLScriptRunner.runScript(SQLScriptRunner.java:98)
	at com.hortonworks.registries.storage.tool.TablesInitializer.doExecute(TablesInitializer.java:198)
	at com.hortonworks.registries.storage.tool.TablesInitializer.doExecuteCreate(TablesInitializer.java:175)
	at com.hortonworks.registries.storage.tool.TablesInitializer.main(TablesInitializer.java:162)
Caused by: org.mariadb.jdbc.internal.util.dao.QueryException: Failed to add the foreign key constraint. Missing index for constraint 'schema_version_info_ibfk_1' in the referenced table 'schema_metadata_info'
Query is : CREATE TABLE IF NOT EXISTS schema_version_info (
  id               BIGINT AUTO_INCREMENT NOT NULL,
  description      TEXT,
  schemaText       TEXT                  NOT NULL,
  fingerprint      TEXT                  NOT NULL,
  version          INT                   NOT NULL,
  schemaMetadataId BIGINT                NOT NULL,
  timestamp        BIGINT                NOT NULL,
  name             VARCHAR(256)          NOT NULL,
  UNIQUE KEY (id),
  UNIQUE KEY `UK_METADATA_ID_VERSION_FK` (schemaMetadataId, version),
  PRIMARY KEY (name, version),
  FOREIGN KEY (schemaMetadataId, name) REFERENCES schema_metadata_info (id, name)
)
	at org.mariadb.jdbc.internal.protocol.AbstractQueryProtocol.getResult(AbstractQueryProtocol.java:1114)
	at org.mariadb.jdbc.internal.protocol.AbstractQueryProtocol.executeQuery(AbstractQueryProtocol.java:137)
	at org.mariadb.jdbc.MariaDbStatement.executeInternal(MariaDbStatement.java:249)
	... 5 more

arcticOak2 avatar Jan 10 '19 09:01 arcticOak2