Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CreateNewImagingDatasetUI error handling #147

Open
rkm opened this issue Jun 22, 2021 · 1 comment
Open

CreateNewImagingDatasetUI error handling #147

rkm opened this issue Jun 22, 2021 · 1 comment

Comments

@rkm
Copy link
Member

rkm commented Jun 22, 2021

Describe the bug

Errors during the "create new imaging dataset" UI process leaves the database in a partially created state.

To Reproduce
Steps to reproduce the behavior:

  • Open the CreateNewImagingDatasetUI
  • Fill-in the details and load a template which has an error (e.g. duplicate column listed)
  • UI fails with "duplicate column" error
  • Fix error in template and re-try
  • UI fails with "table already exists"

Edit:

  • Some of the tables may be created
  • Some of the RDMP catalogues may be created

Expected behavior
If an error occurs, the database should not be left in an intermediate state.

RDMP.Dicom Plugin Version

v3.0.0

RDMP Version

v5.0.1

Stack Trace

Table 'XA_StudyTable' already exists
   at MySqlConnector.Core.ResultSet.ReadResultSetHeaderAsync(IOBehavior ioBehavior) in /_/src/MySqlConnector/Core/ResultSet.cs:line 50
   at MySqlConnector.MySqlDataReader.ActivateResultSet(CancellationToken cancellationToken) in /_/src/MySqlConnector/MySqlDataReader.cs:line 135
   at MySqlConnector.MySqlDataReader.CreateAsync(CommandListPosition commandListPosition, ICommandPayloadCreator payloadCreator, IDictionary`2 cachedProcedures, IMySqlCommand command, CommandBehavior behavior, IOBehavior ioBehavior, CancellationToken cancellationToken) in /_/src/MySqlConnector/MySqlDataReader.cs:line 444
   at MySqlConnector.Core.CommandExecutor.ExecuteReaderAsync(IReadOnlyList`1 commands, ICommandPayloadCreator payloadCreator, CommandBehavior behavior, IOBehavior ioBehavior, CancellationToken cancellationToken) in /_/src/MySqlConnector/Core/CommandExecutor.cs:line 60
   at MySqlConnector.MySqlCommand.ExecuteNonQueryAsync(IOBehavior ioBehavior, CancellationToken cancellationToken) in /_/src/MySqlConnector/MySqlCommand.cs:line 266
   at MySqlConnector.MySqlCommand.ExecuteNonQuery() in /_/src/MySqlConnector/MySqlCommand.cs:line 101
   at FAnsi.Discovery.DiscoveredDatabaseHelper.ExecuteBatchNonQuery(String sql, DbConnection conn, DbTransaction transaction, Dictionary`2& performanceFigures, Int32 timeout)
   at FAnsi.Discovery.DiscoveredDatabaseHelper.CreateTable(CreateTableArgs args)
   at FAnsi.Discovery.DiscoveredDatabase.CreateTable(CreateTableArgs args)
   at FAnsi.Discovery.DiscoveredDatabase.CreateTable(String tableName, DatabaseColumnRequest[] columns, String schema, IDatabaseColumnRequestAdjuster adjuster)
   at DicomTypeTranslation.TableCreation.ImagingTableCreation.CreateTable(DiscoveredTable expectedTable, ImageTableTemplate tableTemplate)
   at Rdmp.Dicom.CommandExecution.ExecuteCommandCreateNewImagingDataset.Execute()
   at Rdmp.Dicom.CommandExecution.ExecuteCommandCreateNewImagingDatasetSuite.Execute()
   at Rdmp.Dicom.UI.CreateNewImagingDatasetUI.CreateSuite(ImageTableTemplateCollection template)
   at Rdmp.Dicom.UI.CreateNewImagingDatasetUI.btnCreateSuiteWithTemplate_Click(Object sender, EventArgs e)
@tznind
Copy link
Contributor

tznind commented Jun 23, 2021

Thanks yeah should be possible to do a better job of tidyup. But need to be careful to only delete stuff definetly created as part of the process. Don't want to drop our CT_ImageTable because we tried to create the template with CT_ prefix by accident

Also probably have to think about fringe cases e.g. where user account has CREATE but not DROP

It would be nice to do it all in a transaction in the DBMS but not all DBMS will let you do DDL operations in a transaction with rollback

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants