You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@couchdb.apache.org by "Paul Joseph Davis (JIRA)" <ji...@apache.org> on 2010/02/05 23:52:28 UTC

[jira] Created: (COUCHDB-640) Detect when a view

Detect when a view
------------------

                 Key: COUCHDB-640
                 URL: https://issues.apache.org/jira/browse/COUCHDB-640
             Project: CouchDB
          Issue Type: Bug
            Reporter: Paul Joseph Davis




-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (COUCHDB-640) Detect when a view is not valid for a database

Posted by "Filipe Manana (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/COUCHDB-640?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Filipe Manana updated COUCHDB-640:
----------------------------------

    Attachment: couchdb-640-trunk-3.patch

Just forgot and renamed the test case file from .erl to .t :)

> Detect when a view is not valid for a database
> ----------------------------------------------
>
>                 Key: COUCHDB-640
>                 URL: https://issues.apache.org/jira/browse/COUCHDB-640
>             Project: CouchDB
>          Issue Type: Bug
>          Components: JavaScript View Server
>    Affects Versions: 0.11
>            Reporter: Paul Joseph Davis
>         Attachments: couchdb-640-trunk-2.patch, couchdb-640-trunk-3.patch, couchdb-640-trunk.patch
>
>
> It was mentioned on IRC that if someone restores a database without restoring a view then there's nothing that detects if the view is still valid. Ie, it may reflect an update_seq that the restoration lost.
> In the check for kicking off a view update we should check if there is an incompatibility between what's been calculated in the view vs what the db update sequence is at. The current logic will just ignore and return the invalid view data (because of how stale=ok works which is good).
> Should be an easy bug to fix if anyone's interested. The code should be pretty contained to couch_view.erl and couch_view_group.erl

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Resolved: (COUCHDB-640) Detect when a view is not valid for a database

Posted by "Paul Joseph Davis (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/COUCHDB-640?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Paul Joseph Davis resolved COUCHDB-640.
---------------------------------------

    Resolution: Fixed
      Assignee: Paul Joseph Davis

And closed

> Detect when a view is not valid for a database
> ----------------------------------------------
>
>                 Key: COUCHDB-640
>                 URL: https://issues.apache.org/jira/browse/COUCHDB-640
>             Project: CouchDB
>          Issue Type: Bug
>          Components: JavaScript View Server
>    Affects Versions: 0.11
>            Reporter: Paul Joseph Davis
>            Assignee: Paul Joseph Davis
>         Attachments: couchdb-640-trunk-3.patch, couchdb-640-trunk.patch
>
>
> It was mentioned on IRC that if someone restores a database without restoring a view then there's nothing that detects if the view is still valid. Ie, it may reflect an update_seq that the restoration lost.
> In the check for kicking off a view update we should check if there is an incompatibility between what's been calculated in the view vs what the db update sequence is at. The current logic will just ignore and return the invalid view data (because of how stale=ok works which is good).
> Should be an easy bug to fix if anyone's interested. The code should be pretty contained to couch_view.erl and couch_view_group.erl

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (COUCHDB-640) Detect when a view is not valid for a database

Posted by "Filipe Manana (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/COUCHDB-640?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Filipe Manana updated COUCHDB-640:
----------------------------------

    Attachment: couchdb-640-trunk.patch

@Paul

Basically, I detect if the seq number field of the view group is greater than the update seq number of the DB. If so, regenerate the view from scratch.

I dunno if there's a way to find all the invalid data in the view (data that doesn't match the DB content) and remove it from the view.

If needed, I can write an Etap test (even if the patch is so small).

thanks for reviewing it

> Detect when a view is not valid for a database
> ----------------------------------------------
>
>                 Key: COUCHDB-640
>                 URL: https://issues.apache.org/jira/browse/COUCHDB-640
>             Project: CouchDB
>          Issue Type: Bug
>          Components: JavaScript View Server
>    Affects Versions: 0.11
>            Reporter: Paul Joseph Davis
>         Attachments: couchdb-640-trunk.patch
>
>
> It was mentioned on IRC that if someone restores a database without restoring a view then there's nothing that detects if the view is still valid. Ie, it may reflect an update_seq that the restoration lost.
> In the check for kicking off a view update we should check if there is an incompatibility between what's been calculated in the view vs what the db update sequence is at. The current logic will just ignore and return the invalid view data (because of how stale=ok works which is good).
> Should be an easy bug to fix if anyone's interested. The code should be pretty contained to couch_view.erl and couch_view_group.erl

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (COUCHDB-640) Detect when a view is not valid for a database

Posted by "Paul Joseph Davis (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/COUCHDB-640?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12834444#action_12834444 ] 

Paul Joseph Davis commented on COUCHDB-640:
-------------------------------------------

@Filipe,

