Opened 6 years ago

Closed 2 years ago

#134 closed defect (fixed)

rasdl --del* bug when deleting used types

Reported by: dmisev Owned by: bphamhuu
Priority: minor Milestone: Future
Component: rasdl Version: 8.3
Keywords: Cc: pbaumann
Complexity: Easy


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 Changed 5 years ago by beccati@…

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.

comment:2 Changed 5 years ago by pbaumann

  • Milestone set to Future

comment:3 Changed 3 years ago by abeccati

  • Complexity set to Easy

comment:4 Changed 2 years ago by dmisev

  • Owner changed from erodriguez to bphamhuu
  • Status changed from new to assigned

comment:5 Changed 2 years ago by bphamhuu

I've reviewed the code file ( it looks like from the time ticket 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 2 years ago by bphamhuu (previous) (diff)

comment:6 Changed 2 years ago by pbaumann

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 Changed 2 years ago by bphamhuu

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 Changed 2 years ago by dmisev

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

comment:9 Changed 2 years ago by dmisev

@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 Changed 2 years ago by bphamhuu

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 Changed 2 years ago by bphamhuu

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 Changed 2 years ago by bphamhuu

  • Resolution set to fixed
  • Status changed from assigned to closed
Note: See TracTickets for help on using tickets.