Batch write allows put and delete requests of the same item

Bug #1308388 reported by Andrii Ostapenko
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
MagnetoDB
Fix Released
Low
Illia Khudoshyn

Bug Description

DynamoDB denies put and delete request of the same item in one batch write request. However now it is allowed in magnetodb rest api:
2014-04-16 08:10:59,405 Request: POST http://127.0.0.1:8480/v1/default_tenant/data/batch_write_item
2014-04-16 08:10:59,405 Request Headers: {'Content-Type': 'application/json', 'Accept': 'application/json'}
2014-04-16 08:10:59,405 Request Body: {"request_items": {"testtempest1552223522": [{"put_request": {"item": {"message": {"S": "message text"}, "replies": {"N": "10"}, "last_posted_by": {"S": "John"}, "forum": {"S": "forum1"}, "subject": {"S": "subject2"}}}}, {"delete_request": {"key": {"forum": {"S": "forum1"}, "subject": {"S": "subject2"}}}}]}}
2014-04-16 08:10:59,427 Response Status: 200
2014-04-16 08:10:59,428 Response Headers: {'date': 'Wed, 16 Apr 2014 08:10:59 GMT', 'content-length': '25', 'content-type': 'application/json'}
2014-04-16 08:10:59,428 Response Body: {"unprocessed_items": {}}

Server side:
2014-04-16 08:10:59.407 3736 DEBUG routes.middleware [-] Matched POST /v1/default_tenant/data/batch_write_item __call__ /usr/local/lib/python2.7/dist-packages/routes/middleware.py:100
2014-04-16 08:10:59.408 3736 DEBUG routes.middleware [-] Route path: '/v1/{project_id}/data/batch_write_item', defaults: {'action': u'process_request', 'controller': <magnetodb.common.wsgi.Resource object at 0x1d76e10>} __call__ /usr/local/lib/python2.7/dist-packages/routes/middleware.py:102
2014-04-16 08:10:59.408 3736 DEBUG routes.middleware [-] Match dict: {'action': u'process_request', 'controller': <magnetodb.common.wsgi.Resource object at 0x1d76e10>, 'project_id': u'default_tenant'} __call__ /usr/local/lib/python2.7/dist-packages/routes/middleware.py:103
2014-04-16 08:10:59.417 3736 DEBUG magnetodb.storage.impl.cassandra_impl [-] Executing query <SimpleStatement query="INSERT INTO "user_default_tenant"."user_testtempest1552223522" ("user_forum","user_subject",extra_attr_data,extra_attr_types,attr_exist) VALUES('forum1','subject2',{'message':0x226d657373616765207465787422,'replies':0x22313022,'last_posted_by':0x224a6f686e22},{'message':'text','replies':'decimal','last_posted_by':'text'},{'message','replies','last_posted_by','forum','subject'})", consistency=QUORUM> _execute_query /opt/stack/magnetodb/magnetodb/storage/impl/cassandra_impl.py:271
2014-04-16 08:10:59.422 3736 DEBUG magnetodb.storage.impl.cassandra_impl [-] Executing query <SimpleStatement query="DELETE FROM "user_default_tenant"."user_testtempest1552223522" WHERE "user_forum"='forum1' AND "user_subject"='subject2'", consistency=QUORUM> _execute_query /opt/stack/magnetodb/magnetodb/storage/impl/cassandra_impl.py:271

Tags: data-api
Changed in magnetodb:
importance: Undecided → Low
milestone: none → 2.0.4
tags: added: data-api
Changed in magnetodb:
milestone: 2.0.4 → next
Changed in magnetodb:
milestone: next → none
Changed in magnetodb:
assignee: nobody → Illia Khudoshyn (ikhudoshyn)
Changed in magnetodb:
status: New → Confirmed
Changed in magnetodb:
milestone: none → kilo-1
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to magnetodb (master)

Fix proposed to branch: master
Review: https://review.openstack.org/131384

Changed in magnetodb:
status: Confirmed → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to magnetodb (master)

Reviewed: https://review.openstack.org/131384
Committed: https://git.openstack.org/cgit/stackforge/magnetodb/commit/?id=5004a6d8d1227c2cb2e8a3e86b4d14d1a1b8e1b4
Submitter: Jenkins
Branch: master

commit 5004a6d8d1227c2cb2e8a3e86b4d14d1a1b8e1b4
Author: Illia Khudoshyn <email address hidden>
Date: Tue Oct 28 12:15:48 2014 +0200

    Forbid multiple operations with an item in batch write

    Change-Id: I70dba3ef29ba6b7f6261d19131922cdb8f202421
    Fixes-bug: 1308388

Changed in magnetodb:
status: In Progress → Fix Committed
Changed in magnetodb:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.