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

Jan Lehnardt commented on COUCHDB-1654:
---------------------------------------

I had a stab at it. Here’s the plan:

in 1.3.x and later:
 - before opening a view index
  - if the index file exists, open that, end of story
  - if the index file doesn’t exist,
    - see if the old-style index file exists
    - if it does, copy it to the new location 
(.dbname_deign/mrview/newsignature.view)
    - if it doesn’t, ignore.
 - when opening a view index
 - when the header can be read
 - if the header matches the 1.2.x and lower #index_header
  - extract its values and splice them into the new #mrheader

 - the next time the view file header is flushed to disk, we have upgraded.
 - if we crash any time before that, the procedure can be repeated.

This branch is a first stab at this: 
https://github.com/janl/couchdb/compare/1654-fix-view-signature-change

It calculates the old view signature wrong, I might be missing something 
subtle, if you find it, let me know.


                
> couchdb view sig changed
> ------------------------
>
>                 Key: COUCHDB-1654
>                 URL: https://issues.apache.org/jira/browse/COUCHDB-1654
>             Project: CouchDB
>          Issue Type: Bug
>          Components: Database Core
>            Reporter: Robert Newson
>            Priority: Blocker
>             Fix For: 1.3
>
>
> view sigs and location changed between 1.2.x and 1.3.x, which would cause 
> full rebuilds.
> to be clear: upgrading to 1.3 should not cause a view to rebuild from scratch.
> ➜  couchdb git:(1.3.x) find tmp
> tmp
> tmp/lib
> tmp/lib/.db1_design
> tmp/lib/.db1_design/0761939631be54bf36d3ed9172bcf689.view
> tmp/lib/.delete
> tmp/lib/_replicator.couch
> tmp/lib/_users.couch
> tmp/lib/db1.couch
> tmp/log
> tmp/log/couch.log
> tmp/run
> tmp/run/couch.uri
> tmp/run/couchdb
> ➜  couchdb git:(1.3.x) find tmp
> tmp
> tmp/lib
> tmp/lib/.db1_design
> tmp/lib/.db1_design/0761939631be54bf36d3ed9172bcf689.view
> tmp/lib/.db1_design/mrview
> tmp/lib/.db1_design/mrview/641ce136c0f1dbe93aa94d3a419a0efe.view
> tmp/lib/.delete
> tmp/lib/_replicator.couch
> tmp/lib/_users.couch
> tmp/lib/db1.couch
> tmp/log
> tmp/log/couch.log
> tmp/run
> tmp/run/couch.uri
> tmp/run/couchdb

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Reply via email to