Alternate exit criteria for DataIterators
Nobody has claimed this yet.
Assessment
- Difficulty
- 5/5
- Estimated time
- Over a week
- Newbie friendliness
- 25/100
Research direction
Start by reading the DataIterator and Cursor flow, then inspect CopyFilter.BuildSelect and Ferry's use of dataIterator.Run(). The change should support object-ID batches across property tables and stop only when no object IDs remain, rather than when one query yields zero rows.
Written by the indexing model from the issue text.
Description
For some context, the schema I'm trying to use Ghostferry with is based on EAV. Each table is a property table and an object will typically correspond to multiple records across various tables.
I'm also trying to implement sharding support with an implementation of CopyFilter.
My CopyFilter implementation generates object IDs for a given shard in batches and uses those IDs in BuildSelect to form the base SQL query to copy records, e.g.
SELECT ... FROM ... WHERE pagination_key IN [object_id1...object_id20]
I'm currently running into a problem where this query sometimes yields 0 rows for a property table for a batch of object IDs, leading the Cursor to terminate iteration early even though there are still objects in the shard left to process.
Ideally, the flow I need looks something like:
- Generate a batch of object IDs
- Copy all records across all property tables corresponding to these object IDs
- Terminate DataIterators if no more object IDs remain in shard
I don't believe this is possible without opening a PR against ghostferry, but let me know if I'm missing something. If it isn't possible, do you have any suggestions on how to implement this?
I'm thinking I'll need to have the DataIterator understand these object ID batches and do multiple dataIterator.Run()s for each batch before exiting. I see a few options here:
- A: Define an interface on DataIterator that supports different termination conditions
- B: Put the current DataIterator implementation behind an interface so Ferry can support an alternate implementation
Any guidance here would be appreciated - thanks for your time.
- Dominant language
- Go
- Stars
- 855
- Forks
- 74
- PR merge metrics
- No merged PRs in 30d
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from Shopify/ghostferry
-
good first issue
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
Shopify/ghostferry#107 · 7 comments ·
-
Difficulty 5/5 Over a week Newbie friendliness 25/100
Shopify/ghostferry#454 ·
-
Difficulty 4/5 3-5 days Newbie friendliness 30/100
Shopify/ghostferry#348 ·
-
Difficulty 3/5 1-2 days Newbie friendliness 42/100
Shopify/ghostferry#338 · 7 comments ·
-
Bug can't reproduce
Difficulty 4/5 3-5 days Newbie friendliness 30/100
Shopify/ghostferry#337 ·
All issues in Shopify/ghostferry
Similar issues
-
Difficulty 1/5 Under an hour Newbie friendliness 84/100
-
enhancement needs triage
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
-
kind/cleanup
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
kubernetes-sigs/kueue#15947 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
sympozium-ai/sympozium#627 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 86/100