HHH-11209 : Log a DEBUG message if collection with queued operations is detached due to rollback; otherwise, log INFO message

(cherry picked from commit e12a688524)
This commit is contained in:
Gail Badner 2018-11-14 00:25:24 -08:00
parent ed1644247e
commit 638a181461
2 changed files with 22 additions and 12 deletions

View File

@ -612,18 +612,28 @@ public abstract class AbstractPersistentCollection implements Serializable, Pers
if ( !isTempSession ) { if ( !isTempSession ) {
if ( hasQueuedOperations() ) { if ( hasQueuedOperations() ) {
final String collectionInfoString = MessageHelper.collectionInfoString( getRole(), getKey() ); final String collectionInfoString = MessageHelper.collectionInfoString( getRole(), getKey() );
final TransactionStatus transactionStatus = try {
session.getTransactionCoordinator().getTransactionDriverControl().getStatus(); final TransactionStatus transactionStatus =
if ( transactionStatus.isOneOf( session.getTransactionCoordinator().getTransactionDriverControl().getStatus();
TransactionStatus.ROLLED_BACK, if ( transactionStatus.isOneOf(
TransactionStatus.MARKED_ROLLBACK, TransactionStatus.ROLLED_BACK,
TransactionStatus.FAILED_COMMIT, TransactionStatus.MARKED_ROLLBACK,
TransactionStatus.FAILED_ROLLBACK, TransactionStatus.FAILED_COMMIT,
TransactionStatus.ROLLING_BACK TransactionStatus.FAILED_ROLLBACK,
) ) { TransactionStatus.ROLLING_BACK
LOG.queuedOperationWhenDetachFromSessionOnRollback( collectionInfoString ); ) ) {
// It was due to a rollback.
LOG.queuedOperationWhenDetachFromSessionOnRollback( collectionInfoString );
}
else {
// We don't know why the collection is being detached.
// Just log the info.
LOG.queuedOperationWhenDetachFromSession( collectionInfoString );
}
} }
else { catch (Exception e) {
// We don't know why the collection is being detached.
// Just log the info.
LOG.queuedOperationWhenDetachFromSession( collectionInfoString ); LOG.queuedOperationWhenDetachFromSession( collectionInfoString );
} }
} }

View File

@ -1800,7 +1800,7 @@ public interface CoreMessageLogger extends BasicLogger {
@Message(value = "Attaching an uninitialized collection with queued operations to a session: %s", id = 495) @Message(value = "Attaching an uninitialized collection with queued operations to a session: %s", id = 495)
void queuedOperationWhenAttachToSession(String collectionInfoString); void queuedOperationWhenAttachToSession(String collectionInfoString);
@LogMessage(level = WARN) @LogMessage(level = INFO)
@Message(value = "Detaching an uninitialized collection with queued operations from a session: %s", id = 496) @Message(value = "Detaching an uninitialized collection with queued operations from a session: %s", id = 496)
void queuedOperationWhenDetachFromSession(String collectionInfoString); void queuedOperationWhenDetachFromSession(String collectionInfoString);