Skip to content

Avoid write failures if metrics mode is invalid#301

Merged
rdblue merged 5 commits intoapache:masterfrom
rdblue:fix-write-failure
Aug 1, 2019
Merged

Avoid write failures if metrics mode is invalid#301
rdblue merged 5 commits intoapache:masterfrom
rdblue:fix-write-failure

Conversation

@rdblue
Copy link
Copy Markdown
Contributor

@rdblue rdblue commented Jul 19, 2019

This updates the MetricsConfig class to catch exceptions thrown by MetricsMode.fromString. The intent is to avoid failing write jobs when a metrics mode is invalid, because users may make changes to a table while a pipeline that writes to it is deployed and running. A live pipeline should not fail because of a typo in table tuning settings.

@rdblue
Copy link
Copy Markdown
Contributor Author

rdblue commented Jul 19, 2019

@aokolnychyi, could you review this?

Copy link
Copy Markdown
Contributor

@aokolnychyi aokolnychyi left a comment

Choose a reason for hiding this comment

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

I think it is a great idea not to fail jobs if the metrics config is invalid. I would also handle invalid default modes and add a test (maybe to TestMetricsModes).

public static MetricsConfig fromProperties(Map<String, String> props) {
MetricsConfig spec = new MetricsConfig();
String defaultModeAsString = props.getOrDefault(DEFAULT_WRITE_METRICS_MODE, DEFAULT_WRITE_METRICS_MODE_DEFAULT);
spec.defaultMode = MetricsModes.fromString(defaultModeAsString);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Will we fail jobs if the default mode is invalid?
Will it make sense to fallback DEFAULT_WRITE_METRICS_MODE_DEFAULT?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Good idea, we should wrap that in a try/catch as well.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Fixed.

@rdblue
Copy link
Copy Markdown
Contributor Author

rdblue commented Aug 1, 2019

@aokolnychyi, could you take another look?

public static final String METADATA_COMPRESSION = "write.metadata.compression-codec";
public static final String METADATA_COMPRESSION_DEFAULT = "none";

public static final String METRICS_MODE_COLUMN_CONF_PREFIX = "write.metadata.metrics.column.";
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

+1 on this. Do we want to have it as WRITE_METRICS_MODE_COLUMN_CONF_PREFIX to be consistent with defaults? Is there a possibility we will have READ_METRICS_MODE_COLUMN_CONF_PREFIX? Not sure.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I think this is fine.

Copy link
Copy Markdown
Contributor

@aokolnychyi aokolnychyi left a comment

Choose a reason for hiding this comment

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

LGTM, thanks!

@rdblue rdblue merged commit 62d09d7 into apache:master Aug 1, 2019
danielcweeks pushed a commit that referenced this pull request Aug 1, 2019
* Add argument validation to HadoopTables#create (#298)

* Install source JAR when running install target (#310)

* Add projectStrict for Dates and Timestamps (#283)

* Correctly publish artifacts on JitPack (#321)

The Gradle install target produces invalid POM files that are missing
the dependencyManagement section and versions for some dependencies.
Instead, we directly tell JitPack to run the correct Gradle target.

* Add build info to README.md (#304)

* Convert Iceberg time type to Hive string type (#325)

* Add overwrite option to write builders (#318)

* Fix out of order Pig partition fields (#326)

* Add mapping to Iceberg for external name-based schemas (#338)

* Site: Fix broken link to Iceberg API (#333)

* Add forTable method for Avro WriteBuilder (#322)

* Remove multiple literal strings check rule for scala (#335)

* Fix invalid javadoc url in README.md (#336)

* Use UnicodeUtil.truncateString for Truncate transform. (#340)

This truncates by unicode codepoint instead of Java chars.

* Refactor metrics tests for reuse (#331)

* Spark: Add support for write-audit-publish workflows (#342)

* Avoid write failures if metrics mode is invalid (#301)

* Fix truncateStringMax in UnicodeUtil (#334)

Fixes #328, fixes #329.

Index to codePointAt should be the offset calculated by code points

* [Vectorization] Added batch sizing, switched to BufferAllocator, other minor style fixes.
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.

2 participants