[ 
https://issues.apache.org/jira/browse/TRAFODION-2161?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15426609#comment-15426609
 ] 

ASF GitHub Bot commented on TRAFODION-2161:
-------------------------------------------

Github user DaveBirdsall commented on a diff in the pull request:

    https://github.com/apache/incubator-trafodion/pull/661#discussion_r75327072
  
    --- Diff: core/sql/sqlcomp/CmpSeabaseDDLrepos.cpp ---
    @@ -516,6 +585,62 @@ short 
CmpSeabaseDDL::upgradeReposComplete(ExeCliInterface * cliInterface,
     
             case 1:
               {
    +            // If there were views on the old Repository tables, they are
    +            // still there, by virtue of the fact that we did "SKIP VIEW 
CHECK"
    +            // on the ALTER TABLE RENAME. Now we will capture their view
    +            // definitions (which will contain the old table name, not the
    +            // renamed table name) and replay that against the new 
Repository
    +            // table. If the replay fails, we treat that as an 
unrecoverable
    +            // situation and ignore it. Instead, we'll save the view 
definition
    +            // text in the TEXT table with a different TEXT_TYPE and clue 
the
    +            // user in that it is there. They can then try to create the 
view
    +            // at their leisure. Note that they may have to change the view
    +            // definition themselves, e.g. if we dropped a column from the
    +            // repository table that their view happened to reference.
    +            //
    +            // Note that this work is done in one step because the only 
state
    +            // we can depend upon across redrives to this method is the 
substep
    +            // number. Any in-memory list would be lost across redrives.
    +            NABoolean someViewSaved = FALSE;
    +            migrateReposViews(cliInterface,someViewSaved /* out */);
    +
    +            mdui->setMsg("Upgrade Repository: View migration done");
    +            if (someViewSaved)
    +              mdui->subStep()++;
    +            else
    +              mdui->subStep() += 2;
    +
    +            mdui->setEndStep(FALSE);
    +       
    +            return 0;
    +          }
    +          break;
    +
    +        case 2:
    +          {
    +            // This state is here in case we want to report to the user 
that
    +            // there was a view that could not be migrated. But we saved 
the
    +            // view definition for that view in the TEXT table.
    +            mdui->setMsg("Some user views could not be migrated. Check 
metadata TEXT table, TEXT_TYPE = 9.");
    +            mdui->subStep()++;
    --- End diff --
    
    At line 414, we keep decrementing the value we use for TEXT_UID, so we 
won't have any key clashes. Though assuming this code does not change in the 
future, the next time we do a metadata upgrade, we'd start at -2 again. The 
code will delete the earlier text and write new. This should be OK, I think, 
because if the user hasn't recreated the view after one release cycle, he 
probably no longer cares about it.


> Metadata upgrade failed when there is user view on repository tables
> --------------------------------------------------------------------
>
>                 Key: TRAFODION-2161
>                 URL: https://issues.apache.org/jira/browse/TRAFODION-2161
>             Project: Apache Trafodion
>          Issue Type: Bug
>          Components: sql-cmu
>         Environment: centos6.7 CDH5.4.8
> esgynDB R2.2 0811 daily build
>            Reporter: Gao, Rui-Xian
>            Assignee: David Wayne Birdsall
>
> [trafodion@centosqa-1 ~]$ sqlci
> EsgynDB Advanced Conversational Interface 2.2.0
> Copyright (c) 2015-2016 Esgyn Corporation
> >>get schemas;
>  
> *** ERROR[1395] Trafodion needs to be upgraded on this system due to metadata 
> version mismatch. Do 'initialize trafodion, upgrade' to upgrade metadata. Or 
> do 'initialize trafodion, drop' followed by 'initialize trafodion'. Be aware 
> that the second option will delete all metadata and user objects from 
> Trafodion database                       .
>  
> *** ERROR[8822] The statement was not prepared.
>  
> >>initialize trafodion, upgrade;
> Metadata Upgrade: started
>  
> Version Check: started
>   Metadata needs to be upgraded from Version 1.0.1 to 2.1.0.
>   Upgrade needed for Catalogs, Privileges, Repository.
> Version Check: done
>  
> Drop Old Metadata: started
> Drop Old Metadata: done
>  
> Backup Current Metadata: started
> Backup Current Metadata: done
>  
> Drop Current Metadata: started
> Drop Current Metadata: done
>  
> Initialize New Metadata: started
> Initialize New Metadata: done
>  
> Copy Old Metadata: started
> Copy Old Metadata: done
>  
> Validate Metadata Copy: started
> Validate Metadata Copy: done
>  
>  
> Delete Old Metadata Info: started
> Delete Old Metadata Info: done
>  
> Upgrade Repository: Started
>   Start: Drop Old Repository
>   End:   Drop Old Repository
>   Start: Rename Current Repository
> Upgrade Repository: Restoring Old Repository
> Start: Rename Old Repository back to New
> End: Rename Old Repository back to New
> Upgrade Repository: Restore done
>  
> Drop Old Metadata: started
> Drop Old Metadata: done
>  
> Metadata Upgrade: failed
>  
>  
> *** ERROR[1427] Table cannot be renamed. Reason: Operation not allowed if 
> dependent views exist. Drop the views and recreate them after rename.
>  
> *** ERROR[8839] Transaction was aborted.
>  
> --- SQL operation failed with errors.



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

Reply via email to