Opened 13 years ago

Closed 9 years ago

#134 closed defect (fixed)

rasdl --del* bug when deleting used types

Reported by: Dimitar Misev Owned by: Bang Pham Huu
Priority: minor Milestone: Future
Component: rasdl Version: 8.3
Keywords: Cc: Peter Baumann
Complexity: Easy

Description

When deleting a type, and there's an existing collection that makes use of that type, rasdl reports that the type has been deleted properly, but it should actually report an error, that it can't delete a type that is in use.

Change History (12)

comment:1 by beccati@…, 13 years ago

Moreover, I think it should report an error (or at least some kind of warning) when trying to delete types that do not exist.

To test it try deleting anything with a random name and it will report a clean successful deletion.
Alan

comment:2 by Peter Baumann, 12 years ago

Milestone: Future

comment:3 by abeccati, 11 years ago

Complexity: Easy

comment:4 by Dimitar Misev, 9 years ago

Owner: changed from Ernesto Rodriguez to Bang Pham Huu
Status: newassigned

comment:5 by Bang Pham Huu, 9 years ago

I've reviewed the code file (typefactory.cc) it looks like from the time ticket http://rasdaman.org/ticket/1004 this has been already fixed but it could not print out to terminal because this line (using LTRACE instead of cout), the same with other commands which should use cout to print.

LTRACE << "will not be deleted from db"; 

However, I think it could be enhanced with this error to show the name of using collections. And I simply add a variable 'collectionList' to store:

 string collectionList = ""; // for storing using coverage ID by settype
 for (OIdSet::iterator miter = theList->begin(); miter != theList->end(); miter++)
        {
            if (DBMDDSetId(*miter)->getCollType() == resultType)
            {
                LTRACE << "set object " << *miter << " contains " << typeName;
                // How from miter ID could get the collection name? *miter = OID of object
                
                collectionList = collectionList + " " + DBMDDSetId(*miter)->getName() + ",";                                
                canDelete = false;                  
            }
        }

and have a message with reason

cout << typeName << " will not be deleted from db due to using by collections. Please view below:" << endl;
cout << "List collections: " << collectionList << endl;

If you agree, I will apply this kind of message to deleteMDDType and deleteBaseType also. I think it should be clearer why user could not delete.

Last edited 9 years ago by Bang Pham Huu (previous) (diff)

comment:6 by Peter Baumann, 9 years ago

don't print out the collection elements. But making the error message more informative is good, such as:
"Cannot delete type X: instances existing."

comment:7 by Bang Pham Huu, 9 years ago

I think, user will have no clue to know which collections is using this settype to do data management. Anyway I will do this as you want but I still want to listen a suitable reason for not showing detail information.

comment:8 by Dimitar Misev, 9 years ago

Best to just change LTRACE to LINFO. As we said rasdl is deprecated, so do not spend so much time on it.

comment:9 by Dimitar Misev, 9 years ago

@Bang - imagine you have a million collection that use the type, then your error message will be huge, listing a million collection names. Just say it the type cannot be deleted because it's in use in the database, or doesn't exist.

comment:10 by Bang Pham Huu, 9 years ago

yes, thanks Dimitar for your suitable response (actually I know this is the case that could make very huge, I have a solution that it will list only 10 collections using then break or just iterate to maximum 100 first collections (if it not have enough 10 collections).

Anyway a patch should be fixed first and we could come back to this later (a new enhancement with another ticket) if rasdl still could be used in next versions.

comment:11 by Bang Pham Huu, 9 years ago

A patch has been accepted so I will happily close this ticket.

ticket:134 - rasdl —del* bug when deleting used types (with ticket 1004 duplicated) BangPH <b.phamhuu@…> master 2015-10-23 10:57:14 Download patch APPLIED SUCCESS

comment:12 by Bang Pham Huu, 9 years ago

Resolution: fixed
Status: assignedclosed
Note: See TracTickets for help on using tickets.