Skip to content

[HUDI-8410] Fix a flaky test for partition stats#12146

Merged
codope merged 2 commits intoapache:masterfrom
linliu-code:HUDI-8410_fix_bug
Nov 11, 2024
Merged

[HUDI-8410] Fix a flaky test for partition stats#12146
codope merged 2 commits intoapache:masterfrom
linliu-code:HUDI-8410_fix_bug

Conversation

@linliu-code
Copy link
Collaborator

Change Logs

When we expected there is a conflict between two upserts, which may not happen since the these two commits may not update existing records.

Created a function to take in records to ensure the conflict happens.

Impact

Less flaky.

Risk level (write none, low medium or high below)

Low.

Documentation Update

Describe any necessary documentation update if there is any new feature, config, or user-facing change. If not, put "none".

  • The config description must be updated if new configs are added or the default value of the configs are changed
  • Any new feature or user-facing change requires updating the Hudi website. Please create a Jira ticket, attach the
    ticket number here and follow the instruction to make
    changes to the website.

Contributor's checklist

  • Read through contributor's guide
  • Change Logs and Impact were stated clearly
  • Adequate tests were added if applicable
  • CI passed

@linliu-code linliu-code changed the title [HUDI-8410] Fix a flaky bug [HUDI-8410] Fix a flaky partition stats test Oct 23, 2024
@linliu-code linliu-code changed the title [HUDI-8410] Fix a flaky partition stats test [HUDI-8410] Fix a flaky test for partition stats Oct 23, 2024
@github-actions github-actions bot added the size:S PR with lines of changes in (10, 100] label Oct 23, 2024
import org.apache.hudi.client.transaction.lock.InProcessLockProvider
import org.apache.hudi.common.config.HoodieMetadataConfig
import org.apache.hudi.common.model.{FileSlice, HoodieBaseFile, HoodieCommitMetadata, HoodieFailedWritesCleaningPolicy, HoodieTableType, WriteConcurrencyMode, WriteOperationType}
import org.apache.hudi.common.model._
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Avoid using _ unless there are more than 20 entries

import org.apache.hudi.common.table.timeline.HoodieInstant
import org.apache.hudi.common.testutils.RawTripTestPayload.recordsToStrings
import org.apache.hudi.config.{HoodieCleanConfig, HoodieClusteringConfig, HoodieCompactionConfig, HoodieLockConfig, HoodieWriteConfig}
import org.apache.hudi.config._
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here

latestBatchDf
}

protected def doWriteAndValidateDataAndPartitionStats(records: mutable.Buffer[String],
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can this be reused by the method above to avoid code duplication?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah. refactored.

)

doWriteAndValidateDataAndPartitionStats(hudiOpts,
val firstBatch: mutable.Buffer[String] =
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
val firstBatch: mutable.Buffer[String] =
val insertRecords: mutable.Buffer[String] =

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

saveMode = SaveMode.Overwrite,
validate = false)

val latestBatch1: mutable.Buffer[String] = firstBatch
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
val latestBatch1: mutable.Buffer[String] = firstBatch
val writer1Records: mutable.Buffer[String] = firstBatch

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

validate = false)

val latestBatch1: mutable.Buffer[String] = firstBatch
val latestBatch2: mutable.Buffer[String] =
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
val latestBatch2: mutable.Buffer[String] =
val writer2Records: mutable.Buffer[String] =

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

@hudi-bot
Copy link
Collaborator

CI report:

Bot commands @hudi-bot supports the following commands:
  • @hudi-bot run azure re-run the last Azure build

@linliu-code linliu-code requested a review from yihua October 25, 2024 16:15
@codope codope merged commit 188b7af into apache:master Nov 11, 2024
usberkeley pushed a commit to usberkeley/hudi that referenced this pull request Nov 13, 2024
* [HUDI-8410] Fix the bug

* address comments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:S PR with lines of changes in (10, 100]

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants