You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hudi.apache.org by "XuQianJin-Stars (via GitHub)" <gi...@apache.org> on 2023/02/23 06:45:23 UTC

[GitHub] [hudi] XuQianJin-Stars opened a new pull request, #8024: [MINOR] improve RollbackToInstantTimeProcedure

XuQianJin-Stars opened a new pull request, #8024:
URL: https://github.com/apache/hudi/pull/8024

   ### Change Logs
   
   improve RollbackToInstantTimeProcedure
   
   ### Impact
   
   NA
   
   ### Risk level (write none, low medium or high below)
   
   none
   
   ### Documentation Update
   
   NA
   
   ### Contributor's checklist
   
   - [ ] Read through [contributor's guide](https://hudi.apache.org/contribute/how-to-contribute)
   - [ ] Change Logs and Impact were stated clearly
   - [ ] Adequate tests were added if applicable
   - [ ] CI passed
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@hudi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [hudi] SteNicholas commented on a diff in pull request #8024: [MINOR] Improve RollbackToInstantTimeProcedure

Posted by "SteNicholas (via GitHub)" <gi...@apache.org>.
SteNicholas commented on code in PR #8024:
URL: https://github.com/apache/hudi/pull/8024#discussion_r1116609526


##########
hudi-spark-datasource/hudi-spark/src/main/scala/org/apache/spark/sql/hudi/command/procedures/RollbackToInstantTimeProcedure.scala:
##########
@@ -38,7 +37,8 @@ class RollbackToInstantTimeProcedure extends BaseProcedure with ProcedureBuilder
     ProcedureParameter.required(1, "instant_time", DataTypes.StringType, None))
 
   private val OUTPUT_TYPE = new StructType(Array[StructField](
-    StructField("rollback_result", DataTypes.BooleanType, nullable = true, Metadata.empty))
+    StructField("rollback_result", DataTypes.BooleanType, nullable = true, Metadata.empty),
+    StructField("instant_time", DataTypes.StringType, nullable = true, Metadata.empty))

Review Comment:
   Like `rollback_to_savepoint`, the request argument of `rollback_to_instant` has the `instant_time`, therefore the return result doesn't need the `instant_time`.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@hudi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [hudi] hudi-bot commented on pull request #8024: [MINOR] Improve RollbackToInstantTimeProcedure

Posted by "hudi-bot (via GitHub)" <gi...@apache.org>.
hudi-bot commented on PR #8024:
URL: https://github.com/apache/hudi/pull/8024#issuecomment-1443550646

   <!--
   Meta data
   {
     "version" : 1,
     "metaDataEntries" : [ {
       "hash" : "7c0543843874887de825c3af7bc1941e2abe0049",
       "status" : "FAILURE",
       "url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=15356",
       "triggerID" : "7c0543843874887de825c3af7bc1941e2abe0049",
       "triggerType" : "PUSH"
     }, {
       "hash" : "404047bbd1277cb70a2c5c06fc95caad8a8cecd8",
       "status" : "UNKNOWN",
       "url" : "TBD",
       "triggerID" : "404047bbd1277cb70a2c5c06fc95caad8a8cecd8",
       "triggerType" : "PUSH"
     } ]
   }-->
   ## CI report:
   
   * 7c0543843874887de825c3af7bc1941e2abe0049 Azure: [FAILURE](https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=15356) 
   * 404047bbd1277cb70a2c5c06fc95caad8a8cecd8 UNKNOWN
   
   <details>
   <summary>Bot commands</summary>
     @hudi-bot supports the following commands:
   
    - `@hudi-bot run azure` re-run the last Azure build
   </details>


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@hudi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [hudi] SteNicholas commented on a diff in pull request #8024: [MINOR] Improve RollbackToInstantTimeProcedure

Posted by "SteNicholas (via GitHub)" <gi...@apache.org>.
SteNicholas commented on code in PR #8024:
URL: https://github.com/apache/hudi/pull/8024#discussion_r1116542929


##########
hudi-spark-datasource/hudi-spark/src/main/scala/org/apache/spark/sql/hudi/command/procedures/RollbackToInstantTimeProcedure.scala:
##########
@@ -73,10 +73,14 @@ class RollbackToInstantTimeProcedure extends BaseProcedure with ProcedureBuilder
         throw new HoodieException(s"Commit $instantTime not found in Commits $completedTimeline")
       }
 
