-
Notifications
You must be signed in to change notification settings - Fork 748
[GOBBLIN-1930] Improve Multi-active related logs and metrics #3800
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 5 commits
00a26ee
e3bfa64
d4c7c2f
fff6670
07ea65c
627e7ec
afaedbe
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -242,7 +242,6 @@ private void runRetentionOnArbitrationTable() { | |
| ScheduledThreadPoolExecutor executor = new ScheduledThreadPoolExecutor(1); | ||
| Runnable retentionTask = () -> { | ||
| try { | ||
| Thread.sleep(10000); | ||
| withPreparedStatement(thisTableRetentionStatement, | ||
| retentionStatement -> { | ||
| retentionStatement.setLong(1, retentionPeriodMillis); | ||
|
|
@@ -253,7 +252,7 @@ private void runRetentionOnArbitrationTable() { | |
| } | ||
| return numRowsDeleted; | ||
| }, true); | ||
| } catch (InterruptedException | IOException e) { | ||
| } catch (IOException e) { | ||
| log.error("Failing to run retention on lease arbiter table. Unbounded growth can lead to database slowness and " | ||
| + "affect our system performance. Examine exception: ", e); | ||
| } | ||
|
|
@@ -307,7 +306,7 @@ public LeaseAttemptStatus tryAcquireLease(DagActionStore.DagAction flowAction, l | |
| } | ||
| if (eventTimeMillis == dbEventTimestamp.getTime()) { | ||
| // TODO: change this to a debug after fixing issue | ||
| log.info("tryAcquireLease for [{}, is: {}, eventTimestamp: {}] - dbEventTimeMillis: {} - Reminder event time" | ||
| log.info("tryAcquireLease for [{}, is: {}, eventTimestamp: {}] - dbEventTimeMillis: {} - Reminder event time " | ||
| + "is the same as db event.", flowAction, isReminderEvent ? "reminder" : "original", | ||
| eventTimeMillis, dbEventTimestamp); | ||
| } | ||
|
|
@@ -320,16 +319,18 @@ public LeaseAttemptStatus tryAcquireLease(DagActionStore.DagAction flowAction, l | |
| // Lease is valid | ||
| if (leaseValidityStatus == 1) { | ||
| if (isWithinEpsilon) { | ||
| DagActionStore.DagAction updatedFlowAction = updateFlowExecutionId(flowAction, dbEventTimestamp.getTime()); | ||
| log.info("tryAcquireLease for [{}, is: {}, eventTimestamp: {}] - CASE 2: Same event, lease is valid", | ||
| flowAction, isReminderEvent ? "reminder" : "original", dbCurrentTimestamp.getTime()); | ||
| updatedFlowAction, isReminderEvent ? "reminder" : "original", dbCurrentTimestamp.getTime()); | ||
| // Utilize db timestamp for reminder | ||
| return new LeasedToAnotherStatus(flowAction, dbEventTimestamp.getTime(), | ||
| return new LeasedToAnotherStatus(updatedFlowAction, dbEventTimestamp.getTime(), | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. each of the flowExecId updates uses the timestamp value that is also passed as the second arg to the e.g. it could always implement:
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Fixed |
||
| dbLeaseAcquisitionTimestamp.getTime() + dbLinger - dbCurrentTimestamp.getTime()); | ||
| } | ||
| DagActionStore.DagAction updatedFlowAction = updateFlowExecutionId(flowAction, dbCurrentTimestamp.getTime()); | ||
| log.info("tryAcquireLease for [{}, is: {}, eventTimestamp: {}] - CASE 3: Distinct event, lease is valid", | ||
| flowAction, isReminderEvent ? "reminder" : "original", dbCurrentTimestamp.getTime()); | ||
| updatedFlowAction, isReminderEvent ? "reminder" : "original", dbCurrentTimestamp.getTime()); | ||
| // Utilize db lease acquisition timestamp for wait time | ||
| return new LeasedToAnotherStatus(flowAction, dbCurrentTimestamp.getTime(), | ||
| return new LeasedToAnotherStatus(updatedFlowAction, dbCurrentTimestamp.getTime(), | ||
| dbLeaseAcquisitionTimestamp.getTime() + dbLinger - dbCurrentTimestamp.getTime()); | ||
| } // Lease is invalid | ||
| else if (leaseValidityStatus == 2) { | ||
|
|
@@ -515,20 +516,30 @@ protected LeaseAttemptStatus evaluateStatusAfterLeaseAttempt(int numRowsUpdated, | |
| if (!selectInfoResult.getLeaseAcquisitionTimeMillis().isPresent()) { | ||
| return new NoLongerLeasingStatus(); | ||
| } | ||
| DagActionStore.DagAction updatedFlowAction = updateFlowExecutionId(flowAction, selectInfoResult.eventTimeMillis); | ||
| if (numRowsUpdated == 1) { | ||
| log.info("Obtained lease for [{}, is: {}, eventTimestamp: {}] successfully!", flowAction, | ||
| log.info("Obtained lease for [{}, is: {}, eventTimestamp: {}] successfully!", updatedFlowAction, | ||
| isReminderEvent ? "reminder" : "original", selectInfoResult.eventTimeMillis); | ||
| return new LeaseObtainedStatus(flowAction, selectInfoResult.eventTimeMillis, | ||
| return new LeaseObtainedStatus(updatedFlowAction, selectInfoResult.eventTimeMillis, | ||
| selectInfoResult.getLeaseAcquisitionTimeMillis().get()); | ||
| } | ||
| log.info("Another participant acquired lease in between for [{}, is: {}, eventTimestamp: {}] - num rows updated: {}", | ||
| flowAction, isReminderEvent ? "reminder" : "original", selectInfoResult.eventTimeMillis, numRowsUpdated); | ||
| updatedFlowAction, isReminderEvent ? "reminder" : "original", selectInfoResult.eventTimeMillis, numRowsUpdated); | ||
| // Another participant acquired lease in between | ||
| return new LeasedToAnotherStatus(flowAction, selectInfoResult.getEventTimeMillis(), | ||
| return new LeasedToAnotherStatus(updatedFlowAction, selectInfoResult.getEventTimeMillis(), | ||
| selectInfoResult.getLeaseAcquisitionTimeMillis().get() + selectInfoResult.getDbLinger() | ||
| - (dbCurrentTimestamp.isPresent() ? dbCurrentTimestamp.get().getTime() : System.currentTimeMillis())); | ||
| } | ||
|
|
||
| /** | ||
| * Replace flow execution id with agreed upon event time to easily track the flow | ||
| */ | ||
| protected static DagActionStore.DagAction updateFlowExecutionId(DagActionStore.DagAction flowAction, | ||
|
umustafi marked this conversation as resolved.
Outdated
|
||
| long eventTimeMillis) { | ||
| return new DagActionStore.DagAction(flowAction.getFlowGroup(), flowAction.getFlowName(), | ||
| String.valueOf(eventTimeMillis), flowAction.getFlowActionType()); | ||
| } | ||
|
|
||
| /** | ||
| * Complete the INSERT statement for a new flow action lease where the flow action is not present in the table | ||
| * @param statement | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.