-
Notifications
You must be signed in to change notification settings - Fork 14
[ASTS] Fix: Update getTimestampRangeRecord to return empty when record not present #7439
base: develop
Are you sure you want to change the base?
Conversation
Generate changelog in
|
1273547
to
26515f9
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agree with this API, but had a question on the guarantee we're aiming for
@@ -120,17 +119,16 @@ private BucketProbeResult findCompletedBuckets(ShardAndStrategy shardAndStrategy | |||
throw new SafeIllegalStateException("Didn't expect to get here"); | |||
} | |||
|
|||
// TODO(mdaudali): This method is still incorrect (a record does not exist for an open bucket, not just pre-init | |||
// bucket 0). A follow up PR will address this. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
* Returns the {@link TimestampRange} for the given bucket identifier, throwing a | ||
* {@link java.util.NoSuchElementException} if one is not present. | ||
* Returns a {@link TimestampRange} for the given bucket identifier, if one exists. Iff a bucket is closed, then | ||
* the corresponding record will be present. (If the bucket is open, no record will be present.) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This isn't atomic though right? The bucket writer, in order, does the following:
- writes closed buckets to the buckets table
- writes the bucket record
- sets the state machine to be ready going in the next state
So if we happen to launch this query between steps 1 and 2, then there could be a closed bucket with no record in the bucket records table, unless I've misunderstood something. It's more "if record present, bucket definitively closed - if record not present, bucket could be open or closed".
For what it's worth I think your prototype in #7424 handles this acceptably, though I'm not fully certain if the logging there is always correct - it is OK to end the bucket probe even if the bucket was closed (and we're only doing it for an edge case where transitioning to ready keeps failing).
26515f9
to
f7f270b
Compare
General
Before this PR:
Part 1 (of ~3): The background shard progress updater assumes that buckets without progress are unstarted. This is incorrect, because 1) we delete progress when the bucket is complete, but separately 2) we delete progress right after finding completed buckets, and so if we crashed after deleting progress but before updating the starting bucket (and assuming the foreground task removes the sweepable bucket entry too), then we'd never make progress past the bucket we crashed on.
Instead, we need a new method to determine when a bucket is completed, as shown in the draft #7424.
After this PR:
Updates the guarantees around getTimestampRangeRecord. The signature now reflects the fact that a record may not be present in certain circumstances (open buckets) and that this is not an exceptional event.
We will use this (will exist after this PR) + progress (already exists) + whether a sweepable bucket entry exists (method coming in another PR) to determine the status of a bucket.
==COMMIT_MSG==
==COMMIT_MSG==
Priority:
P2
Concerns / possible downsides (what feedback would you like?):
The ShardProgressUpdater is still broken. I'll fix it in the final PR.
Is documentation needed?:
Compatibility
Does this PR create any API breaks (e.g. at the Java or HTTP layers) - if so, do we have compatibility?:
No
Does this PR change the persisted format of any data - if so, do we have forward and backward compatibility?:
No
The code in this PR may be part of a blue-green deploy. Can upgrades from previous versions safely coexist? (Consider restarts of blue or green nodes.):
Yes
Does this PR rely on statements being true about other products at a deployment - if so, do we have correct product dependencies on these products (or other ways of verifying that these statements are true)?:
No
Does this PR need a schema migration?
No
Testing and Correctness
What, if any, assumptions are made about the current state of the world? If they change over time, how will we find out?:
That ASTS is not being used outside of one test env
What was existing testing like? What have you done to improve it?:
Updated the tests
If this PR contains complex concurrent or asynchronous code, is it correct? The onus is on the PR writer to demonstrate this.:
N/A
If this PR involves acquiring locks or other shared resources, how do we ensure that these are always released?:
N/A
Execution
How would I tell this PR works in production? (Metrics, logs, etc.):
Final PR
Scale
Would this PR be expected to pose a risk at scale? Think of the shopping product at our largest stack.:
N/A
Would this PR be expected to perform a large number of database calls, and/or expensive database calls (e.g., row range scans, concurrent CAS)?:
N/A
Would this PR ever, with time and scale, become the wrong thing to do - and if so, how would we know that we need to do something differently?:
N/A
Development Process
Where should we start reviewing?:
DSABS
If this PR is in excess of 500 lines excluding versions lock-files, why does it not make sense to split it?:
Please tag any other people who should be aware of this PR:
@jeremyk-91
@raiju