-      val result = if (client.rollback(instantTime)) true else false
-      val outputRow = Row(result)
+      val outputRow = new util.ArrayList[Row]
+      val allInstants: List[HoodieInstant] = completedTimeline
+        .findInstantsAfterOrEquals(instantTime, Integer.MAX_VALUE).getReverseOrderedInstants.toArray()
+        .map(r => r.asInstanceOf[HoodieInstant]).toList
 
-      Seq(outputRow)
+      allInstants.foreach(p => outputRow.add(Row(client.rollback(p.getTimestamp), p.getTimestamp)))

Review Comment:
   Like `rollback_to_savepoint`, the request argument of `rollback_to_instant` has the `instant_time`, therefore the return result doesn't need the `instant_time`.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@hudi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [hudi] hudi-bot commented on pull request #8024: [MINOR] Improve RollbackToInstantTimeProcedure

Posted by "hudi-bot (via GitHub)" <gi...@apache.org>.
hudi-bot commented on PR #8024:
URL: https://github.com/apache/hudi/pull/8024#issuecomment-1441647923

   <!--
   Meta data
   {
     "version" : 1,
     "metaDataEntries" : [ {
       "hash" : "7c0543843874887de825c3af7bc1941e2abe0049",
       "status" : "FAILURE",
       "url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=15356",
       "triggerID" : "7c0543843874887de825c3af7bc1941e2abe0049",
       "triggerType" : "PUSH"
     } ]
   }-->
   ## CI report:
   
   * 7c0543843874887de825c3af7bc1941e2abe0049 Azure: [FAILURE](https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=15356) 
   
   <details>
   <summary>Bot commands</summary>
     @hudi-bot supports the following commands:
   
    - `@hudi-bot run azure` re-run the last Azure build
   </details>


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@hudi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [hudi] danny0405 commented on pull request #8024: [MINOR] Improve RollbackToInstantTimeProcedure

Posted by "danny0405 (via GitHub)" <gi...@apache.org>.
danny0405 commented on PR #8024:
URL: https://github.com/apache/hudi/pull/8024#issuecomment-1441599873

   Can we elaborate a little what are we try to improve here?


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@hudi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [hudi] XuQianJin-Stars commented on pull request #8024: [MINOR] Improve RollbackToInstantTimeProcedure

Posted by "XuQianJin-Stars (via GitHub)" <gi...@apache.org>.
XuQianJin-Stars commented on PR #8024:
URL: https://github.com/apache/hudi/pull/8024#issuecomment-1442708173

   > Can we elaborate a little what are we try to improve here?
   
   updated


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@hudi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [hudi] hudi-bot commented on pull request #8024: [MINOR] Improve RollbackToInstantTimeProcedure

Posted by "hudi-bot (via GitHub)" <gi...@apache.org>.
hudi-bot commented on PR #8024:
URL: https://github.com/apache/hudi/pull/8024#issuecomment-1443558386

   <!--
   Meta data
   {
     "version" : 1,
     "metaDataEntries" : [ {
       "hash" : "7c0543843874887de825c3af7bc1941e2abe0049",
       "status" : "FAILURE",
       "url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=15356",
       "triggerID" : "7c0543843874887de825c3af7bc1941e2abe0049",
       "triggerType" : "PUSH"
     }, {
       "hash" : "404047bbd1277cb70a2c5c06fc95caad8a8cecd8",
       "status" : "PENDING",
       "url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=15384",
       "triggerID" : "404047bbd1277cb70a2c5c06fc95caad8a8cecd8",
       "triggerType" : "PUSH"
     } ]
   }-->
   ## CI report:
   
   * 7c0543843874887de825c3af7bc1941e2abe0049 Azure: [FAILURE](https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=15356) 
   * 404047bbd1277cb70a2c5c06fc95caad8a8cecd8 Azure: [PENDING](https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=15384) 
   
   <details>
   <summary>Bot commands</summary>
     @hudi-bot supports the following commands:
   
    - `@hudi-bot run azure` re-run the last Azure build
   </details>


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@hudi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [hudi] xiarixiaoyao commented on a diff in pull request #8024: [MINOR] Improve RollbackToInstantTimeProcedure

Posted by "xiarixiaoyao (via GitHub)" <gi...@apache.org>.
xiarixiaoyao commented on code in PR #8024:
URL: https://github.com/apache/hudi/pull/8024#discussion_r1116474823


