database-delete API is not validating database before delete operation

Bug #1293954 reported by Pradeep Kumar Chandani
14
This bug affects 2 people
Affects Status Importance Assigned to Milestone
OpenStack DBaaS (Trove)
Fix Released
Medium
Petr Malik

Bug Description

database-delete API is not validating database before delete operation. So if any user performs database-delete operation and that database doesn't exists, he didn't see any message and impression goes like database has been deleted.
API call :
trove database-delete <InstanceID> <databaseName>

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to trove (master)

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

Changed in trove:
assignee: nobody → Pradeep Kumar Chandani (pradeep-chandani)
status: New → In Progress
Revision history for this message
Nikhil Manchanda (slicknik) wrote :

This is by design.

Changed in trove:
status: In Progress → Opinion
Changed in trove:
status: Opinion → In Progress
Revision history for this message
Nikhil Manchanda (slicknik) wrote :

This is by design. Deleting a DB that doesn't exist is a no-op in this case.

Changed in trove:
status: In Progress → Opinion
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Change abandoned on trove (master)

Change abandoned by Nikhil Manchanda (<email address hidden>) on branch: master
Review: https://review.openstack.org/81186
Reason: Review clean up.

Abandoning since the last update > 3 weeks ago.

Please restore if patch is still in progress.

Changed in trove:
status: Opinion → In Progress
Changed in trove:
status: In Progress → Opinion
importance: Undecided → Wishlist
Revision history for this message
Dan Nguyen (daniel-a-nguyen) wrote :

Yeah I'm in agreement with Nikhil on this one. If you compare the behavior to deleting a Database in mysql it should be similar.

Revision history for this message
Dan Nguyen (daniel-a-nguyen) wrote :

FYI,

The link below implies that you would have to check using IF EXISTS before dropping a Database that doesn't exist.

http://dev.mysql.com/doc/refman/5.5/en/drop-database.html

Revision history for this message
OpenStack Infra (hudson-openstack) wrote :

Change abandoned by Nikhil Manchanda (<email address hidden>) on branch: master
Review: https://review.openstack.org/81186
Reason: This patch is being abandoned as part of routine cleanup (patches older than 4 weeks with a negative review).

Please feel free to restore the patch if this is something you're still actively working on.

Thanks!

Revision history for this message
Sushil Kumar (sushil-kumar2) wrote :

I think its worth checking if db exists before deleting the same.

If we drop a non-existent db in mysql it gives an error, but API functions differently.

Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 1696
Server version: 5.5.40-0ubuntu0.14.04.1-log (Ubuntu)

Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> drop database tempo;
ERROR 1008 (HY000): Can't drop database 'tempo'; database doesn't exist
mysql>

Revision history for this message
Sushil Kumar (sushil-kumar2) wrote :

Wanted to confirm that do we want to proceed with the bug-fix.

Revision history for this message
shweta (shweta) wrote : Re: [Bug 1293954] Re: database-delete API is not validating database before delete operation

If you think we should then its fine, it was bug for sure.

Thanks,
Shweta | Consultant Engineering
GlobalLogic
P +91.434.2000.2342 M +91.981.035.6300
www.globallogic.com
<http://www.globallogic.com/>
http://www.globallogic.com/email_disclaimer.txt

On Wed, Dec 17, 2014 at 12:31 PM, Sushil Kumar <email address hidden> wrote:
>
> Wanted to confirm that do we want to proceed with the bug-fix.
>
> --
> You received this bug notification because you are subscribed to a
> duplicate bug report (1316529).
> https://bugs.launchpad.net/bugs/1293954
>
> Title:
> database-delete API is not validating database before delete operation
>
> Status in Openstack Database (Trove):
> Opinion
>
> Bug description:
> database-delete API is not validating database before delete operation.
> So if any user performs database-delete operation and that database doesn't
> exists, he didn't see any message and impression goes like database has
> been deleted.
> API call :
> trove database-delete <InstanceID> <databaseName>
>
> To manage notifications about this bug go to:
> https://bugs.launchpad.net/trove/+bug/1293954/+subscriptions
>

Petr Malik (pmalik)
Changed in trove:
assignee: Pradeep Kumar Chandani (pradeep-chandani) → Petr Malik (pmalik)
status: Opinion → In Progress
importance: Wishlist → Medium
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to trove (master)

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

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to trove (master)

Reviewed: https://review.openstack.org/387713
Committed: https://git.openstack.org/cgit/openstack/trove/commit/?id=16c6ec83288f79f7b40c952de7d4230154ac90c5
Submitter: Jenkins
Branch: master

commit 16c6ec83288f79f7b40c952de7d4230154ac90c5
Author: Petr Malik <email address hidden>
Date: Mon Oct 17 18:14:52 2016 -0400

    Fail on deleting non-existing database

    Check that the database exists before deleting it and
    fail if it does not.

    Trove database API implementation closely followed MySQL
    behavior which is to silently ignore deletes on non-existing
    databases.
    This strategy however no longer works that well with
    other datastores which generally fail.

    Trove users should be given a consistent experience.
    Failing with an explanatory message is safer with respect to other
    datastores and it is also consistent with how other Trove API
    (user, backup, cluster) work.

    Note: guestagent implementation was fix to handle
          limit=None in database (and user) queries.
          N >= None always returns True

    Change-Id: I1dc26c7b40d6e4867b145b8470e6e5277e5dcdb4
    Closes-Bug: 1293954

Changed in trove:
status: In Progress → Fix Released
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/trove 7.0.0.0b2

This issue was fixed in the openstack/trove 7.0.0.0b2 development milestone.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Remote bug watches

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