diff --git a/flint-spark-integration/src/main/scala/org/opensearch/flint/spark/FlintSpark.scala b/flint-spark-integration/src/main/scala/org/opensearch/flint/spark/FlintSpark.scala index 6d9a38ab7..c25524a6c 100644 --- a/flint-spark-integration/src/main/scala/org/opensearch/flint/spark/FlintSpark.scala +++ b/flint-spark-integration/src/main/scala/org/opensearch/flint/spark/FlintSpark.scala @@ -204,13 +204,13 @@ class FlintSpark(val spark: SparkSession) extends FlintSparkTransactionSupport w */ def updateIndex(index: FlintSparkIndex): Option[String] = { val indexName = index.name() - withTransaction[Option[String]](indexName, s"Update Flint index $indexName") { tx => - validateUpdateAllowed( - describeIndex(indexName) - .getOrElse(throw new IllegalStateException(s"Index $indexName doesn't exist")) - .options, - index.options) + validateUpdateAllowed( + describeIndex(indexName) + .getOrElse(throw new IllegalStateException(s"Index $indexName doesn't exist")) + .options, + index.options) + withTransaction[Option[String]](indexName, s"Update Flint index $indexName") { tx => // Relies on validation to forbid auto-to-auto and manual-to-manual updates index.options.autoRefresh() match { case true => updateIndexManualToAuto(index, tx) 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 b2d489c81..3bef0a45f 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 @@ -195,7 +195,8 @@ class FlintSparkTransactionITSuite extends OpenSearchTransactionSuite with Match .onTable(testTable) .addValueSet("name") .create() - } should have message s"Flint index $testFlintIndex already exists" + } should have message + s"Failed to execute index operation [Create Flint index $testFlintIndex with ignoreIfExists false] caused by: Flint index $testFlintIndex already exists" } test("should clean up metadata log entry if index data has been deleted") {