##########
hudi-spark-datasource/hudi-spark/src/main/scala/org/apache/spark/sql/hudi/command/procedures/RollbackToInstantTimeProcedure.scala:
##########
@@ -73,10 +73,14 @@ class RollbackToInstantTimeProcedure extends BaseProcedure with ProcedureBuilder
         throw new HoodieException(s"Commit $instantTime not found in Commits $completedTimeline")
       }
 
-      val result = if (client.rollback(instantTime)) true else false
-      val outputRow = Row(result)
+      val outputRow = new util.ArrayList[Row]
+      val allInstants: List[HoodieInstant] = completedTimeline
+        .findInstantsAfterOrEquals(instantTime, Integer.MAX_VALUE).getReverseOrderedInstants.toArray()
+        .map(r => r.asInstanceOf[HoodieInstant]).toList
 
-      Seq(outputRow)
+      allInstants.foreach(p => outputRow.add(Row(client.rollback(p.getTimestamp), p.getTimestamp)))

Review Comment:
   why we need outputRow, 
   how about return allInstants.map(p => Row(client.rollback(p.getTimestamp), p.getTimestamp))  directly



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@hudi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [hudi] XuQianJin-Stars commented on a diff in pull request #8024: [MINOR] Improve RollbackToInstantTimeProcedure

Posted by "XuQianJin-Stars (via GitHub)" <gi...@apache.org>.
XuQianJin-Stars commented on code in PR #8024:
URL: https://github.com/apache/hudi/pull/8024#discussion_r1116830778


##########
hudi-spark-datasource/hudi-spark/src/main/scala/org/apache/spark/sql/hudi/command/procedures/RollbackToInstantTimeProcedure.scala:
##########
@@ -38,7 +37,8 @@ class RollbackToInstantTimeProcedure extends BaseProcedure with ProcedureBuilder
     ProcedureParameter.required(1, "instant_time", DataTypes.StringType, None))
 
   private val OUTPUT_TYPE = new StructType(Array[StructField](
-    StructField("rollback_result", DataTypes.BooleanType, nullable = true, Metadata.empty))
+    StructField("rollback_result", DataTypes.BooleanType, nullable = true, Metadata.empty),
+    StructField("instant_time", DataTypes.StringType, nullable = true, Metadata.empty))

Review Comment:
   > Like `rollback_to_savepoint`, the request argument of `rollback_to_instant` has the `instant_time`, therefore the return result doesn't need the `instant_time`.
   
   This will iteratively output multiple lines of rollback instants.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@hudi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [hudi] hudi-bot commented on pull request #8024: [MINOR] Improve RollbackToInstantTimeProcedure

Posted by "hudi-bot (via GitHub)" <gi...@apache.org>.
hudi-bot commented on PR #8024:
URL: https://github.com/apache/hudi/pull/8024#issuecomment-1443737757

   <!--
   Meta data
   {
     "version" : 1,
     "metaDataEntries" : [ {
       "hash" : "7c0543843874887de825c3af7bc1941e2abe0049",
       "status" : "DELETED",
       "url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=15356",
       "triggerID" : "7c0543843874887de825c3af7bc1941e2abe0049",
       "triggerType" : "PUSH"
     }, {
       "hash" : "404047bbd1277cb70a2c5c06fc95caad8a8cecd8",
       "status" : "FAILURE",
       "url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=15384",
       "triggerID" : "404047bbd1277cb70a2c5c06fc95caad8a8cecd8",
       "triggerType" : "PUSH"
     } ]
   }-->
   ## CI report:
   
   * 404047bbd1277cb70a2c5c06fc95caad8a8cecd8 Azure: [FAILURE](https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=15384) 
   
   <details>
   <summary>Bot commands</summary>
     @hudi-bot supports the following commands:
   
    - `@hudi-bot run azure` re-run the last Azure build
   </details>


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@hudi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [hudi] hudi-bot commented on pull request #8024: [MINOR] Improve RollbackToInstantTimeProcedure

Posted by "hudi-bot (via GitHub)" <gi...@apache.org>.
hudi-bot commented on PR #8024:
URL: https://github.com/apache/hudi/pull/8024#issuecomment-1441297202

   <!--
   Meta data
   {
     "version" : 1,
     "metaDataEntries" : [ {
       "hash" : "7c0543843874887de825c3af7bc1941e2abe0049",
       "status" : "UNKNOWN",
       "url" : "TBD",
       "triggerID" : "7c0543843874887de825c3af7bc1941e2abe0049",
       "triggerType" : "PUSH"
     } ]
   }-->
   ## CI report:
   
   * 7c0543843874887de825c3af7bc1941e2abe0049 UNKNOWN
   
   <details>
   <summary>Bot commands</summary>
     @hudi-bot supports the following commands:
   
    - `@hudi-bot run azure` re-run the last Azure build
   </details>


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@hudi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [hudi] hudi-bot commented on pull request #8024: [MINOR] Improve RollbackToInstantTimeProcedure

