You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hudi.apache.org by GitBox <gi...@apache.org> on 2021/03/23 09:37:28 UTC

[GitHub] [hudi] zherenyu831 opened a new issue #2707: [SUPPORT] insert_ovewrite_table failed on archiving

zherenyu831 opened a new issue #2707:
URL: https://github.com/apache/hudi/issues/2707


   **_Tips before filing an issue_**
   
   - Have you gone through our [FAQs](https://cwiki.apache.org/confluence/display/HUDI/FAQ)?
   
   - Join the mailing list to engage in conversations and get faster support at dev-subscribe@hudi.apache.org.
   
   - If you have triaged this as a bug, then file an [issue](https://issues.apache.org/jira/projects/HUDI/issues) directly.
   
   **Describe the problem you faced**
   Configs
   ```
   hoodie.cleaner.incremental.mode -> true
   hoodie.insert.shuffle.parallelism -> 20
   hoodie.datasource.write.precombine.field -> daas_internal_ts
   hoodie.clean.automatic -> false
   hoodie.datasource.write.operation -> insert_overwrite_table
   hoodie.datasource.write.recordkey.field -> guid
   hoodie.table.name -> xxxxx
   hoodie.datasource.write.table.type -> MERGE_ON_READ
   hoodie.datasource.write.hive_style_partitioning -> true
   hoodie.consistency.check.enabled -> true
   hoodie.cleaner.policy -> KEEP_LATEST_FILE_VERSIONS
   hoodie.datasource.write.keygenerator.class -> org.apache.hudi.keygen.ComplexKeyGenerator
   hoodie.keep.max.commits -> 3
   hoodie.cleaner.commits.retained -> 1
   hoodie.keep.min.commits -> 2
   hoodie.datasource.write.partitionpath.field -> 
   hoodie.compact.inline.max.delta.commits -> 1
   ```
   
   after write 5 times we got below error
   ```
   21/03/23 09:29:38 ERROR MonitoringUtils$: sendFailureMetric - One of the batch jobs failed
   org.apache.hudi.exception.HoodieCommitException: Failed to archive commits
   	at org.apache.hudi.table.HoodieTimelineArchiveLog.archive(HoodieTimelineArchiveLog.java:322)
   	at org.apache.hudi.table.HoodieTimelineArchiveLog.archiveIfRequired(HoodieTimelineArchiveLog.java:138)
   	at org.apache.hudi.client.AbstractHoodieWriteClient.postCommit(AbstractHoodieWriteClient.java:426)
   	at org.apache.hudi.client.AbstractHoodieWriteClient.commitStats(AbstractHoodieWriteClient.java:188)
   	at org.apache.hudi.client.SparkRDDWriteClient.commit(SparkRDDWriteClient.java:110)
   	at org.apache.hudi.HoodieSparkSqlWriter$.commitAndPerformPostOperations(HoodieSparkSqlWriter.scala:442)
   	at org.apache.hudi.HoodieSparkSqlWriter$.write(HoodieSparkSqlWriter.scala:218)
   	at org.apache.hudi.DefaultSource.createRelation(DefaultSource.scala:134)
   	at org.apache.spark.sql.execution.datasources.SaveIntoDataSourceCommand.run(SaveIntoDataSourceCommand.scala:46)
   	at org.apache.spark.sql.execution.command.ExecutedCommandExec.sideEffectResult$lzycompute(commands.scala:70)
   	at org.apache.spark.sql.execution.command.ExecutedCommandExec.sideEffectResult(commands.scala:68)
   	at org.apache.spark.sql.execution.command.ExecutedCommandExec.doExecute(commands.scala:86)
   	at org.apache.spark.sql.execution.SparkPlan.$anonfun$execute$1(SparkPlan.scala:131)
   	at org.apache.spark.sql.execution.SparkPlan.$anonfun$executeQuery$1(SparkPlan.scala:156)
   	at org.apache.spark.rdd.RDDOperationScope$.withScope(RDDOperationScope.scala:151)
   	at org.apache.spark.sql.execution.SparkPlan.executeQuery(SparkPlan.scala:152)
   	at org.apache.spark.sql.execution.SparkPlan.execute(SparkPlan.scala:127)
   	at org.apache.spark.sql.execution.QueryExecution.toRdd$lzycompute(QueryExecution.scala:83)
   	at org.apache.spark.sql.execution.QueryExecution.toRdd(QueryExecution.scala:83)
   	at org.apache.spark.sql.DataFrameWriter.$anonfun$runCommand$1(DataFrameWriter.scala:676)
   	at org.apache.spark.sql.execution.SQLExecution$.$anonfun$withNewExecutionId$1(SQLExecution.scala:84)
   	at org.apache.spark.sql.execution.SQLExecution$.withSQLConfPropagated(SQLExecution.scala:165)
   	at org.apache.spark.sql.execution.SQLExecution$.withNewExecutionId(SQLExecution.scala:74)
   	at org.apache.spark.sql.DataFrameWriter.runCommand(DataFrameWriter.scala:676)
   	at org.apache.spark.sql.DataFrameWriter.saveToV1Source(DataFrameWriter.scala:290)
   	at org.apache.spark.sql.DataFrameWriter.save(DataFrameWriter.scala:271)
   	at org.apache.spark.sql.DataFrameWriter.save(DataFrameWriter.scala:229)
   	at jp.ne.paypay.daas.dataloader.writer.HudiDataWriter.write(HudiDataWriter.scala:272)
   	at jp.ne.paypay.daas.dataloader.writer.HudiDataWriter.insertOverrideTable(HudiDataWriter.scala:161)
   	at jp.ne.paypay.daas.dataloader.FileSystemJob$.mainProcedure(FileSystemJob.scala:107)
   	at jp.ne.paypay.daas.dataloader.FileSystemJob$.main(FileSystemJob.scala:38)
   	at jp.ne.paypay.daas.dataloader.FileSystemJob.main(FileSystemJob.scala)
   	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
   	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
   	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
   	at java.lang.reflect.Method.invoke(Method.java:498)
   	at org.apache.spark.deploy.yarn.ApplicationMaster$$anon$2.run(ApplicationMaster.scala:684)
   Caused by: java.lang.IllegalArgumentException: Positive number of partitions required
   	at org.apache.spark.rdd.ParallelCollectionRDD$.slice(ParallelCollectionRDD.scala:119)
   	at org.apache.spark.rdd.ParallelCollectionRDD.getPartitions(ParallelCollectionRDD.scala:97)
   	at org.apache.spark.rdd.RDD.$anonfun$partitions$2(RDD.scala:253)
   	at scala.Option.getOrElse(Option.scala:189)
   	at org.apache.spark.rdd.RDD.partitions(RDD.scala:251)
   	at org.apache.spark.rdd.MapPartitionsRDD.getPartitions(MapPartitionsRDD.scala:49)
   	at org.apache.spark.rdd.RDD.$anonfun$partitions$2(RDD.scala:253)
   	at scala.Option.getOrElse(Option.scala:189)
   	at org.apache.spark.rdd.RDD.partitions(RDD.scala:251)
   	at org.apache.spark.SparkContext.runJob(SparkContext.scala:2126)
   	at org.apache.spark.rdd.RDD.$anonfun$collect$1(RDD.scala:945)
   	at org.apache.spark.rdd.RDDOperationScope$.withScope(RDDOperationScope.scala:151)
   	at org.apache.spark.rdd.RDDOperationScope$.withScope(RDDOperationScope.scala:112)
   	at org.apache.spark.rdd.RDD.withScope(RDD.scala:363)
   	at org.apache.spark.rdd.RDD.collect(RDD.scala:944)
   	at org.apache.spark.api.java.JavaRDDLike.collect(JavaRDDLike.scala:361)
   	at org.apache.spark.api.java.JavaRDDLike.collect$(JavaRDDLike.scala:360)
   	at org.apache.spark.api.java.AbstractJavaRDDLike.collect(JavaRDDLike.scala:45)
   	at org.apache.hudi.client.common.HoodieSparkEngineContext.map(HoodieSparkEngineContext.java:73)
   	at org.apache.hudi.client.ReplaceArchivalHelper.deleteReplacedFileGroups(ReplaceArchivalHelper.java:72)
   	at org.apache.hudi.table.HoodieTimelineArchiveLog.deleteReplacedFileGroups(HoodieTimelineArchiveLog.java:341)
   	at org.apache.hudi.table.HoodieTimelineArchiveLog.archive(HoodieTimelineArchiveLog.java:303)
   	... 36 more
   ```
   
   
   What we found:
   Seems first commit's don't have any partitionToReplaceFileIds, and it was required when archiving files
   
   ```
   client.getCommitTimeline.getInstants.forEach(instant => {
         val metadata = HoodieReplaceCommitMetadata.fromBytes(client.getActiveTimeline.getInstantDetails(instant).get, classOf[HoodieReplaceCommitMetadata])
         val a = metadata.getPartitionToReplaceFileIds()
         println(s"${instant.toString}: size : ${a.size}")
       })
   
   // Exiting paste mode, now interpreting.
   
   [20210323080718__replacecommit__COMPLETED]: size : 0
   [20210323081449__replacecommit__COMPLETED]: size : 1
   [20210323082046__replacecommit__COMPLETED]: size : 1
   [20210323082758__replacecommit__COMPLETED]: size : 1
   [20210323084004__replacecommit__COMPLETED]: size : 1
   [20210323085044__replacecommit__COMPLETED]: size : 1
   [20210323085823__replacecommit__COMPLETED]: size : 1
   [20210323090550__replacecommit__COMPLETED]: size : 1
   [20210323091700__replacecommit__COMPLETED]: size : 1
   ```
   
   A clear and concise description of the problem.
   
   **To Reproduce**
   
   Steps to reproduce the behavior:
   
   1. set the config as we set
   2. write 5 times
   
   
   **Expected behavior**
   
   A clear and concise description of what you expected to happen.
   
   **Environment Description**
   
   * Hudi version :
   
   * Spark version :
   
   * Hive version :
   
   * Hadoop version :
   
   * Storage (HDFS/S3/GCS..) :
   
   * Running on Docker? (yes/no) :
   
   
   **Additional context**
   
   Add any other context about the problem here.
   
   **Stacktrace**
   
   ```Add the stacktrace of the error.```
   
   


-- 
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.

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



[GitHub] [hudi] ssdong commented on issue #2707: [SUPPORT] insert_ovewrite_table failed on archiving

Posted by GitBox <gi...@apache.org>.
ssdong commented on issue #2707:
URL: https://github.com/apache/hudi/issues/2707#issuecomment-813353690


   @jsbali Thanks!
   Can someone grant me permission to self-assign tickets in JIRA? 
   I've emailed to `dev@hudi.apache.org` but haven't been approved yet. 😅 It requires actions from a PMC member... 


-- 
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.

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



[GitHub] [hudi] zherenyu831 edited a comment on issue #2707: [SUPPORT] insert_ovewrite_table failed on archiving

Posted by GitBox <gi...@apache.org>.
zherenyu831 edited a comment on issue #2707:
URL: https://github.com/apache/hudi/issues/2707#issuecomment-814157136


   @satishkotha cc @bvaradar @vinothchandar 
   I found the problem why cleaner only keep one file version 
   https://github.com/apache/hudi/blob/master/hudi-client/hudi-client-common/src/main/java/org/apache/hudi/table/action/clean/CleanPlanner.java#L216-L217
   
   I think it breaks the isolation, do you have any plan?
    
   


-- 
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.

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



[GitHub] [hudi] ssdong commented on issue #2707: [SUPPORT] insert_ovewrite_table failed on archiving

Posted by GitBox <gi...@apache.org>.
ssdong commented on issue #2707:
URL: https://github.com/apache/hudi/issues/2707#issuecomment-811619487


   @jsbali To give out extra insights and details, as @zherenyu831 has posted in the beginning:
   ```
   [20210323080718__replacecommit__COMPLETED]: size : 0
   [20210323081449__replacecommit__COMPLETED]: size : 1
   [20210323082046__replacecommit__COMPLETED]: size : 1
   [20210323082758__replacecommit__COMPLETED]: size : 1
   [20210323084004__replacecommit__COMPLETED]: size : 1
   [20210323085044__replacecommit__COMPLETED]: size : 1
   [20210323085823__replacecommit__COMPLETED]: size : 1
   [20210323090550__replacecommit__COMPLETED]: size : 1
   [20210323091700__replacecommit__COMPLETED]: size : 1
   ```
   If we keep everything the same and let archive logic handling everything, it would fail at 0 `partitionToReplaceFileIds` against `20210323080718__replacecommit__COMPLETED`(the second item in the list above), and this is a known issue. 
   
   To make the archive work, we tried to _manually_ delete the first _empty_ commit file, which is `20210323080718__replacecommit__COMPLETED`(the first item in the list above). This has succeeded the archive, but instead, it has failed upon `User class threw exception: org.apache.hudi.exception.HoodieIOException: Could not read commit details from s3://xxx/data/.hoodie/20210323081449.replacecommit`(the second item in the list above)
   
   Now to reason through the underlying mechanism of this error, given the archive was successful, that means a few commit files have been placed within the `.archive` folder, let's say 
   ```
   [20210323081449__replacecommit__COMPLETED]: size : 1
   [20210323082046__replacecommit__COMPLETED]: size : 1
   [20210323082758__replacecommit__COMPLETED]: size : 1
   [20210323084004__replacecommit__COMPLETED]: size : 1
   [20210323085044__replacecommit__COMPLETED]: size : 1
   ```
   have been successfully moved and placed in `.archive`. At this moment, the timeline has been updated and there are 3 remaining commit files which are:
   ```
   [20210323085823__replacecommit__COMPLETED]: size : 1
   [20210323090550__replacecommit__COMPLETED]: size : 1
   [20210323091700__replacecommit__COMPLETED]: size : 1
   ```
   
   Now, if you pay attention to the stack trace which caused `User class threw exception: org.apache.hudi.exception.HoodieIOException: Could not read commit details from s3://xxx/data/.hoodie/20210323081449.replacecommit`, and I am just pasting them again:
   ```
   User class threw exception: org.apache.hudi.exception.HoodieIOException: Could not read commit details from s3://xxx/data/.hoodie/20210323081449.replacecommit
   at org.apache.hudi.common.table.timeline.HoodieActiveTimeline.readDataFromPath(HoodieActiveTimeline.java:530)
   at org.apache.hudi.common.table.timeline.HoodieActiveTimeline.getInstantDetails(HoodieActiveTimeline.java:194)
   at org.apache.hudi.common.table.view.AbstractTableFileSystemView.lambda$resetFileGroupsReplaced$8(AbstractTableFileSystemView.java:217)
   at java.util.stream.ReferencePipeline$7$1.accept(ReferencePipeline.java:269)
   at java.util.ArrayList$ArrayListSpliterator.forEachRemaining(ArrayList.java:1382)
   at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:482)
   at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:472)
   at java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:708)
   at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
   at java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:566)
   at org.apache.hudi.common.table.view.AbstractTableFileSystemView.resetFileGroupsReplaced(AbstractTableFileSystemView.java:228)
   at org.apache.hudi.common.table.view.AbstractTableFileSystemView.init(AbstractTableFileSystemView.java:106)
   at org.apache.hudi.common.table.view.HoodieTableFileSystemView.init(HoodieTableFileSystemView.java:106)
   at org.apache.hudi.common.table.view.AbstractTableFileSystemView.reset(AbstractTableFileSystemView.java:248)
   at org.apache.hudi.common.table.view.HoodieTableFileSystemView.close(HoodieTableFileSystemView.java:353)
   at java.util.concurrent.ConcurrentHashMap$ValuesView.forEach(ConcurrentHashMap.java:4707)
   at org.apache.hudi.common.table.view.FileSystemViewManager.close(FileSystemViewManager.java:118)
   at org.apache.hudi.timeline.service.TimelineService.close(TimelineService.java:179)
   at org.apache.hudi.client.embedded.EmbeddedTimelineService.stop(EmbeddedTimelineService.java:112)
   ```
   
   After a `close` action being triggered on `TimelineService`, which is understandable, it propagates to `HoodieTableFileSystemView.close` and there is:
   ```
   at org.apache.hudi.common.table.view.AbstractTableFileSystemView.init(AbstractTableFileSystemView.java:106)
   at org.apache.hudi.common.table.view.HoodieTableFileSystemView.init(HoodieTableFileSystemView.java:106)
   at org.apache.hudi.common.table.view.AbstractTableFileSystemView.reset(AbstractTableFileSystemView.java:248)
   ```
   happening right after it. Now I am not exactly sure why we need an `init` after `close` being called upon the `HoodieTableFileSystemView`.(Probably someone with deep knowledge could answer it). If you look at the source code, the `reset` and `init` are _initializing with new Hoodie timeline_.  (
   ```
   @Override
     public final void reset() {
       try {
         writeLock.lock();
   
         addedPartitions.clear();
         resetViewState();
   
         bootstrapIndex = null;
   
         // Initialize with new Hoodie timeline.
         init(metaClient, getTimeline());
       } finally {
         writeLock.unlock();
       }
     }
   ```
   This above `getTimeline()` _didn't_ really fetch a _new_ timeline since TimelineService has been closed, and obviously `public void sync()` isn't being triggered, which resets the old timeline with the new ones. The Hudi table view's in-memory timeline remains the very _old_ timeline, i.e. the one _before_ doing the archive. If it tries to read those commits from in-memory and performance corresponding actions, it will certainly fail without a doubt since we have archived the commit files, and now they exist in the `.archive` folder.
   
   It does sound like a paradox here, given that it throws exceptions _after_ we manually delete the commit file to try to save the archive logic. Shouldn't it already exists from the beginning that even if we have a successful archiving action, the in-memory timeline remains old based on the mechanisms we do closing and initializing against a Hudi table view?
   
   Thoughts? 😅 


-- 
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.

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



[GitHub] [hudi] zherenyu831 edited a comment on issue #2707: [SUPPORT] insert_ovewrite_table failed on archiving

Posted by GitBox <gi...@apache.org>.
zherenyu831 edited a comment on issue #2707:
URL: https://github.com/apache/hudi/issues/2707#issuecomment-805372384






-- 
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.

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



[GitHub] [hudi] ssdong commented on issue #2707: [SUPPORT] insert_ovewrite_table failed on archiving

Posted by GitBox <gi...@apache.org>.
ssdong commented on issue #2707:
URL: https://github.com/apache/hudi/issues/2707#issuecomment-813959142


   The original issue being brought up by @zherenyu831 has a bigger impact than we had imagined. The simple fix to omit the empty `partitionToReplaceFileIds` would work on release `0.7.0` but it won't work anymore for the latest master, i.e. `0.9.0-SNAPSHOT`. Ticket [HUDI-1740](https://issues.apache.org/jira/browse/HUDI-1740) has been updated to reflect the newest issues and we believe it has something to with the new clustering feature. 


-- 
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.

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



[GitHub] [hudi] ssdong edited a comment on issue #2707: [SUPPORT] insert_ovewrite_table failed on archiving

Posted by GitBox <gi...@apache.org>.
ssdong edited a comment on issue #2707:
URL: https://github.com/apache/hudi/issues/2707#issuecomment-812856042


   @satishkotha Thanks for the tips! In fact, I was also able to reproduce this issue locally on my machine regarding the `insert_overwrite_table` issue that @jsbali has raised tickets https://issues.apache.org/jira/browse/HUDI-1739 and https://issues.apache.org/jira/browse/HUDI-1740 against with.
   
   For tracking and maybe helping you guys test the fix(in the future), I am pasting the script I used for reproducing the issue here. 😅 
   ```
   import org.apache.hudi.QuickstartUtils._
   import scala.collection.JavaConversions._
   import org.apache.spark.sql.SaveMode._
   import org.apache.hudi.DataSourceReadOptions._
   import org.apache.hudi.DataSourceWriteOptions._
   import org.apache.hudi.config.HoodieWriteConfig._
   import java.util.UUID
   import java.sql.Timestamp
   
   val tableName = "hudi_date_mor"
   val basePath = "<absolute_path_to_your_hudi_folder>" <---- fill out this value to point to your local folder(in absolute path)
   val writeConfigs = Map(
        "hoodie.cleaner.incremental.mode" -> "true",
        "hoodie.insert.shuffle.parallelism" -> "20",
        "hoodie.upsert.shuffle.parallelism" -> "2",
        "hoodie.clean.automatic" -> "false",
        "hoodie.datasource.write.operation" -> "insert_overwrite_table",
        "hoodie.table.name" -> tableName,
        "hoodie.datasource.write.table.type" -> "MERGE_ON_READ",
        "hoodie.cleaner.policy" -> "KEEP_LATEST_FILE_VERSIONS",
        "hoodie.keep.max.commits" -> "3",
        "hoodie.cleaner.commits.retained" -> "1",
        "hoodie.keep.min.commits" -> "2",
        "hoodie.compact.inline.max.delta.commits" -> "1"
        )
   
   val dateSMap: Map[Int, String] = Map(
       0-> "2020-07-01",
       1-> "2020-08-01",
       2-> "2020-09-01",
   )
   val dateMap: Map[Int, Timestamp] = Map(
       0-> Timestamp.valueOf("2010-07-01 11:00:15"),
       1-> Timestamp.valueOf("2010-08-01 11:00:15"),
       2-> Timestamp.valueOf("2010-09-01 11:00:15"),
   )
   var seq = Seq(
       (0, "value", dateMap(0), dateSMap(0), UUID.randomUUID.toString)
   )
   for(i <- 501 to 1000) {
       seq :+= (i, "value", dateMap(i % 3), dateSMap(i % 3), UUID.randomUUID.toString)
   }
   val df = seq.toDF("id", "string_column", "timestamp_column", "date_string", "uuid")
   ```
   
   Run the spark shell(the one taken from hudi quick start page and I am using spark version `spark-3.0.1-bin-hadoop2.7`):
   ```
   ./spark-shell --packages org.apache.hudi:hudi-spark-bundle_2.12:0.7.0,org.apache.spark:spark-avro_2.12:3.0.1 --conf 'spark.serializer=org.apache.spark.serializer.KryoSerializer'
   ```
   Copy the above script in there and hit `df.write.format("hudi").options(writeConfigs).mode(Overwrite).save(basePath)` 4 times and on the fifth time, it throws the anticipated `Caused by: java.lang.IllegalArgumentException: Positive number of partitions required` issue.
   
   Now, the thing is, we _still_ have to _manually_ delete the first commit file, which contains the empty `partitionToReplaceFileIds`; otherwise, it would still keep throwing the `Positive number of partitions required issue. error.`
   The `"hoodie.embed.timeline.server" -> "false"` _does_ help as it forces the write to refresh its timeline so we wouldn't see the second error again, which is 
   ```
   java.io.FileNotFoundException: <path_to_hoodie_folder>/.hoodie/20210403201659.replacecommit does not exist
   ```
   However, it appears `"hoodie.embed.timeline.server" -> "false"` to be not _quite_ necessary since the _6th_ time we write, the writer is automatically being refreshed with the _newest_ timeline and it will put all `*replacecommit` files back to a status of integrity again. 
   
   If we fix the empty `partitionToReplaceFileIds` issue, we might not need to dig into the `replacecommit does not exist` issue anymore since it is caused by the workaround of _manually_ deleting the empty commit file. It would fix everything from the start. However, I would still be curious to learn about _why_ we would need a `reset` of the timeline server within the `close` action upon the `HoodieTableFileSystemView`. It appears unnecessary to me and could be removed if there is no strong reason behind it. 
   
   The `reset` within `close` was originally introduced in #600 after a bit of digging in that code. I hope that helps you narrow down the scope a little bit. Maybe @bvaradar could explain it if the memory is still fresh to you since that PR is about 2 years ago from now. 😅 Thanks.
   
   
   


-- 
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.

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



[GitHub] [hudi] zherenyu831 commented on issue #2707: [SUPPORT] insert_ovewrite_table failed on archiving

Posted by GitBox <gi...@apache.org>.
zherenyu831 commented on issue #2707:
URL: https://github.com/apache/hudi/issues/2707#issuecomment-805372384


   @satishkotha 
   Sorry I parste wrong log, I updated the log, please check again.
   
   When archiving finished, seems metaclient didn't reload, so it's trying to read the archived commit, then we got the error 


-- 
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.

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



[GitHub] [hudi] zherenyu831 commented on issue #2707: [SUPPORT] insert_ovewrite_table failed on archiving

Posted by GitBox <gi...@apache.org>.
zherenyu831 commented on issue #2707:
URL: https://github.com/apache/hudi/issues/2707#issuecomment-814157136


   @satishkotha cc @bvaradar 
   I found the problem why cleaner only keep one file version 
   https://github.com/apache/hudi/blob/master/hudi-client/hudi-client-common/src/main/java/org/apache/hudi/table/action/clean/CleanPlanner.java#L216-L217
   
   I think it breaks the isolation, do you have any plan?
    
   


-- 
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.

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



[GitHub] [hudi] zherenyu831 commented on issue #2707: [SUPPORT] insert_ovewrite_table failed on archiving

Posted by GitBox <gi...@apache.org>.
zherenyu831 commented on issue #2707:
URL: https://github.com/apache/hudi/issues/2707#issuecomment-814540364


   @satishkotha 
   Thank you for the explaining.
   Totally understood. 
   Since insert_overwrite_table every time creating version of files, in this case,
   instead of using KEEP_LATEST_VERSIONS, KEEP_LATEST_COMMITS make more sense.
   
   


-- 
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.

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



[GitHub] [hudi] zherenyu831 edited a comment on issue #2707: [SUPPORT] insert_ovewrite_table failed on archiving

Posted by GitBox <gi...@apache.org>.
zherenyu831 edited a comment on issue #2707:
URL: https://github.com/apache/hudi/issues/2707#issuecomment-804831651


   But got new error
   
   ```
   User class threw exception: org.apache.hudi.exception.HoodieIOException: Could not read commit details from s3://xxx/data/.hoodie/20210323081449.replacecommit
   at org.apache.hudi.common.table.timeline.HoodieActiveTimeline.readDataFromPath(HoodieActiveTimeline.java:530)
   at org.apache.hudi.common.table.timeline.HoodieActiveTimeline.getInstantDetails(HoodieActiveTimeline.java:194)
   at org.apache.hudi.common.table.view.AbstractTableFileSystemView.lambda$resetFileGroupsReplaced$8(AbstractTableFileSystemView.java:217)
   at java.util.stream.ReferencePipeline$7$1.accept(ReferencePipeline.java:269)
   at java.util.ArrayList$ArrayListSpliterator.forEachRemaining(ArrayList.java:1382)
   at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:482)
   at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:472)
   at java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:708)
   at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
   at java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:566)
   at org.apache.hudi.common.table.view.AbstractTableFileSystemView.resetFileGroupsReplaced(AbstractTableFileSystemView.java:228)
   at org.apache.hudi.common.table.view.AbstractTableFileSystemView.init(AbstractTableFileSystemView.java:106)
   at org.apache.hudi.common.table.view.HoodieTableFileSystemView.init(HoodieTableFileSystemView.java:106)
   at org.apache.hudi.common.table.view.AbstractTableFileSystemView.reset(AbstractTableFileSystemView.java:248)
   at org.apache.hudi.common.table.view.HoodieTableFileSystemView.close(HoodieTableFileSystemView.java:353)
   at java.util.concurrent.ConcurrentHashMap$ValuesView.forEach(ConcurrentHashMap.java:4707)
   at org.apache.hudi.common.table.view.FileSystemViewManager.close(FileSystemViewManager.java:118)
   at org.apache.hudi.timeline.service.TimelineService.close(TimelineService.java:179)
   at org.apache.hudi.client.embedded.EmbeddedTimelineService.stop(EmbeddedTimelineService.java:112)
   at org.apache.hudi.client.AbstractHoodieClient.stopEmbeddedServerView(AbstractHoodieClient.java:90)
   at org.apache.hudi.client.AbstractHoodieClient.close(AbstractHoodieClient.java:82)
   at org.apache.hudi.client.AbstractHoodieWriteClient.close(AbstractHoodieWriteClient.java:912)
   at org.apache.hudi.HoodieSparkSqlWriter$.commitAndPerformPostOperations(HoodieSparkSqlWriter.scala:464)
   at org.apache.hudi.HoodieSparkSqlWriter$.write(HoodieSparkSqlWriter.scala:218)
   at org.apache.hudi.DefaultSource.createRelation(DefaultSource.scala:134)
   at org.apache.spark.sql.execution.datasources.SaveIntoDataSourceCommand.run(SaveIntoDataSourceCommand.scala:46)
   at org.apache.spark.sql.execution.command.ExecutedCommandExec.sideEffectResult$lzycompute(commands.scala:70)
   at org.apache.spark.sql.execution.command.ExecutedCommandExec.sideEffectResult(commands.scala:68)
   at org.apache.spark.sql.execution.command.ExecutedCommandExec.doExecute(commands.scala:86)
   at org.apache.spark.sql.execution.SparkPlan.$anonfun$execute$1(SparkPlan.scala:131)
   at org.apache.spark.sql.execution.SparkPlan.$anonfun$executeQuery$1(SparkPlan.scala:156)
   at org.apache.spark.rdd.RDDOperationScope$.withScope(RDDOperationScope.scala:151)
   at org.apache.spark.sql.execution.SparkPlan.executeQuery(SparkPlan.scala:152)
   at org.apache.spark.sql.execution.SparkPlan.execute(SparkPlan.scala:127)
   at org.apache.spark.sql.execution.QueryExecution.toRdd$lzycompute(QueryExecution.scala:83)
   at org.apache.spark.sql.execution.QueryExecution.toRdd(QueryExecution.scala:83)
   at org.apache.spark.sql.DataFrameWriter.$anonfun$runCommand$1(DataFrameWriter.scala:676)
   at org.apache.spark.sql.execution.SQLExecution$.$anonfun$withNewExecutionId$1(SQLExecution.scala:84)
   at org.apache.spark.sql.execution.SQLExecution$.withSQLConfPropagated(SQLExecution.scala:165)
   at org.apache.spark.sql.execution.SQLExecution$.withNewExecutionId(SQLExecution.scala:74)
   at org.apache.spark.sql.DataFrameWriter.runCommand(DataFrameWriter.scala:676)
   at org.apache.spark.sql.DataFrameWriter.saveToV1Source(DataFrameWriter.scala:290)
   at org.apache.spark.sql.DataFrameWriter.save(DataFrameWriter.scala:271)
   at org.apache.spark.sql.DataFrameWriter.save(DataFrameWriter.scala:229)
   at jp.ne.paypay.daas.dataloader.writer.HudiDataWriter.write(HudiDataWriter.scala:272)
   at jp.ne.paypay.daas.dataloader.writer.HudiDataWriter.insertOverrideTable(HudiDataWriter.scala:161)
   at jp.ne.paypay.daas.dataloader.FileSystemJob$.mainProcedure(FileSystemJob.scala:107)
   at jp.ne.paypay.daas.dataloader.FileSystemJob$.main(FileSystemJob.scala:38)
   at jp.ne.paypay.daas.dataloader.FileSystemJob.main(FileSystemJob.scala)
   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
   at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
   at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
   at java.lang.reflect.Method.invoke(Method.java:498)
   at org.apache.spark.deploy.yarn.ApplicationMaster$$anon$2.run(ApplicationMaster.scala:684)
   Caused by: java.io.FileNotFoundException: No such file or directory 's3://xxx/data/.hoodie/20210323081449.replacecommit'
   at com.amazon.ws.emr.hadoop.fs.s3n.S3NativeFileSystem.getFileStatus(S3NativeFileSystem.java:617)
   at com.amazon.ws.emr.hadoop.fs.s3n.S3NativeFileSystem.open(S3NativeFileSystem.java:1026)
   at org.apache.hadoop.fs.FileSystem.open(FileSystem.java:902)
   at com.amazon.ws.emr.hadoop.fs.EmrFileSystem.open(EmrFileSystem.java:207)
   at org.apache.hudi.common.fs.HoodieWrapperFileSystem.open(HoodieWrapperFileSystem.java:459)
   at org.apache.hudi.common.table.timeline.HoodieActiveTimeline.readDataFromPath(HoodieActiveTimeline.java:527)
   ```


-- 
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.

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



[GitHub] [hudi] ssdong commented on issue #2707: [SUPPORT] insert_ovewrite_table failed on archiving

Posted by GitBox <gi...@apache.org>.
ssdong commented on issue #2707:
URL: https://github.com/apache/hudi/issues/2707#issuecomment-813825461


   @nsivabalan @bvaradar Sorry for the bother. Could you kindly add me as a contributor so I could self-assign issues? I've set up my local dev env successfully and would like to move on from there. 😄  Sent an email to the dev mailing list but haven't gotten replies yet. Thanks! 


-- 
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.

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



[GitHub] [hudi] ssdong edited a comment on issue #2707: [SUPPORT] insert_ovewrite_table failed on archiving

Posted by GitBox <gi...@apache.org>.
ssdong edited a comment on issue #2707:
URL: https://github.com/apache/hudi/issues/2707#issuecomment-813825461


   @nsivabalan @bvaradar Sorry for the bother. Could you kindly add me as a contributor so I could self-assign issues? I've set up my local dev env successfully and would like to move on from there. 😄  Sent an email to the dev mailing list but haven't gotten replies yet. Thanks! 
   
   Updates: I've been granted contributor permissions. Thanks! 😸 


-- 
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.

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



[GitHub] [hudi] zherenyu831 commented on issue #2707: [SUPPORT] insert_ovewrite_table failed on archiving

Posted by GitBox <gi...@apache.org>.
zherenyu831 commented on issue #2707:
URL: https://github.com/apache/hudi/issues/2707#issuecomment-804849028


   Also saw some comment and find below link
   https://issues.apache.org/jira/browse/HUDI-1518
   Seems you are going to use cleaner to delete the file group,
   but currently, if I use cleaner, there is only one file group will be kept


-- 
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.

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



[GitHub] [hudi] zherenyu831 commented on issue #2707: [SUPPORT] insert_ovewrite_table failed on archiving

Posted by GitBox <gi...@apache.org>.
zherenyu831 commented on issue #2707:
URL: https://github.com/apache/hudi/issues/2707#issuecomment-804762627


   simple workaround is delete first commit file 


-- 
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.

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



[GitHub] [hudi] jsbali commented on issue #2707: [SUPPORT] insert_ovewrite_table failed on archiving

Posted by GitBox <gi...@apache.org>.
jsbali commented on issue #2707:
URL: https://github.com/apache/hudi/issues/2707#issuecomment-812980356


   Sure @ssdong. You can pick either of the qbove


-- 
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.

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



[GitHub] [hudi] n3nash commented on issue #2707: [SUPPORT] insert_ovewrite_table failed on archiving

Posted by GitBox <gi...@apache.org>.
n3nash commented on issue #2707:
URL: https://github.com/apache/hudi/issues/2707#issuecomment-815460958


   @ssdong Thanks for opening the PR! Closing this issue now


-- 
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.

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



[GitHub] [hudi] ssdong edited a comment on issue #2707: [SUPPORT] insert_ovewrite_table failed on archiving

Posted by GitBox <gi...@apache.org>.
ssdong edited a comment on issue #2707:
URL: https://github.com/apache/hudi/issues/2707#issuecomment-811619487


   @jsbali To give out extra insights and details, as @zherenyu831 has posted in the beginning:
   ```
   [20210323080718__replacecommit__COMPLETED]: size : 0
   [20210323081449__replacecommit__COMPLETED]: size : 1
   [20210323082046__replacecommit__COMPLETED]: size : 1
   [20210323082758__replacecommit__COMPLETED]: size : 1
   [20210323084004__replacecommit__COMPLETED]: size : 1
   [20210323085044__replacecommit__COMPLETED]: size : 1
   [20210323085823__replacecommit__COMPLETED]: size : 1
   [20210323090550__replacecommit__COMPLETED]: size : 1
   [20210323091700__replacecommit__COMPLETED]: size : 1
   ```
   If we keep everything the same and let archive logic handling everything, it would fail at 0 `partitionToReplaceFileIds` against `20210323080718__replacecommit__COMPLETED`(the first item in the list above), and this is a known issue. 
   
   To make the archive work, we tried to _manually_ delete the first _empty_ commit file, which is `20210323080718__replacecommit__COMPLETED`(the first item in the list above). This has succeeded the archive, but instead, it has failed upon `User class threw exception: org.apache.hudi.exception.HoodieIOException: Could not read commit details from s3://xxx/data/.hoodie/20210323081449.replacecommit`(the second item in the list above)
   
   Now to reason through the underlying mechanism of this error, given the archive was successful, that means a few commit files have been placed within the `.archive` folder, let's say 
   ```
   [20210323081449__replacecommit__COMPLETED]: size : 1
   [20210323082046__replacecommit__COMPLETED]: size : 1
   [20210323082758__replacecommit__COMPLETED]: size : 1
   [20210323084004__replacecommit__COMPLETED]: size : 1
   [20210323085044__replacecommit__COMPLETED]: size : 1
   ```
   have been successfully moved and placed in `.archive`. At this moment, the timeline has been updated and there are 3 remaining commit files which are:
   ```
   [20210323085823__replacecommit__COMPLETED]: size : 1
   [20210323090550__replacecommit__COMPLETED]: size : 1
   [20210323091700__replacecommit__COMPLETED]: size : 1
   ```
   
   Now, if you pay attention to the stack trace which caused `User class threw exception: org.apache.hudi.exception.HoodieIOException: Could not read commit details from s3://xxx/data/.hoodie/20210323081449.replacecommit`, and I am just pasting them again:
   ```
   User class threw exception: org.apache.hudi.exception.HoodieIOException: Could not read commit details from s3://xxx/data/.hoodie/20210323081449.replacecommit
   at org.apache.hudi.common.table.timeline.HoodieActiveTimeline.readDataFromPath(HoodieActiveTimeline.java:530)
   at org.apache.hudi.common.table.timeline.HoodieActiveTimeline.getInstantDetails(HoodieActiveTimeline.java:194)
   at org.apache.hudi.common.table.view.AbstractTableFileSystemView.lambda$resetFileGroupsReplaced$8(AbstractTableFileSystemView.java:217)
   at java.util.stream.ReferencePipeline$7$1.accept(ReferencePipeline.java:269)
   at java.util.ArrayList$ArrayListSpliterator.forEachRemaining(ArrayList.java:1382)
   at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:482)
   at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:472)
   at java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:708)
   at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
   at java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:566)
   at org.apache.hudi.common.table.view.AbstractTableFileSystemView.resetFileGroupsReplaced(AbstractTableFileSystemView.java:228)
   at org.apache.hudi.common.table.view.AbstractTableFileSystemView.init(AbstractTableFileSystemView.java:106)
   at org.apache.hudi.common.table.view.HoodieTableFileSystemView.init(HoodieTableFileSystemView.java:106)
   at org.apache.hudi.common.table.view.AbstractTableFileSystemView.reset(AbstractTableFileSystemView.java:248)
   at org.apache.hudi.common.table.view.HoodieTableFileSystemView.close(HoodieTableFileSystemView.java:353)
   at java.util.concurrent.ConcurrentHashMap$ValuesView.forEach(ConcurrentHashMap.java:4707)
   at org.apache.hudi.common.table.view.FileSystemViewManager.close(FileSystemViewManager.java:118)
   at org.apache.hudi.timeline.service.TimelineService.close(TimelineService.java:179)
   at org.apache.hudi.client.embedded.EmbeddedTimelineService.stop(EmbeddedTimelineService.java:112)
   ```
   
   After a `close` action being triggered on `TimelineService`, which is understandable, it propagates to `HoodieTableFileSystemView.close` and there is:
   ```
   at org.apache.hudi.common.table.view.AbstractTableFileSystemView.init(AbstractTableFileSystemView.java:106)
   at org.apache.hudi.common.table.view.HoodieTableFileSystemView.init(HoodieTableFileSystemView.java:106)
   at org.apache.hudi.common.table.view.AbstractTableFileSystemView.reset(AbstractTableFileSystemView.java:248)
   ```
   happening right after it. Now I am not exactly sure why we need an `init` after `close` being called upon the `HoodieTableFileSystemView`.(Probably someone with deep knowledge could answer it). If you look at the source code, the `reset` and `init` are _initializing with new Hoodie timeline_.  (
   ```
   @Override
     public final void reset() {
       try {
         writeLock.lock();
   
         addedPartitions.clear();
         resetViewState();
   
         bootstrapIndex = null;
   
         // Initialize with new Hoodie timeline.
         init(metaClient, getTimeline());
       } finally {
         writeLock.unlock();
       }
     }
   ```
   This above `getTimeline()` _didn't_ really fetch a _new_ timeline since TimelineService has been closed, and obviously `public void sync()` isn't being triggered, which resets the old timeline with the new ones. The Hudi table view's in-memory timeline remains the very _old_ timeline, i.e. the one _before_ doing the archive. If it tries to read those commits from in-memory and performance corresponding actions, it will certainly fail without a doubt since we have archived the commit files, and now they exist in the `.archive` folder.
   
   It does sound like a paradox here, given that it throws exceptions _after_ we manually delete the commit file to try to save the archive logic. Shouldn't it already exists from the beginning that even if we have a successful archiving action, the in-memory timeline remains old based on the mechanisms we do closing and initializing against a Hudi table view?
   
   Thoughts? 😅 


-- 
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.

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



[GitHub] [hudi] zherenyu831 edited a comment on issue #2707: [SUPPORT] insert_ovewrite_table failed on archiving

Posted by GitBox <gi...@apache.org>.
zherenyu831 edited a comment on issue #2707:
URL: https://github.com/apache/hudi/issues/2707#issuecomment-811565897


   @jsbali 
   For make everything clear:
   On archiving:
   Since the first replacecommit have 0 partitionToReplaceFileIds, and it failed at
   https://github.com/apache/hudi/blob/master/hudi-client/hudi-client-common/src/main/java/org/apache/hudi/client/ReplaceArchivalHelper.java#L73
   
   with error `Positive number of partitions required`
   
   Solution is 
   Manually delete first replacecommit or  ignore deletion on  0 partitionToReplaceFileIds replacecommit  in the code as your mentioned on your ticket
   
   After I deleted the first replacecommit, the archiving finished successfully 
   But I got another issue, 
   https://github.com/apache/hudi/issues/2707#issuecomment-804831651
   
   This is not related to what I deleted, as you can see, instant time is different
   Once the commits has been deleted on archiving process, hudi tried to load timeline again without reload the commits.
   
   I didn't debug more, since I want to ask the developers about how they want to deal with replaceFile deletion.
   seems like someone want to use cleaner to handle it.
   https://github.com/apache/hudi/issues/2707#issuecomment-804849028
   
   Unfortunately, I also found cleaner is not working well with insert_overwrite_table, 
   it only keep one file group
   
   
   


-- 
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.

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



[GitHub] [hudi] ssdong edited a comment on issue #2707: [SUPPORT] insert_ovewrite_table failed on archiving

Posted by GitBox <gi...@apache.org>.
ssdong edited a comment on issue #2707:
URL: https://github.com/apache/hudi/issues/2707#issuecomment-811619487


   @jsbali To give out extra insights and details, as @zherenyu831 has posted in the beginning:
   ```
   [20210323080718__replacecommit__COMPLETED]: size : 0
   [20210323081449__replacecommit__COMPLETED]: size : 1
   [20210323082046__replacecommit__COMPLETED]: size : 1
   [20210323082758__replacecommit__COMPLETED]: size : 1
   [20210323084004__replacecommit__COMPLETED]: size : 1
   [20210323085044__replacecommit__COMPLETED]: size : 1
   [20210323085823__replacecommit__COMPLETED]: size : 1
   [20210323090550__replacecommit__COMPLETED]: size : 1
   [20210323091700__replacecommit__COMPLETED]: size : 1
   ```
   If we keep everything the same and let archive logic handling everything, it would fail at 0 `partitionToReplaceFileIds` against `20210323080718__replacecommit__COMPLETED`(the first item in the list above), and this is a known issue. 
   
   To make the archive work, we tried to _manually_ delete the first _empty_ commit file, which is `20210323080718__replacecommit__COMPLETED`(the first item in the list above). This has succeeded the archive, but instead, it has failed upon `User class threw exception: org.apache.hudi.exception.HoodieIOException: Could not read commit details from s3://xxx/data/.hoodie/20210323081449.replacecommit`(the second item in the list above)
   
   Now to reason through the underlying mechanism of this error, given the archive was successful, that means a few commit files have been placed within the `.archive` folder, let's say 
   ```
   [20210323081449__replacecommit__COMPLETED]: size : 1
   [20210323082046__replacecommit__COMPLETED]: size : 1
   [20210323082758__replacecommit__COMPLETED]: size : 1
   [20210323084004__replacecommit__COMPLETED]: size : 1
   [20210323085044__replacecommit__COMPLETED]: size : 1
   ```
   have been successfully moved and placed in `.archive`. At this moment, the timeline has been updated and there are 3 remaining commit files which are:
   ```
   [20210323085823__replacecommit__COMPLETED]: size : 1
   [20210323090550__replacecommit__COMPLETED]: size : 1
   [20210323091700__replacecommit__COMPLETED]: size : 1
   ```
   
   Now, if you pay attention to the stack trace which caused `User class threw exception: org.apache.hudi.exception.HoodieIOException: Could not read commit details from s3://xxx/data/.hoodie/20210323081449.replacecommit`, and I am just pasting them again:
   ```
   User class threw exception: org.apache.hudi.exception.HoodieIOException: Could not read commit details from s3://xxx/data/.hoodie/20210323081449.replacecommit
   at org.apache.hudi.common.table.timeline.HoodieActiveTimeline.readDataFromPath(HoodieActiveTimeline.java:530)
   at org.apache.hudi.common.table.timeline.HoodieActiveTimeline.getInstantDetails(HoodieActiveTimeline.java:194)
   at org.apache.hudi.common.table.view.AbstractTableFileSystemView.lambda$resetFileGroupsReplaced$8(AbstractTableFileSystemView.java:217)
   at java.util.stream.ReferencePipeline$7$1.accept(ReferencePipeline.java:269)
   at java.util.ArrayList$ArrayListSpliterator.forEachRemaining(ArrayList.java:1382)
   at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:482)
   at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:472)
   at java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:708)
   at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
   at java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:566)
   at org.apache.hudi.common.table.view.AbstractTableFileSystemView.resetFileGroupsReplaced(AbstractTableFileSystemView.java:228)
   at org.apache.hudi.common.table.view.AbstractTableFileSystemView.init(AbstractTableFileSystemView.java:106)
   at org.apache.hudi.common.table.view.HoodieTableFileSystemView.init(HoodieTableFileSystemView.java:106)
   at org.apache.hudi.common.table.view.AbstractTableFileSystemView.reset(AbstractTableFileSystemView.java:248)
   at org.apache.hudi.common.table.view.HoodieTableFileSystemView.close(HoodieTableFileSystemView.java:353)
   at java.util.concurrent.ConcurrentHashMap$ValuesView.forEach(ConcurrentHashMap.java:4707)
   at org.apache.hudi.common.table.view.FileSystemViewManager.close(FileSystemViewManager.java:118)
   at org.apache.hudi.timeline.service.TimelineService.close(TimelineService.java:179)
   at org.apache.hudi.client.embedded.EmbeddedTimelineService.stop(EmbeddedTimelineService.java:112)
   ```
   
   After a `close` action being triggered on `TimelineService`, which is understandable, it propagates to `HoodieTableFileSystemView.close` and there is:
   ```
   at org.apache.hudi.common.table.view.AbstractTableFileSystemView.init(AbstractTableFileSystemView.java:106)
   at org.apache.hudi.common.table.view.HoodieTableFileSystemView.init(HoodieTableFileSystemView.java:106)
   at org.apache.hudi.common.table.view.AbstractTableFileSystemView.reset(AbstractTableFileSystemView.java:248)
   ```
   happening right after it. Now I am not exactly sure why we need an `init` after `close` being called upon the `HoodieTableFileSystemView`.(Probably someone with deep knowledge could answer it). If you look at the source code, the `reset` and `init` are _initializing with new Hoodie timeline_.  (
   ```
   @Override
     public final void reset() {
       try {
         writeLock.lock();
   
         addedPartitions.clear();
         resetViewState();
   
         bootstrapIndex = null;
   
         // Initialize with new Hoodie timeline.
         init(metaClient, getTimeline());
       } finally {
         writeLock.unlock();
       }
     }
   ```
   This above `getTimeline()` _didn't_ really fetch a _new_ timeline since TimelineService has been closed, and obviously `public void sync()` isn't being triggered, which resets the old timeline with the new ones. The Hudi table view's in-memory timeline remains the very _old_ timeline, i.e. the one _before_ doing the archive. If it tries to read those commits from in-memory and perform corresponding actions, it will certainly fail without a doubt since we have archived the commit files, and now they exist in the `.archive` folder.
   
   It does sound like a paradox here, given that it throws exceptions _after_ we manually delete the commit file to try to save the archive logic. Shouldn't it already exists from the beginning that even if we have a successful archiving action, the in-memory timeline remains old based on the mechanisms we do closing and initializing against a Hudi table view?
   
   Thoughts? 😅 


-- 
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.

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



[GitHub] [hudi] jsbali commented on issue #2707: [SUPPORT] insert_ovewrite_table failed on archiving

Posted by GitBox <gi...@apache.org>.
jsbali commented on issue #2707:
URL: https://github.com/apache/hudi/issues/2707#issuecomment-810407038


   So I debugged the code and found two issues, have created JIRA for both. https://issues.apache.org/jira/browse/HUDI-1739 and https://issues.apache.org/jira/browse/HUDI-1740 
   
   Need to debug the other issue of re-reading the deleted commit file.
   
   @zherenyu831  What files did you delete exactly pertaining to the commit?
   Also after deletion what exactly did you try as in the steps you took.   


-- 
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.

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



[GitHub] [hudi] ssdong commented on issue #2707: [SUPPORT] insert_ovewrite_table failed on archiving

Posted by GitBox <gi...@apache.org>.
ssdong commented on issue #2707:
URL: https://github.com/apache/hudi/issues/2707#issuecomment-812856042


   @satishkotha Thanks for the tips! In fact, I was also able to reproduce this issue locally on my machine regarding the `insert_overwrite_table` issue that @jsbali has raised tickets https://issues.apache.org/jira/browse/HUDI-1739 and https://issues.apache.org/jira/browse/HUDI-1740 against with.
   
   For tracking and maybe helping you guys test the fix(in the future), I am pasting the script I used for reproducing the issue here. 😅 
   ```
   import org.apache.hudi.QuickstartUtils._
   import scala.collection.JavaConversions._
   import org.apache.spark.sql.SaveMode._
   import org.apache.hudi.DataSourceReadOptions._
   import org.apache.hudi.DataSourceWriteOptions._
   import org.apache.hudi.config.HoodieWriteConfig._
   import java.util.UUID
   import java.sql.Timestamp
   
   val tableName = "hudi_date_mor"
   val basePath = "<absolute_path_to_your_hudi_folder>" <---- fill out this value to point to your local folder(in absolute path)
   val writeConfigs = Map(
        "hoodie.cleaner.incremental.mode" -> "true",
        "hoodie.insert.shuffle.parallelism" -> "20",
        "hoodie.upsert.shuffle.parallelism" -> "2",
        "hoodie.clean.automatic" -> "false",
        "hoodie.datasource.write.operation" -> "insert_overwrite_table",
        "hoodie.table.name" -> tableName,
        "hoodie.datasource.write.table.type" -> "MERGE_ON_READ",
        "hoodie.cleaner.policy" -> "KEEP_LATEST_FILE_VERSIONS",
        "hoodie.keep.max.commits" -> "3",
        "hoodie.cleaner.commits.retained" -> "1",
        "hoodie.keep.min.commits" -> "2",
        "hoodie.compact.inline.max.delta.commits" -> "1"
        )
   
   val dateSMap: Map[Int, String] = Map(
       0-> "2020-07-01",
       1-> "2020-08-01",
       2-> "2020-09-01",
   )
   val dateMap: Map[Int, Timestamp] = Map(
       0-> Timestamp.valueOf("2010-07-01 11:00:15"),
       1-> Timestamp.valueOf("2010-08-01 11:00:15"),
       2-> Timestamp.valueOf("2010-09-01 11:00:15"),
   )
   var seq = Seq(
       (0, "value", dateMap(0), dateSMap(0), UUID.randomUUID.toString)
   )
   for(i <- 501 to 1000) {
       seq :+= (i, "value", dateMap(i % 3), dateSMap(i % 3), UUID.randomUUID.toString)
   }
   val df = seq.toDF("id", "string_column", "timestamp_column", "date_string", "uuid")
   ```
   
   Run the spark shell(the one taken from hudi quick start page and I am using spark version `spark-3.0.1-bin-hadoop2.7`):
   ```
   ./spark-shell --packages org.apache.hudi:hudi-spark-bundle_2.12:0.7.0,org.apache.spark:spark-avro_2.12:3.0.1 --conf 'spark.serializer=org.apache.spark.serializer.KryoSerializer'
   ```
   Copy the above script in there and hit `df.write.format("hudi").options(writeConfigs).mode(Overwrite).save(basePath)` 4 times and on the fifth time, it throws the anticipated `Caused by: java.lang.IllegalArgumentException: Positive number of partitions required` issue.
   
   Now, the thing is, we _still_ have to _manually_ delete the first commit file, which contains the empty `partitionToReplaceFileIds`; otherwise, it would still keep throwing the `Positive number of partitions required issue. error.`
   The `"hoodie.embed.timeline.server" -> "false"` _does_ help as it forces the write to refresh its timeline so we wouldn't see the second error again, which is `java.io.FileNotFoundException: <path_to_hoodie_folder>/.hoodie/20210403201659.replacecommit does not exist`
   However, it appears `"hoodie.embed.timeline.server" -> "false"` to be not _quite_ necessary since the _6th_ time we write, the writer is automatically being refreshed with the _newest_ timeline and it will put all `*replacecommit` files back to a status of integrity again. 
   
   If we fix the empty `partitionToReplaceFileIds` issue, we might not need to dig into the `replacecommit does not exist` issue anymore since it is caused by the workaround of _manually_ deleting the empty commit file. It would fix everything from the start. However, I would still be curious to learn about _why_ we would need a `reset` of the timeline server within the `close` action upon the `HoodieTableFileSystemView`. It appears unnecessary to me and could be removed if there is no strong reason behind it. 
   
   The `reset` within `close` was originally introduced in #600 after a bit of digging in that code. I hope that helps you narrow down the scope a little bit. Maybe @bvaradar could explain it if the memory is still fresh to you since that PR is about 2 years ago from now. 😅 Thanks.
   
   
   


-- 
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.

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



[GitHub] [hudi] satishkotha commented on issue #2707: [SUPPORT] insert_ovewrite_table failed on archiving

Posted by GitBox <gi...@apache.org>.
satishkotha commented on issue #2707:
URL: https://github.com/apache/hudi/issues/2707#issuecomment-812096323


   @ssdong thanks for detailed update. Yes, this one seems little tricky. We'll need some more time to investigate. In the meantime, as a workaround, i think you can disable embedded timeline server by setting option 'hoodie.embed.timeline.server'  to false.
   
    I can look into why reset needs to be called during close and if we can refresh meta client for getting timeline.


-- 
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.

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



[GitHub] [hudi] jsbali edited a comment on issue #2707: [SUPPORT] insert_ovewrite_table failed on archiving

Posted by GitBox <gi...@apache.org>.
jsbali edited a comment on issue #2707:
URL: https://github.com/apache/hudi/issues/2707#issuecomment-812980356


   Sure @ssdong. You can pick either of the above


-- 
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.

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



[GitHub] [hudi] ssdong edited a comment on issue #2707: [SUPPORT] insert_ovewrite_table failed on archiving

Posted by GitBox <gi...@apache.org>.
ssdong edited a comment on issue #2707:
URL: https://github.com/apache/hudi/issues/2707#issuecomment-812856042


   @satishkotha Thanks for the tips! In fact, I was also able to reproduce this issue locally on my machine regarding the `insert_overwrite_table` issue that @jsbali has raised tickets https://issues.apache.org/jira/browse/HUDI-1739 and https://issues.apache.org/jira/browse/HUDI-1740 against with.
   
   For tracking and maybe helping you guys test the fix(in the future), I am pasting the script I used for reproducing the issue here. 😅 
   ```
   import org.apache.hudi.QuickstartUtils._
   import scala.collection.JavaConversions._
   import org.apache.spark.sql.SaveMode._
   import org.apache.hudi.DataSourceReadOptions._
   import org.apache.hudi.DataSourceWriteOptions._
   import org.apache.hudi.config.HoodieWriteConfig._
   import java.util.UUID
   import java.sql.Timestamp
   
   val tableName = "hudi_date_mor"
   val basePath = "<absolute_path_to_your_hudi_folder>" <---- fill out this value to point to your local folder(in absolute path)
   val writeConfigs = Map(
        "hoodie.cleaner.incremental.mode" -> "true",
        "hoodie.insert.shuffle.parallelism" -> "20",
        "hoodie.upsert.shuffle.parallelism" -> "2",
        "hoodie.clean.automatic" -> "false",
        "hoodie.datasource.write.operation" -> "insert_overwrite_table",
        "hoodie.table.name" -> tableName,
        "hoodie.datasource.write.table.type" -> "MERGE_ON_READ",
        "hoodie.cleaner.policy" -> "KEEP_LATEST_FILE_VERSIONS",
        "hoodie.keep.max.commits" -> "3",
        "hoodie.cleaner.commits.retained" -> "1",
        "hoodie.keep.min.commits" -> "2",
        "hoodie.compact.inline.max.delta.commits" -> "1"
        )
   
   val dateSMap: Map[Int, String] = Map(
       0-> "2020-07-01",
       1-> "2020-08-01",
       2-> "2020-09-01",
   )
   val dateMap: Map[Int, Timestamp] = Map(
       0-> Timestamp.valueOf("2010-07-01 11:00:15"),
       1-> Timestamp.valueOf("2010-08-01 11:00:15"),
       2-> Timestamp.valueOf("2010-09-01 11:00:15"),
   )
   var seq = Seq(
       (0, "value", dateMap(0), dateSMap(0), UUID.randomUUID.toString)
   )
   for(i <- 501 to 1000) {
       seq :+= (i, "value", dateMap(i % 3), dateSMap(i % 3), UUID.randomUUID.toString)
   }
   val df = seq.toDF("id", "string_column", "timestamp_column", "date_string", "uuid")
   ```
   
   Run the spark shell(the one taken from hudi quick start page and I am using spark version `spark-3.0.1-bin-hadoop2.7`):
   ```
   ./spark-shell --packages org.apache.hudi:hudi-spark-bundle_2.12:0.7.0,org.apache.spark:spark-avro_2.12:3.0.1 --conf 'spark.serializer=org.apache.spark.serializer.KryoSerializer'
   ```
   Copy the above script in there and hit `df.write.format("hudi").options(writeConfigs).mode(Overwrite).save(basePath)` 4 times and on the fifth time, it throws the anticipated
   ```
   Caused by: java.lang.IllegalArgumentException: Positive number of partitions required` issue.
   ```
   
   Now, the thing is, we _still_ have to _manually_ delete the first commit file, which contains the empty `partitionToReplaceFileIds`; otherwise, it would still keep throwing the `Positive number of partitions required issue. error.`
   The `"hoodie.embed.timeline.server" -> "false"` _does_ help as it forces the write to refresh its timeline so we wouldn't see the second error again, which is 
   ```
   java.io.FileNotFoundException: <path_to_hoodie_folder>/.hoodie/20210403201659.replacecommit does not exist
   ```
   However, it appears `"hoodie.embed.timeline.server" -> "false"` to be not _quite_ necessary since the _6th_ time we write, the writer is automatically being refreshed with the _newest_ timeline and it will put all `*replacecommit` files back to a status of integrity again. 
   
   If we fix the empty `partitionToReplaceFileIds` issue, we might not need to dig into the `replacecommit does not exist` issue anymore since it is caused by the workaround of _manually_ deleting the empty commit file. It would fix everything from the start. However, I would still be curious to learn about _why_ we would need a `reset` of the timeline server within the `close` action upon the `HoodieTableFileSystemView`. It appears unnecessary to me and could be removed if there is no strong reason behind it. 
   
   The `reset` within `close` was originally introduced in #600 after a bit of digging in that code. I hope that helps you narrow down the scope a little bit. Maybe @bvaradar could explain it if the memory is still fresh to you since that PR is about 2 years ago from now. 😅 Thanks.
   
   
   


-- 
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.

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



[GitHub] [hudi] nsivabalan commented on issue #2707: [SUPPORT] insert_ovewrite_table failed on archiving

Posted by GitBox <gi...@apache.org>.
nsivabalan commented on issue #2707:
URL: https://github.com/apache/hudi/issues/2707#issuecomment-810356919


   @satishkotha : once you respond, can you please remove "awaiting-community-help" label for the issue and add "awaiting-user-response" label.


-- 
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.

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



[GitHub] [hudi] zherenyu831 commented on issue #2707: [SUPPORT] insert_ovewrite_table failed on archiving

Posted by GitBox <gi...@apache.org>.
zherenyu831 commented on issue #2707:
URL: https://github.com/apache/hudi/issues/2707#issuecomment-811565897


   @jsbali 
   For make everything clear:
   On archiving:
   Since the first replacecommit have 0 partitionToReplaceFileIds, and it failed at
   https://github.com/apache/hudi/blob/master/hudi-client/hudi-client-common/src/main/java/org/apache/hudi/client/ReplaceArchivalHelper.java#L73
   
   with error `Positive number of partitions required`
   
   Solution is 
   Manually delete first replacecommit or  ignore deletion on  0 partitionToReplaceFileIds replacecommit  in the code as your mentioned on your ticket
   
   After I deleted the first replacecommit, the archiving finished successfully 
   But I got another issue, 
   https://github.com/apache/hudi/issues/2707#issuecomment-804831651
   
   This is not related to what I deleted, commit time is different
   Once the commits has been deleted on archiving process, hudi tried to load timeline again without refresh it.
   
   I didn't debug more, since I want to ask the developers about how they want to deal with replaceFile deletion.
   seems like someone want to use cleaner to handle it.
   https://github.com/apache/hudi/issues/2707#issuecomment-804849028
   
   Unfortunately, I also found cleaner is not working well with insert_overwrite_table, 
   it only keep one file group
   
   
   


-- 
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.

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



[GitHub] [hudi] zherenyu831 edited a comment on issue #2707: [SUPPORT] insert_ovewrite_table failed on archiving

Posted by GitBox <gi...@apache.org>.
zherenyu831 edited a comment on issue #2707:
URL: https://github.com/apache/hudi/issues/2707#issuecomment-811565897


   @jsbali 
   For make everything clear:
   On archiving:
   Since the first replacecommit have 0 partitionToReplaceFileIds, and it failed at
   https://github.com/apache/hudi/blob/master/hudi-client/hudi-client-common/src/main/java/org/apache/hudi/client/ReplaceArchivalHelper.java#L73
   
   with error `Positive number of partitions required`
   
   Solution is 
   Manually delete first replacecommit or  ignore deletion on  0 partitionToReplaceFileIds replacecommit  in the code as your mentioned on your ticket
   
   After I deleted the first replacecommit, the archiving finished successfully 
   But I got another issue, 
   https://github.com/apache/hudi/issues/2707#issuecomment-804831651
   
   This is not related to what I deleted, as you can see, instant time is different
   Once the commits has been deleted on archiving process, hudi tried to load timeline again without refresh it.
   
   I didn't debug more, since I want to ask the developers about how they want to deal with replaceFile deletion.
   seems like someone want to use cleaner to handle it.
   https://github.com/apache/hudi/issues/2707#issuecomment-804849028
   
   Unfortunately, I also found cleaner is not working well with insert_overwrite_table, 
   it only keep one file group
   
   
   


-- 
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.

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



[GitHub] [hudi] ssdong commented on issue #2707: [SUPPORT] insert_ovewrite_table failed on archiving

Posted by GitBox <gi...@apache.org>.
ssdong commented on issue #2707:
URL: https://github.com/apache/hudi/issues/2707#issuecomment-815156685


   Hi @satishkotha @jsbali ! I've created the pull request for this issue. Had observed more when going down the road and I've tried my best to clarify them and hopefully had written a detailed enough description for the PR. Let me know. Thanks! 


-- 
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.

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



[GitHub] [hudi] n3nash closed issue #2707: [SUPPORT] insert_ovewrite_table failed on archiving

Posted by GitBox <gi...@apache.org>.
n3nash closed issue #2707:
URL: https://github.com/apache/hudi/issues/2707


   


-- 
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.

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



[GitHub] [hudi] ssdong commented on issue #2707: [SUPPORT] insert_ovewrite_table failed on archiving

Posted by GitBox <gi...@apache.org>.
ssdong commented on issue #2707:
URL: https://github.com/apache/hudi/issues/2707#issuecomment-812964282


   btw, @jsbali, are you working on both of these tickets? 
   https://issues.apache.org/jira/browse/HUDI-1739
   https://issues.apache.org/jira/browse/HUDI-1740
   Can I pick up one as I would be happy to contribute? 😄 


-- 
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.

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



[GitHub] [hudi] satishkotha commented on issue #2707: [SUPPORT] insert_ovewrite_table failed on archiving

Posted by GitBox <gi...@apache.org>.
satishkotha commented on issue #2707:
URL: https://github.com/apache/hudi/issues/2707#issuecomment-805110804


   @jsbali is working on a fix for first error.
   
   The second error mentions instant '20210317155538'. I dont see this in initial commit timeline you mentioned. Can you provide additional details on how you got this error? was the metadata file removed while write is in progress?


-- 
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.

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



[GitHub] [hudi] satishkotha commented on issue #2707: [SUPPORT] insert_ovewrite_table failed on archiving

Posted by GitBox <gi...@apache.org>.
satishkotha commented on issue #2707:
URL: https://github.com/apache/hudi/issues/2707#issuecomment-814291398


   Hi, Why do you think it breaks isolation? We create new version of data files with new fileIds and clean up old versions. 
   With KEEP_LATEST_VERSIONS cleaner policy, we retain specified number of versions for every fileId. Once a file is replaced, we consider it as invalid. So we delete the replaced files immediately.
   
   Please use KEEP_LATEST_COMMITS cleaner policy if you need more than one version retained.


-- 
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.

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



[GitHub] [hudi] bvaradar commented on issue #2707: [SUPPORT] insert_ovewrite_table failed on archiving

Posted by GitBox <gi...@apache.org>.
bvaradar commented on issue #2707:
URL: https://github.com/apache/hudi/issues/2707#issuecomment-804899992


   @satishkotha : Can you take a look at this ? (cc @n3nash )


-- 
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.

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



[GitHub] [hudi] nsivabalan commented on issue #2707: [SUPPORT] insert_ovewrite_table failed on archiving

Posted by GitBox <gi...@apache.org>.
nsivabalan commented on issue #2707:
URL: https://github.com/apache/hudi/issues/2707#issuecomment-814557848


   @satishkotha : I haven't gone through entire comment history. but we have introduced new labels to assist us in better help community. 
   We have these labels for issues. 
   awaiting-user-response: whenever you respond to an issue and waiting for author response. 
   awaiting-community-help: whenever author is waiting for some response/assistance from someone from the community
   triaged: if we were able to triage the bug or issue
   jira-filed: if we have filed a tracking jira. in most cases, once jira is filed, we can close out the issue. but in some cases, we might have some back and forth comms. and hence this label.
   feature-request: some issues are not issues as such, but a new feature request. 
   
   Can you please add appropriate labels to this issue. 


-- 
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.

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



[GitHub] [hudi] ssdong edited a comment on issue #2707: [SUPPORT] insert_ovewrite_table failed on archiving

Posted by GitBox <gi...@apache.org>.
ssdong edited a comment on issue #2707:
URL: https://github.com/apache/hudi/issues/2707#issuecomment-812856042


   @satishkotha Thanks for the tips! In fact, I was also able to reproduce this issue locally on my machine regarding the `insert_overwrite_table` issue that @jsbali has raised tickets https://issues.apache.org/jira/browse/HUDI-1739 and https://issues.apache.org/jira/browse/HUDI-1740 against with.
   
   For tracking and maybe helping you guys test the fix(in the future), I am pasting the script I used for reproducing the issue here. 😅 
   ```
   import org.apache.hudi.QuickstartUtils._
   import scala.collection.JavaConversions._
   import org.apache.spark.sql.SaveMode._
   import org.apache.hudi.DataSourceReadOptions._
   import org.apache.hudi.DataSourceWriteOptions._
   import org.apache.hudi.config.HoodieWriteConfig._
   import java.util.UUID
   import java.sql.Timestamp
   
   val tableName = "hudi_date_mor"
   val basePath = "<absolute_path_to_your_hudi_folder>" <---- fill out this value to point to your local folder(in absolute path)
   val writeConfigs = Map(
        "hoodie.cleaner.incremental.mode" -> "true",
        "hoodie.insert.shuffle.parallelism" -> "20",
        "hoodie.upsert.shuffle.parallelism" -> "2",
        "hoodie.clean.automatic" -> "false",
        "hoodie.datasource.write.operation" -> "insert_overwrite_table",
        "hoodie.table.name" -> tableName,
        "hoodie.datasource.write.table.type" -> "MERGE_ON_READ",
        "hoodie.cleaner.policy" -> "KEEP_LATEST_FILE_VERSIONS",
        "hoodie.keep.max.commits" -> "3",
        "hoodie.cleaner.commits.retained" -> "1",
        "hoodie.keep.min.commits" -> "2",
        "hoodie.compact.inline.max.delta.commits" -> "1"
        )
   
   val dateSMap: Map[Int, String] = Map(
       0-> "2020-07-01",
       1-> "2020-08-01",
       2-> "2020-09-01",
   )
   val dateMap: Map[Int, Timestamp] = Map(
       0-> Timestamp.valueOf("2010-07-01 11:00:15"),
       1-> Timestamp.valueOf("2010-08-01 11:00:15"),
       2-> Timestamp.valueOf("2010-09-01 11:00:15"),
   )
   var seq = Seq(
       (0, "value", dateMap(0), dateSMap(0), UUID.randomUUID.toString)
   )
   for(i <- 501 to 1000) {
       seq :+= (i, "value", dateMap(i % 3), dateSMap(i % 3), UUID.randomUUID.toString)
   }
   val df = seq.toDF("id", "string_column", "timestamp_column", "date_string", "uuid")
   ```
   
   Run the spark shell(the one taken from hudi quick start page and I am using spark version `spark-3.0.1-bin-hadoop2.7`):
   ```
   ./spark-shell --packages org.apache.hudi:hudi-spark-bundle_2.12:0.7.0,org.apache.spark:spark-avro_2.12:3.0.1 --conf 'spark.serializer=org.apache.spark.serializer.KryoSerializer'
   ```
   Copy the above script in there and hit `df.write.format("hudi").options(writeConfigs).mode(Overwrite).save(basePath)` 4 times and on the fifth time, it throws the anticipated
   ```
   Caused by: java.lang.IllegalArgumentException: Positive number of partitions required` issue.
   ```
   
   Now, the thing is, we _still_ have to _manually_ delete the first commit file, which contains the empty `partitionToReplaceFileIds`; otherwise, it would still keep throwing the `Positive number of partitions required issue` error.
   The `"hoodie.embed.timeline.server" -> "false"` _does_ help as it forces the write to refresh its timeline so we wouldn't see the second error again, which is 
   ```
   java.io.FileNotFoundException: <path_to_hoodie_folder>/.hoodie/20210403201659.replacecommit does not exist
   ```
   However, it appears `"hoodie.embed.timeline.server" -> "false"` to be not _quite_ necessary since the _6th_ time we write, the writer is automatically being refreshed with the _newest_ timeline and it will put all `*replacecommit` files back to a status of integrity again. 
   
   If we fix the empty `partitionToReplaceFileIds` issue, we might not need to dig into the `replacecommit does not exist` issue anymore since it is caused by the workaround of _manually_ deleting the empty commit file. It would fix everything from the start. However, I would still be curious to learn about _why_ we would need a `reset` of the timeline server within the `close` action upon the `HoodieTableFileSystemView`. It appears unnecessary to me and could be removed if there is no strong reason behind it. 
   
   The `reset` within `close` was originally introduced in #600 after a bit of digging in that code. I hope that helps you narrow down the scope a little bit. Maybe @bvaradar could explain it if the memory is still fresh to you since that PR is about 2 years ago from now. 😅 Thanks.
   
   
   


-- 
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.

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



[GitHub] [hudi] zherenyu831 commented on issue #2707: [SUPPORT] insert_ovewrite_table failed on archiving

Posted by GitBox <gi...@apache.org>.
zherenyu831 commented on issue #2707:
URL: https://github.com/apache/hudi/issues/2707#issuecomment-804831651


   But got new error
   
   ```
   User class threw exception: org.apache.hudi.exception.HoodieIOException: Could not read commit details from s3://xxx/.hoodie/20210317155538.replacecommit
   at org.apache.hudi.common.table.timeline.HoodieActiveTimeline.readDataFromPath(HoodieActiveTimeline.java:530)
   at org.apache.hudi.common.table.timeline.HoodieActiveTimeline.getInstantDetails(HoodieActiveTimeline.java:194)
   at org.apache.hudi.common.table.view.AbstractTableFileSystemView.lambda$resetFileGroupsReplaced$8(AbstractTableFileSystemView.java:217)
   at java.util.stream.ReferencePipeline$7$1.accept(ReferencePipeline.java:269)
   at java.util.ArrayList$ArrayListSpliterator.forEachRemaining(ArrayList.java:1382)
   at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:482)
   at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:472)
   at java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:708)
   at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
   at java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:566)
   at org.apache.hudi.common.table.view.AbstractTableFileSystemView.resetFileGroupsReplaced(AbstractTableFileSystemView.java:228)
   at org.apache.hudi.common.table.view.AbstractTableFileSystemView.init(AbstractTableFileSystemView.java:106)
   at org.apache.hudi.common.table.view.HoodieTableFileSystemView.init(HoodieTableFileSystemView.java:106)
   at org.apache.hudi.common.table.view.AbstractTableFileSystemView.reset(AbstractTableFileSystemView.java:248)
   at org.apache.hudi.common.table.view.HoodieTableFileSystemView.close(HoodieTableFileSystemView.java:353)
   at java.util.concurrent.ConcurrentHashMap$ValuesView.forEach(ConcurrentHashMap.java:4707)
   at org.apache.hudi.common.table.view.FileSystemViewManager.close(FileSystemViewManager.java:118)
   at org.apache.hudi.timeline.service.TimelineService.close(TimelineService.java:179)
   at org.apache.hudi.client.embedded.EmbeddedTimelineService.stop(EmbeddedTimelineService.java:112)
   at org.apache.hudi.client.AbstractHoodieClient.stopEmbeddedServerView(AbstractHoodieClient.java:90)
   at org.apache.hudi.client.AbstractHoodieClient.close(AbstractHoodieClient.java:82)
   at org.apache.hudi.client.AbstractHoodieWriteClient.close(AbstractHoodieWriteClient.java:912)
   at org.apache.hudi.HoodieSparkSqlWriter$.commitAndPerformPostOperations(HoodieSparkSqlWriter.scala:464)
   at org.apache.hudi.HoodieSparkSqlWriter$.write(HoodieSparkSqlWriter.scala:218)
   at org.apache.hudi.DefaultSource.createRelation(DefaultSource.scala:134)
   at org.apache.spark.sql.execution.datasources.SaveIntoDataSourceCommand.run(SaveIntoDataSourceCommand.scala:46)
   at org.apache.spark.sql.execution.command.ExecutedCommandExec.sideEffectResult$lzycompute(commands.scala:70)
   at org.apache.spark.sql.execution.command.ExecutedCommandExec.sideEffectResult(commands.scala:68)
   at org.apache.spark.sql.execution.command.ExecutedCommandExec.doExecute(commands.scala:86)
   at org.apache.spark.sql.execution.SparkPlan.$anonfun$execute$1(SparkPlan.scala:131)
   at org.apache.spark.sql.execution.SparkPlan.$anonfun$executeQuery$1(SparkPlan.scala:156)
   at org.apache.spark.rdd.RDDOperationScope$.withScope(RDDOperationScope.scala:151)
   at org.apache.spark.sql.execution.SparkPlan.executeQuery(SparkPlan.scala:152)
   at org.apache.spark.sql.execution.SparkPlan.execute(SparkPlan.scala:127)
   at org.apache.spark.sql.execution.QueryExecution.toRdd$lzycompute(QueryExecution.scala:83)
   at org.apache.spark.sql.execution.QueryExecution.toRdd(QueryExecution.scala:83)
   at org.apache.spark.sql.DataFrameWriter.$anonfun$runCommand$1(DataFrameWriter.scala:676)
   at org.apache.spark.sql.execution.SQLExecution$.$anonfun$withNewExecutionId$1(SQLExecution.scala:84)
   at org.apache.spark.sql.execution.SQLExecution$.withSQLConfPropagated(SQLExecution.scala:165)
   at org.apache.spark.sql.execution.SQLExecution$.withNewExecutionId(SQLExecution.scala:74)
   at org.apache.spark.sql.DataFrameWriter.runCommand(DataFrameWriter.scala:676)
   at org.apache.spark.sql.DataFrameWriter.saveToV1Source(DataFrameWriter.scala:290)
   at org.apache.spark.sql.DataFrameWriter.save(DataFrameWriter.scala:271)
   at org.apache.spark.sql.DataFrameWriter.save(DataFrameWriter.scala:229)
   at jp.ne.paypay.daas.dataloader.writer.HudiDataWriter.write(HudiDataWriter.scala:272)
   at jp.ne.paypay.daas.dataloader.writer.HudiDataWriter.insertOverrideTable(HudiDataWriter.scala:161)
   at jp.ne.paypay.daas.dataloader.FileSystemJob$.mainProcedure(FileSystemJob.scala:107)
   at jp.ne.paypay.daas.dataloader.FileSystemJob$.main(FileSystemJob.scala:38)
   at jp.ne.paypay.daas.dataloader.FileSystemJob.main(FileSystemJob.scala)
   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
   at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
   at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
   at java.lang.reflect.Method.invoke(Method.java:498)
   at org.apache.spark.deploy.yarn.ApplicationMaster$$anon$2.run(ApplicationMaster.scala:684)
   Caused by: java.io.FileNotFoundException: No such file or directory 's3://xxx/.hoodie/20210317155538.replacecommit'
   at com.amazon.ws.emr.hadoop.fs.s3n.S3NativeFileSystem.getFileStatus(S3NativeFileSystem.java:617)
   at com.amazon.ws.emr.hadoop.fs.s3n.S3NativeFileSystem.open(S3NativeFileSystem.java:1026)
   at org.apache.hadoop.fs.FileSystem.open(FileSystem.java:902)
   at com.amazon.ws.emr.hadoop.fs.EmrFileSystem.open(EmrFileSystem.java:207)
   at org.apache.hudi.common.fs.HoodieWrapperFileSystem.open(HoodieWrapperFileSystem.java:459)
   at org.apache.hudi.common.table.timeline.HoodieActiveTimeline.readDataFromPath(HoodieActiveTimeline.java:527)
   ```


-- 
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.

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