Skip to content

[HUDI-7011] a metric to indicate whether rollback has occurred in final compaction state#9956

Merged
danny0405 merged 2 commits intoapache:masterfrom
LXin96:hudi_compaction_metric_failed_count
Nov 3, 2023
Merged

[HUDI-7011] a metric to indicate whether rollback has occurred in final compaction state#9956
danny0405 merged 2 commits intoapache:masterfrom
LXin96:hudi_compaction_metric_failed_count

Conversation

@LXin96
Copy link
Contributor

@LXin96 LXin96 commented Oct 31, 2023

currently, when flink job start async compaction on a mor table, the metrics in org.apache.hudi.metrics.FlinkCompactionMetrics
will update including pendingCompactionCount,compactionDelay,compactionCost. However, when a compaction failed need a metric to
help user to know specific instant whether the final compaction has occured rollback.
so attemp to add a metric named compactionFailedState in org.apache.hudi.sink.compact.CompactionCommitSink to record the instance
happend rollback, which also means the current compaction failed in current time

Change Logs

add a metric named compactionFailedState in org.apache.hudi.sink.compact.CompactionCommitSink to record the instance
happend rollback, which also means the current compaction failed in current time

Impact

no impact

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

low medium

Documentation Update

Describe any necessary documentation update if there is any new feature, config, or user-facing change

  • 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


public enum CompactionState{
SUCCESS(0),FAILED(1);
int state;
Copy link
Contributor

Choose a reason for hiding this comment

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

The metric only has 0 and 1 as values, does it make sense to represent it as a metric?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

en, this metric works like a state signal used to alert people to know the final compaction state this time. when the mor table happens many rollback, may user can manual operate the hudi mor table or flink job. the pending count | delay cost may cant't represent the final result.


/**
* flag indicates whether rollback has occurred in final compaction state
*/
Copy link
Contributor

Choose a reason for hiding this comment

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

flag indicates whether rollback has occurred in final compaction state ->
Flag saying whether the compaction is completed or been rolled back.

* flag indicates whether rollback has occurred in final compaction state
*/
private long compactionFailedState;

Copy link
Contributor

Choose a reason for hiding this comment

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

compactionStateSignal

}

public void setCompactionFailedState(CompactionState compactionState){
this.compactionFailedState = compactionState.state;
Copy link
Contributor

Choose a reason for hiding this comment

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

Mayne we have 2 methods here:

markCompactionCompleted and markCompactionRolledBack.

@LXin96
Copy link
Contributor Author

LXin96 commented Nov 1, 2023

@danny0405 hello, i have fixed the change, would you please review one more

this.compactionFailedState = compactionState.state;
public void markCompactionCompleted(CompactionState compactionState) {
this.compactionStateSignal = compactionState.state;
}
Copy link
Contributor

Choose a reason for hiding this comment

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

There is no need to pass around CompactionState, just set up the constant 1 or 0 internally, the CompactionState can be eliminated.

@LXin96
Copy link
Contributor Author

LXin96 commented Nov 2, 2023

@danny0405 OK, it get you

@LXin96
Copy link
Contributor Author

LXin96 commented Nov 2, 2023

@hudi-bot run azure

@LXin96 LXin96 force-pushed the hudi_compaction_metric_failed_count branch from ac92a41 to bd6cc40 Compare November 2, 2023 08:31
@LXin96 LXin96 force-pushed the hudi_compaction_metric_failed_count branch from bd6cc40 to 184321e Compare November 2, 2023 09:14
@LXin96
Copy link
Contributor Author

LXin96 commented Nov 2, 2023

@danny0405 I have modified, please check

@hudi-bot
Copy link
Collaborator

hudi-bot commented Nov 2, 2023

CI report:

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

@danny0405 danny0405 merged commit 9599d0f into apache:master Nov 3, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants