{"record":{"id":"1134eddea42433be","repo":"pentaho/pentaho-kettle","slug":"this-operation-was-cancelled-gettablesizeprogressdialog","errorCode":null,"errorMessage":"This operation was cancelled!","messagePattern":"This operation was cancelled!","errorType":"exception","errorClass":"InvocationTargetException","httpStatus":null,"severity":"warning","filePath":"ui/src/main/java/org/pentaho/di/ui/core/database/dialog/GetTableSizeProgressDialog.java","lineNumber":73,"sourceCode":"  public GetTableSizeProgressDialog( Shell shell, DatabaseMeta dbInfo, String tableName, String schemaName ) {\n    this.shell = shell;\n    this.dbMeta = dbInfo;\n    this.tableName = dbInfo.getQuotedSchemaTableCombination( schemaName, tableName );\n  }\n\n  public Long open() {\n    IRunnableWithProgress op = new IRunnableWithProgress() {\n      public void run( IProgressMonitor monitor ) throws InvocationTargetException, InterruptedException {\n        db = new Database( Spoon.loggingObject, dbMeta );\n        try {\n          db.connect();\n\n          String sql = dbMeta.getDatabaseInterface().getSelectCountStatement( tableName );\n          RowMetaAndData row = db.getOneRow( sql );\n          size = row.getRowMeta().getInteger( row.getData(), 0 );\n\n          if ( monitor.isCanceled() ) {\n            throw new InvocationTargetException( new Exception( \"This operation was cancelled!\" ) );\n          }\n\n        } catch ( KettleException e ) {\n          throw new InvocationTargetException( e, \"Couldn't get a result because of an error :\" + e.toString() );\n        } finally {\n          db.close();\n        }\n      }\n    };\n\n    try {\n      final ProgressMonitorDialog pmd = new ProgressMonitorDialog( shell );\n      // Run something in the background to cancel active database queries, forecably if needed!\n      Runnable run = new Runnable() {\n        public void run() {\n          IProgressMonitor monitor = pmd.getProgressMonitor();\n          while ( pmd.getShell() == null || ( !pmd.getShell().isDisposed() && !monitor.isCanceled() ) ) {\n            try {","sourceCodeStart":55,"sourceCodeEnd":91,"githubUrl":"https://github.com/pentaho/pentaho-kettle/blob/f3058517a153da500bf4551f46d79b91bf8ec552/ui/src/main/java/org/pentaho/di/ui/core/database/dialog/GetTableSizeProgressDialog.java#L55-L91","documentation":"GetTableSizeProgressDialog computes a table size with a SELECT COUNT(*) query built by getSelectCountStatement. After the count returns, if the progress monitor was cancelled it throws an InvocationTargetException wrapping 'This operation was cancelled!' so the dialog reports the operation as cancelled instead of displaying a partial/stale size.","triggerScenarios":"Pressing Cancel in the progress dialog while the table-size calculation runs; monitor.isCanceled() true after db.getOneRow(sql) completes.","commonSituations":"Cancelling the size calculation on very large tables where COUNT(*) takes a long time (e.g. big fact tables in a warehouse).","solutions":["This is intentional user-cancellation feedback; catch the InvocationTargetException and exit quietly.","For huge tables, avoid COUNT(*) sizing (use catalog statistics/estimated row counts) so the operation finishes before the user cancels.","If cancellation fires unexpectedly, verify no shared/cancelled IProgressMonitor is passed to the dialog."],"exampleFix":"// before\nsize = new GetTableSizeProgressDialog( shell, dbMeta, tableName ).openSize();\n// after\ntry {\n  size = new GetTableSizeProgressDialog( shell, dbMeta, tableName ).openSize();\n} catch ( InvocationTargetException ite ) {\n  logLow( \"Table size calculation cancelled by user\" );\n}","handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try {\n  size = new GetTableSizeProgressDialog( shell, dbMeta, tableName ).openSize();\n} catch ( InvocationTargetException e ) {\n  if ( e.getCause() != null && \"This operation was cancelled!\".equals( e.getCause().getMessage() ) ) {\n    return; // user cancelled\n  }\n  logError( \"Size calc failed\", e );\n}","preventionTips":["Handle cancellation gracefully instead of logging an error.","For very large tables prefer catalog statistics over COUNT(*).","Pass a fresh, non-cancelled monitor to the dialog."],"tags":["cancellation","progress-dialog","database","table-size"],"backgroundTag":"operation-cancelled","analyzedSha":"f3058517a153da500bf4551f46d79b91bf8ec552","analyzedAt":"2026-09-13T14:04:16.340Z","contentChangedAt":"2026-09-13T14:04:16.340Z","schemaVersion":2},"datasetVersion":"2026-09-20T23:17:15.980Z"}