Looks good overall. The only change I'd make is to switch the old_db_file atom response to {error, invalid_view_sequence} too make that more specific. The {error, Reason} helps debugging if that ever gets sent to the wrong place.

I would like to see an etap test for this. Its a slight behavior change so it'd be good to keep that in our list of checks.


> Detect when a view is not valid for a database
> ----------------------------------------------
>
>                 Key: COUCHDB-640
>                 URL: https://issues.apache.org/jira/browse/COUCHDB-640
>             Project: CouchDB
>          Issue Type: Bug
>          Components: JavaScript View Server
>    Affects Versions: 0.11
>            Reporter: Paul Joseph Davis
>         Attachments: couchdb-640-trunk.patch
>
>
> It was mentioned on IRC that if someone restores a database without restoring a view then there's nothing that detects if the view is still valid. Ie, it may reflect an update_seq that the restoration lost.
> In the check for kicking off a view update we should check if there is an incompatibility between what's been calculated in the view vs what the db update sequence is at. The current logic will just ignore and return the invalid view data (because of how stale=ok works which is good).
> Should be an easy bug to fix if anyone's interested. The code should be pretty contained to couch_view.erl and couch_view_group.erl

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (COUCHDB-640) Detect when a view is not valid for a database

Posted by "Filipe Manana (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/COUCHDB-640?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12834669#action_12834669 ] 

Filipe Manana commented on COUCHDB-640:
---------------------------------------

Funny, there seems to be a time issue with Jira. My last comment/upload is dated as before the previous one from yesterday.

> Detect when a view is not valid for a database
> ----------------------------------------------
>
>                 Key: COUCHDB-640
>                 URL: https://issues.apache.org/jira/browse/COUCHDB-640
>             Project: CouchDB
>          Issue Type: Bug
>          Components: JavaScript View Server
>    Affects Versions: 0.11
>            Reporter: Paul Joseph Davis
>         Attachments: couchdb-640-trunk-2.patch, couchdb-640-trunk-3.patch, couchdb-640-trunk.patch
>
>
> It was mentioned on IRC that if someone restores a database without restoring a view then there's nothing that detects if the view is still valid. Ie, it may reflect an update_seq that the restoration lost.
> In the check for kicking off a view update we should check if there is an incompatibility between what's been calculated in the view vs what the db update sequence is at. The current logic will just ignore and return the invalid view data (because of how stale=ok works which is good).
> Should be an easy bug to fix if anyone's interested. The code should be pretty contained to couch_view.erl and couch_view_group.erl

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (COUCHDB-640) Detect when a view is not valid for a database

Posted by "Filipe Manana (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/COUCHDB-640?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12835298#action_12835298 ] 

Filipe Manana commented on COUCHDB-640:
---------------------------------------

@Paul, any news?

> Detect when a view is not valid for a database
> ----------------------------------------------
>
>                 Key: COUCHDB-640
>                 URL: https://issues.apache.org/jira/browse/COUCHDB-640
>             Project: CouchDB
>          Issue Type: Bug
>          Components: JavaScript View Server
>    Affects Versions: 0.11
>            Reporter: Paul Joseph Davis
>         Attachments: couchdb-640-trunk-3.patch, couchdb-640-trunk.patch
>
>
> It was mentioned on IRC that if someone restores a database without restoring a view then there's nothing that detects if the view is still valid. Ie, it may reflect an update_seq that the restoration lost.
> In the check for kicking off a view update we should check if there is an incompatibility between what's been calculated in the view vs what the db update sequence is at. The current logic will just ignore and return the invalid view data (because of how stale=ok works which is good).
> Should be an easy bug to fix if anyone's interested. The code should be pretty contained to couch_view.erl and couch_view_group.erl

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (COUCHDB-640) Detect when a view is not valid for a database

Posted by "Filipe Manana (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/COUCHDB-640?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Filipe Manana updated COUCHDB-640:
----------------------------------

    Attachment:     (was: couchdb-640-trunk-2.patch)

> Detect when a view is not valid for a database
> ----------------------------------------------
>
>                 Key: COUCHDB-640
>                 URL: https://issues.apache.org/jira/browse/COUCHDB-640
>             Project: CouchDB
>          Issue Type: Bug
>          Components: JavaScript View Server
>    Affects Versions: 0.11
>            Reporter: Paul Joseph Davis
>         Attachments: couchdb-640-trunk-3.patch, couchdb-640-trunk.patch
>
>
> It was mentioned on IRC that if someone restores a database without restoring a view then there's nothing that detects if the view is still valid. Ie, it may reflect an update_seq that the restoration lost.
> In the check for kicking off a view update we should check if there is an incompatibility between what's been calculated in the view vs what the db update sequence is at. The current logic will just ignore and return the invalid view data (because of how stale=ok works which is good).
> Should be an easy bug to fix if anyone's interested. The code should be pretty contained to couch_view.erl and couch_view_group.erl

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (COUCHDB-640) Detect when a view is not valid for a database

