You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@sqoop.apache.org by "Qian Xu (JIRA)" <ji...@apache.org> on 2014/10/28 03:07:33 UTC

[jira] [Updated] (SQOOP-1625) Repository upgrade issue

     [ https://issues.apache.org/jira/browse/SQOOP-1625?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Qian Xu updated SQOOP-1625:
---------------------------
    Description: 
I'm facing a SQL error, while Sqoop2 tries to add an existing constraint again. It happens when I recompile Sqoop project and restart Sqoop server. Here is the error message:

Caused by: ERROR 42Z93: Constraints 'FK_SQB_NAME_UNIQUE' and 'FK_SQB_NAME_UNIQUE' have the same set of columns, which is not allowed.

In DerbyRepositoryHandler.java, constraints will be added to repository, if repository version is greater than 3. According to the code, the code can be executed at every Sqoop server startup. Obviously, the code cannot be 
executed twice, so Sqoop server cannot start up.

{code}
    // Add unique constraints on job and links for version 4 onwards
    if (repositoryVersion > 3) {
      runQuery(QUERY_UPGRADE_TABLE_SQ_JOB_ADD_UNIQUE_CONSTRAINT_NAME, conn);
      runQuery(QUERY_UPGRADE_TABLE_SQ_LINK_ADD_UNIQUE_CONSTRAINT_NAME, conn);
      runQuery(QUERY_UPGRADE_TABLE_SQ_CONFIGURABLE_ADD_UNIQUE_CONSTRAINT_NAME, conn);
    }
{code}

Compare with other code of repository version upgrade, after version number is increased, related code never executed again. But the highlighted code is not. 

Shall we increase the repository version to 5 and change 
{code}
if (repositoryVersion > 3) {
{code}
to ?
{code}if (repositoryVersion <= 4) {
{code}

  was:
I'm facing a SQL error, while Sqoop2 tries to add an existing constraint again. It happens when I recompile Sqoop project and restart Sqoop server. 

In DerbyRepositoryHandler.java, constraints will be added to repository, if repository version is greater than 3. According to the code, the code can be executed at every Sqoop server startup. Obviously, the code cannot be 
executed twice, so Sqoop server cannot start up.

{code}
    // Add unique constraints on job and links for version 4 onwards
    if (repositoryVersion > 3) {
      runQuery(QUERY_UPGRADE_TABLE_SQ_JOB_ADD_UNIQUE_CONSTRAINT_NAME, conn);
      runQuery(QUERY_UPGRADE_TABLE_SQ_LINK_ADD_UNIQUE_CONSTRAINT_NAME, conn);
      runQuery(QUERY_UPGRADE_TABLE_SQ_CONFIGURABLE_ADD_UNIQUE_CONSTRAINT_NAME, conn);
    }
{code}

Compare with other code of repository version upgrade, after version number is increased, related code never executed again. But the highlighted code is not. 

Shall we increase the repository version to 5 and change 
{code}
if (repositoryVersion > 3) {
{code}
to ?
{code}if (repositoryVersion <= 4) {
{code}


> Repository upgrade issue
> ------------------------
>
>                 Key: SQOOP-1625
>                 URL: https://issues.apache.org/jira/browse/SQOOP-1625
>             Project: Sqoop
>          Issue Type: Bug
>    Affects Versions: 1.99.4
>            Reporter: Qian Xu
>
> I'm facing a SQL error, while Sqoop2 tries to add an existing constraint again. It happens when I recompile Sqoop project and restart Sqoop server. Here is the error message:
> Caused by: ERROR 42Z93: Constraints 'FK_SQB_NAME_UNIQUE' and 'FK_SQB_NAME_UNIQUE' have the same set of columns, which is not allowed.
> In DerbyRepositoryHandler.java, constraints will be added to repository, if repository version is greater than 3. According to the code, the code can be executed at every Sqoop server startup. Obviously, the code cannot be 
> executed twice, so Sqoop server cannot start up.
> {code}
>     // Add unique constraints on job and links for version 4 onwards
>     if (repositoryVersion > 3) {
>       runQuery(QUERY_UPGRADE_TABLE_SQ_JOB_ADD_UNIQUE_CONSTRAINT_NAME, conn);
>       runQuery(QUERY_UPGRADE_TABLE_SQ_LINK_ADD_UNIQUE_CONSTRAINT_NAME, conn);
>       runQuery(QUERY_UPGRADE_TABLE_SQ_CONFIGURABLE_ADD_UNIQUE_CONSTRAINT_NAME, conn);
>     }
> {code}
> Compare with other code of repository version upgrade, after version number is increased, related code never executed again. But the highlighted code is not. 
> Shall we increase the repository version to 5 and change 
> {code}
> if (repositoryVersion > 3) {
> {code}
> to ?
> {code}if (repositoryVersion <= 4) {
> {code}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)