Posted by "hudi-bot (via GitHub)" <gi...@apache.org>.
hudi-bot commented on PR #8024:
URL: https://github.com/apache/hudi/pull/8024#issuecomment-1441302888

   <!--
   Meta data
   {
     "version" : 1,
     "metaDataEntries" : [ {
       "hash" : "7c0543843874887de825c3af7bc1941e2abe0049",
       "status" : "PENDING",
       "url" : "https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=15356",
       "triggerID" : "7c0543843874887de825c3af7bc1941e2abe0049",
       "triggerType" : "PUSH"
     } ]
   }-->
   ## CI report:
   
   * 7c0543843874887de825c3af7bc1941e2abe0049 Azure: [PENDING](https://dev.azure.com/apache-hudi-ci-org/785b6ef4-2f42-4a89-8f0e-5f0d7039a0cc/_build/results?buildId=15356) 
   
   <details>
   <summary>Bot commands</summary>
     @hudi-bot supports the following commands:
   
    - `@hudi-bot run azure` re-run the last Azure build
   </details>


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@hudi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [hudi] SteNicholas commented on a diff in pull request #8024: [MINOR] Improve RollbackToInstantTimeProcedure

Posted by "SteNicholas (via GitHub)" <gi...@apache.org>.
SteNicholas commented on code in PR #8024:
URL: https://github.com/apache/hudi/pull/8024#discussion_r1116542929


##########
hudi-spark-datasource/hudi-spark/src/main/scala/org/apache/spark/sql/hudi/command/procedures/RollbackToInstantTimeProcedure.scala:
##########
@@ -73,10 +73,14 @@ class RollbackToInstantTimeProcedure extends BaseProcedure with ProcedureBuilder
         throw new HoodieException(s"Commit $instantTime not found in Commits $completedTimeline")
       }
 
-      val result = if (client.rollback(instantTime)) true else false
-      val outputRow = Row(result)
+      val outputRow = new util.ArrayList[Row]
+      val allInstants: List[HoodieInstant] = completedTimeline
+        .findInstantsAfterOrEquals(instantTime, Integer.MAX_VALUE).getReverseOrderedInstants.toArray()
+        .map(r => r.asInstanceOf[HoodieInstant]).toList
 
-      Seq(outputRow)
+      allInstants.foreach(p => outputRow.add(Row(client.rollback(p.getTimestamp), p.getTimestamp)))

Review Comment:
   The request argument of `rollback_to_instant` has the `instant_time`, therefore the return result doesn't need the `instant_time`.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@hudi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [hudi] XuQianJin-Stars commented on a diff in pull request #8024: [MINOR] Improve RollbackToInstantTimeProcedure

Posted by "XuQianJin-Stars (via GitHub)" <gi...@apache.org>.
XuQianJin-Stars commented on code in PR #8024:
URL: https://github.com/apache/hudi/pull/8024#discussion_r1116834151


##########
hudi-spark-datasource/hudi-spark/src/main/scala/org/apache/spark/sql/hudi/command/procedures/RollbackToInstantTimeProcedure.scala:
##########
@@ -73,10 +73,14 @@ class RollbackToInstantTimeProcedure extends BaseProcedure with ProcedureBuilder
         throw new HoodieException(s"Commit $instantTime not found in Commits $completedTimeline")
       }
 
-      val result = if (client.rollback(instantTime)) true else false
-      val outputRow = Row(result)
+      val outputRow = new util.ArrayList[Row]
+      val allInstants: List[HoodieInstant] = completedTimeline
+        .findInstantsAfterOrEquals(instantTime, Integer.MAX_VALUE).getReverseOrderedInstants.toArray()
+        .map(r => r.asInstanceOf[HoodieInstant]).toList
 
-      Seq(outputRow)
+      allInstants.foreach(p => outputRow.add(Row(client.rollback(p.getTimestamp), p.getTimestamp)))

Review Comment:
   > why we need outputRow, how about return allInstants.map(p => Row(client.rollback(p.getTimestamp), p.getTimestamp)) directly
   
   A bit hesitant to add `limit`



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@hudi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org