Posted by "Paul Joseph Davis (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/COUCHDB-640?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12835372#action_12835372 ] 

Paul Joseph Davis commented on COUCHDB-640:
-------------------------------------------

Patch applied as of r911544. I consider this to be a bug fix so I'm back porting. Patch also includes a fix to the build system that the etap test exposed.

> Detect when a view is not valid for a database
> ----------------------------------------------
>
>                 Key: COUCHDB-640
>                 URL: https://issues.apache.org/jira/browse/COUCHDB-640
>             Project: CouchDB
>          Issue Type: Bug
>          Components: JavaScript View Server
>    Affects Versions: 0.11
>            Reporter: Paul Joseph Davis
>         Attachments: couchdb-640-trunk-3.patch, couchdb-640-trunk.patch
>
>
> It was mentioned on IRC that if someone restores a database without restoring a view then there's nothing that detects if the view is still valid. Ie, it may reflect an update_seq that the restoration lost.
> In the check for kicking off a view update we should check if there is an incompatibility between what's been calculated in the view vs what the db update sequence is at. The current logic will just ignore and return the invalid view data (because of how stale=ok works which is good).
> Should be an easy bug to fix if anyone's interested. The code should be pretty contained to couch_view.erl and couch_view_group.erl

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (COUCHDB-640) Detect when a view is not valid for a database

Posted by "Paul Joseph Davis (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/COUCHDB-640?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Paul Joseph Davis updated COUCHDB-640:
--------------------------------------

          Component/s: JavaScript View Server
          Description: 
It was mentioned on IRC that if someone restores a database without restoring a view then there's nothing that detects if the view is still valid. Ie, it may reflect an update_seq that the restoration lost.

In the check for kicking off a view update we should check if there is an incompatibility between what's been calculated in the view vs what the db update sequence is at. The current logic will just ignore and return the invalid view data (because of how stale=ok works which is good).

Should be an easy bug to fix if anyone's interested. The code should be pretty contained to couch_view.erl and couch_view_group.erl
    Affects Version/s: 0.11
              Summary: Detect when a view is not valid for a database  (was: Detect when a view)

> Detect when a view is not valid for a database
> ----------------------------------------------
>
>                 Key: COUCHDB-640
>                 URL: https://issues.apache.org/jira/browse/COUCHDB-640
>             Project: CouchDB
>          Issue Type: Bug
>          Components: JavaScript View Server
>    Affects Versions: 0.11
>            Reporter: Paul Joseph Davis
>
> It was mentioned on IRC that if someone restores a database without restoring a view then there's nothing that detects if the view is still valid. Ie, it may reflect an update_seq that the restoration lost.
> In the check for kicking off a view update we should check if there is an incompatibility between what's been calculated in the view vs what the db update sequence is at. The current logic will just ignore and return the invalid view data (because of how stale=ok works which is good).
> Should be an easy bug to fix if anyone's interested. The code should be pretty contained to couch_view.erl and couch_view_group.erl

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (COUCHDB-640) Detect when a view is not valid for a database

Posted by "Filipe Manana (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/COUCHDB-640?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Filipe Manana updated COUCHDB-640:
----------------------------------

    Attachment: couchdb-640-trunk-2.patch

@Paul,

here it follows with an Etap test.

It does the following:

1) create a DB with 3 docs and a view
2) makes a backup copy of the DB file
3) adds 1 more doc to the DB
4) queries the view, which lists the 4 docs
5) stops the server, and replaces the DB file with the backup DB file
6) starts the server
7) queries the view, which now lists only 3 docs

During the server restart, a huge stack trace is sent to stderr, but it's harmless :) All the tests pass.

Also changed the atom bad_db_file to the tuple {error, invalid_view_seq}

Let me know if all is ok now.

cheers

> Detect when a view is not valid for a database
> ----------------------------------------------
>
>                 Key: COUCHDB-640
>                 URL: https://issues.apache.org/jira/browse/COUCHDB-640
>             Project: CouchDB
>          Issue Type: Bug
>          Components: JavaScript View Server
>    Affects Versions: 0.11
>            Reporter: Paul Joseph Davis
>         Attachments: couchdb-640-trunk-2.patch, couchdb-640-trunk.patch
>
>
> It was mentioned on IRC that if someone restores a database without restoring a view then there's nothing that detects if the view is still valid. Ie, it may reflect an update_seq that the restoration lost.
> In the check for kicking off a view update we should check if there is an incompatibility between what's been calculated in the view vs what the db update sequence is at. The current logic will just ignore and return the invalid view data (because of how stale=ok works which is good).
> Should be an easy bug to fix if anyone's interested. The code should be pretty contained to couch_view.erl and couch_view_group.erl

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.