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 Carey (JIRA)" <ji...@apache.org> on 2009/03/17 09:28:50 UTC
[jira] Created: (COUCHDB-292) A deleted document may be resaved
with an old revision and is then considered undeleted
A deleted document may be resaved with an old revision and is then considered undeleted
---------------------------------------------------------------------------------------
Key: COUCHDB-292
URL: https://issues.apache.org/jira/browse/COUCHDB-292
Project: CouchDB
Issue Type: Bug
Components: Database Core
Affects Versions: 0.9
Reporter: Paul Carey
If a document is deleted, a PUT request may be issued with the same revision that was passed to the DELETE request. When this happens the previously deleted document is assigned a new revision and is no longer considered deleted.
This behaviour is new within the last few weeks.
The following curl session illustrates the issue.
08:18 : ~ $ curl -X PUT -d '{"_id":"foo"}' localhost:5984/scratch/foo
{"ok":true,"id":"foo","rev":"1-3690485448"}
08:19 : ~ $ curl -X PUT -d '{"_id":"foo","_rev":"1-3690485448"}' localhost:5984/scratch/foo
{"ok":true,"id":"foo","rev":"2-966942539"}
08:19 : ~ $ curl -X DELETE localhost:5984/scratch/foo?rev="2-966942539"
{"ok":true,"id":"foo","rev":"3-421182311"}
08:20 : ~ $ curl -X GET localhost:5984/scratch/foo
{"error":"not_found","reason":"deleted"}
08:20 : ~ $ curl -X PUT -d '{"_id":"foo","_rev":"2-966942539"}' localhost:5984/scratch/foo
{"ok":true,"id":"foo","rev":"3-1867999175"}
08:20 : ~ $ curl -X GET localhost:5984/scratch/foo
{"_id":"foo","_rev":"3-1867999175"}
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Commented: (COUCHDB-292) A deleted document may be resaved
with an old revision and is then considered undeleted
Posted by "Matt Goodall (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/COUCHDB-292?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12689708#action_12689708 ]
Matt Goodall commented on COUCHDB-292:
--------------------------------------
I've just come across the same problem, but using _bulk_docs:
$ curl -X "POST" -d "{\"docs\": [{\"_id\": \"foo\"}]}" http://localhost:5984/test/_bulk_docs
[{"id":"foo","rev":"1-3973353391"}]
$ curl -X "GET" http://localhost:5984/test/_all_docs
{"total_rows":1,"offset":0,"rows":[
{"id":"foo","key":"foo","value":{"rev":"1-3973353391"}}
]}
$ curl -X "POST" -d "{\"docs\": [{\"_id\": \"foo\", \"_rev\": \"1-3973353391\", \"_deleted\": true}]}" http://localhost:5984/test/_bulk_docs
[{"id":"foo","rev":"2-1972132827"}]
$ curl -X "GET" http://localhost:5984/test/_all_docs
{"total_rows":0,"rows":[]}
$ curl -X "POST" -d "{\"docs\": [{\"_id\": \"foo\", \"_rev\": \"1-3973353391\"}]}" http://localhost:5984/test/_bulk_docs
[{"id":"foo","rev":"2-2387444021"}]
$ curl -X "GET" http://localhost:5984/test/_all_docs
{"total_rows":1,"offset":0,"rows":[
{"id":"foo","key":"foo","value":{"rev":"2-2387444021"}}
]}
> A deleted document may be resaved with an old revision and is then considered undeleted
> ---------------------------------------------------------------------------------------
>
> Key: COUCHDB-292
> URL: https://issues.apache.org/jira/browse/COUCHDB-292
> Project: CouchDB
> Issue Type: Bug
> Components: Database Core
> Affects Versions: 0.9
> Reporter: Paul Carey
> Fix For: 0.10
>
>
> If a document is deleted, a PUT request may be issued with the same revision that was passed to the DELETE request. When this happens the previously deleted document is assigned a new revision and is no longer considered deleted.
> This behaviour is new within the last few weeks.
> The following curl session illustrates the issue.
> 08:18 : ~ $ curl -X PUT -d '{"_id":"foo"}' localhost:5984/scratch/foo
> {"ok":true,"id":"foo","rev":"1-3690485448"}
> 08:19 : ~ $ curl -X PUT -d '{"_id":"foo","_rev":"1-3690485448"}' localhost:5984/scratch/foo
> {"ok":true,"id":"foo","rev":"2-966942539"}
> 08:19 : ~ $ curl -X DELETE localhost:5984/scratch/foo?rev="2-966942539"
> {"ok":true,"id":"foo","rev":"3-421182311"}
> 08:20 : ~ $ curl -X GET localhost:5984/scratch/foo
> {"error":"not_found","reason":"deleted"}
> 08:20 : ~ $ curl -X PUT -d '{"_id":"foo","_rev":"2-966942539"}' localhost:5984/scratch/foo
> {"ok":true,"id":"foo","rev":"3-1867999175"}
> 08:20 : ~ $ curl -X GET localhost:5984/scratch/foo
> {"_id":"foo","_rev":"3-1867999175"}
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Updated: (COUCHDB-292) A deleted document may be resaved
with an old revision and is then considered undeleted
Posted by "Chris Anderson (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/COUCHDB-292?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Chris Anderson updated COUCHDB-292:
-----------------------------------
Fix Version/s: 0.10
> A deleted document may be resaved with an old revision and is then considered undeleted
> ---------------------------------------------------------------------------------------
>
> Key: COUCHDB-292
> URL: https://issues.apache.org/jira/browse/COUCHDB-292
> Project: CouchDB
> Issue Type: Bug
> Components: Database Core
> Affects Versions: 0.9
> Reporter: Paul Carey
> Fix For: 0.10
>
>
> If a document is deleted, a PUT request may be issued with the same revision that was passed to the DELETE request. When this happens the previously deleted document is assigned a new revision and is no longer considered deleted.
> This behaviour is new within the last few weeks.
> The following curl session illustrates the issue.
> 08:18 : ~ $ curl -X PUT -d '{"_id":"foo"}' localhost:5984/scratch/foo
> {"ok":true,"id":"foo","rev":"1-3690485448"}
> 08:19 : ~ $ curl -X PUT -d '{"_id":"foo","_rev":"1-3690485448"}' localhost:5984/scratch/foo
> {"ok":true,"id":"foo","rev":"2-966942539"}
> 08:19 : ~ $ curl -X DELETE localhost:5984/scratch/foo?rev="2-966942539"
> {"ok":true,"id":"foo","rev":"3-421182311"}
> 08:20 : ~ $ curl -X GET localhost:5984/scratch/foo
> {"error":"not_found","reason":"deleted"}
> 08:20 : ~ $ curl -X PUT -d '{"_id":"foo","_rev":"2-966942539"}' localhost:5984/scratch/foo
> {"ok":true,"id":"foo","rev":"3-1867999175"}
> 08:20 : ~ $ curl -X GET localhost:5984/scratch/foo
> {"_id":"foo","_rev":"3-1867999175"}
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Commented: (COUCHDB-292) A deleted document may be resaved
with an old revision and is then considered undeleted
Posted by "Matt Goodall (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/COUCHDB-292?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12689722#action_12689722 ]
Matt Goodall commented on COUCHDB-292:
--------------------------------------
Here's a test:
couchTests.undead = function(debug) {
// Create fresh database
var db = new CouchDB("test_suite_db");
db.deleteDb();
db.createDb();
// Create a document
var results = db.bulkSave([{_id: "foo"}]);
var original_rev = results[0].rev;
T(db.info().doc_count == 1);
// Delete the document.
var results = db.bulkSave([{_id: "foo", _rev: original_rev, _deleted: true}]);
T(results[0].rev != original_rev);
T(db.info().doc_count == 0);
// Try to raise the document from the grave (shouldn't work).
var results = db.bulkSave([{_id: "foo", _rev: original_rev}]);
T(results[0].error == "conflict");
T(db.info().doc_count == 0);
};
> A deleted document may be resaved with an old revision and is then considered undeleted
> ---------------------------------------------------------------------------------------
>
> Key: COUCHDB-292
> URL: https://issues.apache.org/jira/browse/COUCHDB-292
> Project: CouchDB
> Issue Type: Bug
> Components: Database Core
> Affects Versions: 0.9
> Reporter: Paul Carey
> Fix For: 0.10
>
>
> If a document is deleted, a PUT request may be issued with the same revision that was passed to the DELETE request. When this happens the previously deleted document is assigned a new revision and is no longer considered deleted.
> This behaviour is new within the last few weeks.
> The following curl session illustrates the issue.
> 08:18 : ~ $ curl -X PUT -d '{"_id":"foo"}' localhost:5984/scratch/foo
> {"ok":true,"id":"foo","rev":"1-3690485448"}
> 08:19 : ~ $ curl -X PUT -d '{"_id":"foo","_rev":"1-3690485448"}' localhost:5984/scratch/foo
> {"ok":true,"id":"foo","rev":"2-966942539"}
> 08:19 : ~ $ curl -X DELETE localhost:5984/scratch/foo?rev="2-966942539"
> {"ok":true,"id":"foo","rev":"3-421182311"}
> 08:20 : ~ $ curl -X GET localhost:5984/scratch/foo
> {"error":"not_found","reason":"deleted"}
> 08:20 : ~ $ curl -X PUT -d '{"_id":"foo","_rev":"2-966942539"}' localhost:5984/scratch/foo
> {"ok":true,"id":"foo","rev":"3-1867999175"}
> 08:20 : ~ $ curl -X GET localhost:5984/scratch/foo
> {"_id":"foo","_rev":"3-1867999175"}
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Commented: (COUCHDB-292) A deleted document may be resaved
with an old revision and is then considered undeleted
Posted by "Chris Anderson (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/COUCHDB-292?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12688321#action_12688321 ]
Chris Anderson commented on COUCHDB-292:
----------------------------------------
I was able to duplicate this on my machine.
Paul if you can possibly rebuild this as a JavaScript test suite test (perhaps a patch to basics.js) we can start to look for the right fix.
At the end of my session I tried:
$: curl -X GET localhost:5984/scratch/foo?meta=true
{"_id":"foo","_rev":"3-2144795776","_revs_info":[{"rev":"3-2144795776","status":"available"},{"rev":"2-4259004717","status":"available"},{"rev":"1-1189092513","status":"available"}],"_deleted_conflicts":["3-1788894625"]}
So it looks like I have a deleted conflict. I'm not sure what this means but it seems relevant to the underlying model.
> A deleted document may be resaved with an old revision and is then considered undeleted
> ---------------------------------------------------------------------------------------
>
> Key: COUCHDB-292
> URL: https://issues.apache.org/jira/browse/COUCHDB-292
> Project: CouchDB
> Issue Type: Bug
> Components: Database Core
> Affects Versions: 0.9
> Reporter: Paul Carey
> Fix For: 0.10
>
>
> If a document is deleted, a PUT request may be issued with the same revision that was passed to the DELETE request. When this happens the previously deleted document is assigned a new revision and is no longer considered deleted.
> This behaviour is new within the last few weeks.
> The following curl session illustrates the issue.
> 08:18 : ~ $ curl -X PUT -d '{"_id":"foo"}' localhost:5984/scratch/foo
> {"ok":true,"id":"foo","rev":"1-3690485448"}
> 08:19 : ~ $ curl -X PUT -d '{"_id":"foo","_rev":"1-3690485448"}' localhost:5984/scratch/foo
> {"ok":true,"id":"foo","rev":"2-966942539"}
> 08:19 : ~ $ curl -X DELETE localhost:5984/scratch/foo?rev="2-966942539"
> {"ok":true,"id":"foo","rev":"3-421182311"}
> 08:20 : ~ $ curl -X GET localhost:5984/scratch/foo
> {"error":"not_found","reason":"deleted"}
> 08:20 : ~ $ curl -X PUT -d '{"_id":"foo","_rev":"2-966942539"}' localhost:5984/scratch/foo
> {"ok":true,"id":"foo","rev":"3-1867999175"}
> 08:20 : ~ $ curl -X GET localhost:5984/scratch/foo
> {"_id":"foo","_rev":"3-1867999175"}
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Closed: (COUCHDB-292) A deleted document may be resaved with
an old revision and is then considered undeleted
Posted by "Damien Katz (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/COUCHDB-292?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Damien Katz closed COUCHDB-292.
-------------------------------
Resolution: Fixed
Assignee: Damien Katz
Fix with tests in svn r883494.
> A deleted document may be resaved with an old revision and is then considered undeleted
> ---------------------------------------------------------------------------------------
>
> Key: COUCHDB-292
> URL: https://issues.apache.org/jira/browse/COUCHDB-292
> Project: CouchDB
> Issue Type: Bug
> Components: Database Core
> Affects Versions: 0.9
> Reporter: Paul Carey
> Assignee: Damien Katz
> Fix For: 0.11
>
>
> If a document is deleted, a PUT request may be issued with the same revision that was passed to the DELETE request. When this happens the previously deleted document is assigned a new revision and is no longer considered deleted.
> This behaviour is new within the last few weeks.
> The following curl session illustrates the issue.
> 08:18 : ~ $ curl -X PUT -d '{"_id":"foo"}' localhost:5984/scratch/foo
> {"ok":true,"id":"foo","rev":"1-3690485448"}
> 08:19 : ~ $ curl -X PUT -d '{"_id":"foo","_rev":"1-3690485448"}' localhost:5984/scratch/foo
> {"ok":true,"id":"foo","rev":"2-966942539"}
> 08:19 : ~ $ curl -X DELETE localhost:5984/scratch/foo?rev="2-966942539"
> {"ok":true,"id":"foo","rev":"3-421182311"}
> 08:20 : ~ $ curl -X GET localhost:5984/scratch/foo
> {"error":"not_found","reason":"deleted"}
> 08:20 : ~ $ curl -X PUT -d '{"_id":"foo","_rev":"2-966942539"}' localhost:5984/scratch/foo
> {"ok":true,"id":"foo","rev":"3-1867999175"}
> 08:20 : ~ $ curl -X GET localhost:5984/scratch/foo
> {"_id":"foo","_rev":"3-1867999175"}
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.