Skip to content

Commit

Permalink
Don't fail on inline table service in deltastreamer unless new config…
Browse files Browse the repository at this point in the history
… is set
  • Loading branch information
Jonathan Vexler committed Nov 18, 2022
1 parent 7f331af commit a989efc
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -243,9 +243,22 @@ public boolean commitStats(String instantTime, List<HoodieWriteStat> stats, Opti
} finally {
this.txnManager.endTransaction(Option.of(inflightInstant));
}
// do this outside of lock since compaction, clustering can be time taking and we don't need a lock for the entire execution period
runTableServicesInline(table, metadata, extraMetadata);

// We don't want to fail the commit if hoodie.fail.writes.on.inline.table.service.errors is false. We catch warn if false
try {
// do this outside of lock since compaction, clustering can be time taking and we don't need a lock for the entire execution period
runTableServicesInline(table, metadata, extraMetadata);
} catch (Exception e) {
LOG.warn("VEXLER: caught the exception");
if (config.isFailOnTableServiceExceptionEnabled()) {
LOG.warn("VEXLER: here");
throw e;
}
LOG.warn("Inline compaction or clustering failed with exception: " + e.getMessage() + ". Attempting to finish commit. ");
}

emitCommitMetrics(instantTime, metadata, commitActionType);

// callback if needed.
if (config.writeCommitCallbackOn()) {
if (null == commitCallback) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -386,6 +386,12 @@ public class HoodieWriteConfig extends HoodieConfig {
.withDocumentation("Timeline archiving removes older instants from the timeline, after each write operation, to minimize metadata overhead. "
+ "Controls whether or not, the write should be failed as well, if such archiving fails.");

public static final ConfigProperty<String> FAIL_ON_TABLE_SERVICE_EXCEPTION_ENABLE = ConfigProperty
.key("hoodie.deltastreamer.fail.writes.on.inline.table.service.errors")
.defaultValue("false")
.withDocumentation("Table services such as compaction and clustering can fail and prevent syncing to "
+ "the metaclient in Deltastreamer. Set this to true to fail writes when table services fail");

public static final ConfigProperty<Long> INITIAL_CONSISTENCY_CHECK_INTERVAL_MS = ConfigProperty
.key("hoodie.consistency.check.initial_interval_ms")
.defaultValue(2000L)
Expand Down Expand Up @@ -1151,6 +1157,10 @@ public boolean isFailOnTimelineArchivingEnabled() {
return getBoolean(FAIL_ON_TIMELINE_ARCHIVING_ENABLE);
}

public boolean isFailOnTableServiceExceptionEnabled() {
return getBoolean(FAIL_ON_TABLE_SERVICE_EXCEPTION_ENABLE);
}

public int getMaxConsistencyChecks() {
return getInt(MAX_CONSISTENCY_CHECKS);
}
Expand Down

0 comments on commit a989efc

Please sign in to comment.