diff --git a/flint-spark-integration/src/main/scala/org/opensearch/flint/spark/FlintSparkTransactionSupport.scala b/flint-spark-integration/src/main/scala/org/opensearch/flint/spark/FlintSparkTransactionSupport.scala index 022b878d9..27c91efe5 100644 --- a/flint-spark-integration/src/main/scala/org/opensearch/flint/spark/FlintSparkTransactionSupport.scala +++ b/flint-spark-integration/src/main/scala/org/opensearch/flint/spark/FlintSparkTransactionSupport.scala @@ -43,21 +43,21 @@ trait FlintSparkTransactionSupport { self: Logging => */ def withTransaction[T](indexName: String, opName: String, forceInit: Boolean = false)( opBlock: OptimisticTransaction[T] => T): T = { - logInfo(s"Starting index operation [$opName for $indexName] with forceInit=$forceInit") + logInfo(s"Starting index operation [$opName $indexName] with forceInit=$forceInit") try { // Create transaction (only have side effect if forceInit is true) val tx: OptimisticTransaction[T] = flintMetadataLogService.startTransaction(indexName, forceInit) val result = opBlock(tx) - logInfo(s"Index operation [$opName] complete") + logInfo(s"Index operation [$opName $indexName] complete") result } catch { case e: Exception => // Extract and add root cause message to final error message val rootCauseMessage = extractRootCause(e) val detailedMessage = - s"Failed to execute index operation [$opName] caused by: $rootCauseMessage" + s"Failed to execute index operation [$opName $indexName] caused by: $rootCauseMessage" logError(detailedMessage, e) // Re-throw with new detailed error message diff --git a/flint-spark-integration/src/test/scala/org/opensearch/flint/spark/FlintSparkTransactionSupportSuite.scala b/flint-spark-integration/src/test/scala/org/opensearch/flint/spark/FlintSparkTransactionSupportSuite.scala index 28960e169..129d46ec7 100644 --- a/flint-spark-integration/src/test/scala/org/opensearch/flint/spark/FlintSparkTransactionSupportSuite.scala +++ b/flint-spark-integration/src/test/scala/org/opensearch/flint/spark/FlintSparkTransactionSupportSuite.scala @@ -43,7 +43,7 @@ class FlintSparkTransactionSupportSuite extends FlintSuite with Matchers { throw new IllegalArgumentException("Fake exception") } } should have message - "Failed to execute index operation [test operation] caused by: Fake exception" + s"Failed to execute index operation [test operation $testIndex] caused by: Fake exception" } test("should throw exception with root cause exception message") { @@ -54,6 +54,6 @@ class FlintSparkTransactionSupportSuite extends FlintSuite with Matchers { throw new IllegalStateException("message ignored", cause) } } should have message - "Failed to execute index operation [test operation] caused by: Fake root cause" + s"Failed to execute index operation [test operation $testIndex] caused by: Fake root cause" } } diff --git a/integ-test/src/test/scala/org/opensearch/flint/spark/FlintSparkTransactionITSuite.scala b/integ-test/src/test/scala/org/opensearch/flint/spark/FlintSparkTransactionITSuite.scala index 7b31da57a..75ad970d2 100644 --- a/integ-test/src/test/scala/org/opensearch/flint/spark/FlintSparkTransactionITSuite.scala +++ b/integ-test/src/test/scala/org/opensearch/flint/spark/FlintSparkTransactionITSuite.scala @@ -187,7 +187,7 @@ class FlintSparkTransactionITSuite extends OpenSearchTransactionSuite with Match the[IllegalStateException] thrownBy { flint.vacuumIndex(testFlintIndex) } should have message - s"Failed to execute index operation [Vacuum Flint index] caused by: Index state [active] doesn't satisfy precondition" + s"Failed to execute index operation [Vacuum Flint index $testFlintIndex] caused by: Index state [active] doesn't satisfy precondition" } test("should not recreate index if index data still exists") { @@ -209,7 +209,7 @@ class FlintSparkTransactionITSuite extends OpenSearchTransactionSuite with Match .addValueSet("name") .create() } should have message - s"Failed to execute index operation [Create Flint index] caused by: Flint index $testFlintIndex already exists" + s"Failed to execute index operation [Create Flint index $testFlintIndex] caused by: Flint index $testFlintIndex already exists" } test("should clean up metadata log entry if index data has been deleted") {