Add LOG.warns any time we rollback a transaction from top-level StreamedETL process code.

This commit is contained in:
2023-09-07 12:08:43 -05:00
parent 01a19180b9
commit d9458ced34
3 changed files with 12 additions and 0 deletions

View File

@ -31,6 +31,7 @@ import com.kingsrook.qqq.backend.core.actions.AbstractQActionFunction;
import com.kingsrook.qqq.backend.core.actions.QBackendTransaction; import com.kingsrook.qqq.backend.core.actions.QBackendTransaction;
import com.kingsrook.qqq.backend.core.actions.tables.helpers.UniqueKeyHelper; import com.kingsrook.qqq.backend.core.actions.tables.helpers.UniqueKeyHelper;
import com.kingsrook.qqq.backend.core.exceptions.QException; import com.kingsrook.qqq.backend.core.exceptions.QException;
import com.kingsrook.qqq.backend.core.logging.QLogger;
import com.kingsrook.qqq.backend.core.model.actions.tables.delete.DeleteInput; import com.kingsrook.qqq.backend.core.model.actions.tables.delete.DeleteInput;
import com.kingsrook.qqq.backend.core.model.actions.tables.delete.DeleteOutput; import com.kingsrook.qqq.backend.core.model.actions.tables.delete.DeleteOutput;
import com.kingsrook.qqq.backend.core.model.actions.tables.insert.InsertInput; import com.kingsrook.qqq.backend.core.model.actions.tables.insert.InsertInput;
@ -61,6 +62,9 @@ import com.kingsrook.qqq.backend.core.utils.CollectionUtils;
*******************************************************************************/ *******************************************************************************/
public class ReplaceAction extends AbstractQActionFunction<ReplaceInput, ReplaceOutput> public class ReplaceAction extends AbstractQActionFunction<ReplaceInput, ReplaceOutput>
{ {
private static final QLogger LOG = QLogger.getLogger(ReplaceAction.class);
/******************************************************************************* /*******************************************************************************
** **
@ -159,6 +163,7 @@ public class ReplaceAction extends AbstractQActionFunction<ReplaceInput, Replace
{ {
if(weOwnTheTransaction) if(weOwnTheTransaction)
{ {
LOG.warn("Caught top-level ReplaceAction exception - rolling back exception", e);
transaction.rollback(); transaction.rollback();
} }
throw (new QException("Error executing replace action", e)); throw (new QException("Error executing replace action", e));

View File

@ -92,6 +92,7 @@ public class StreamedETLBackendStep implements BackendStep
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
// rollback the work, then re-throw the error for up-stream to catch & report // // rollback the work, then re-throw the error for up-stream to catch & report //
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
LOG.warn("Caught top-level process exception - rolling back transaction", e);
transaction.rollback(); transaction.rollback();
throw (e); throw (e);
} }

View File

@ -198,8 +198,13 @@ public class StreamedETLExecuteStep extends BaseStreamedETLStep implements Backe
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
if(transaction.isPresent()) if(transaction.isPresent())
{ {
LOG.warn("Caught top-level process exception - rolling back transaction", e);
transaction.get().rollback(); transaction.get().rollback();
} }
else
{
LOG.warn("Caught top-level process exception - would roll back transaction, but none is present", e);
}
throw (e); throw (e);
} }
finally finally
@ -302,6 +307,7 @@ public class StreamedETLExecuteStep extends BaseStreamedETLStep implements Backe
{ {
if(doPageLevelTransaction && transaction.isPresent()) if(doPageLevelTransaction && transaction.isPresent())
{ {
LOG.warn("Caught page-level process exception - rolling back transaction", e);
transaction.get().rollback(); transaction.get().rollback();
} }
throw (e); throw (e);