Skip to content
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

SHARD-1386 : Harden relayer collector syncing #35

Merged
merged 34 commits into from
Feb 6, 2025
Merged

Conversation

abdulazeem-tk4vr
Copy link
Member

linear: https://linear.app/shm/issue/SHARD-1386/harden-relayer-collector-syncing

  • Added data patcher to sync transactions lost between cycles
  • Added code to avoid collector turning into zombie process upon errors being thrown - Stability
  • Added checkpoint table to refer to the last known stable cycle of information in the collector dB

package.json Outdated Show resolved Hide resolved
src/class/validateData.ts Outdated Show resolved Hide resolved
src/collector.ts Outdated Show resolved Hide resolved
src/collector.ts Outdated Show resolved Hide resolved
src/storage/checkpoint.ts Show resolved Hide resolved
src/storage/receipt.ts Outdated Show resolved Hide resolved
console.log('VERY SLOW QUERY', sql, time)
}
})
// NOT SUPPORTED IN BETTER-SQLITE3

Choose a reason for hiding this comment

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

what's an option for this? we may need to have some profiling

Copy link

Choose a reason for hiding this comment

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

we could make a db wrapper class than can proxy the run, prepare, all , etc calls to run the profiling. that way we wouldnt' need to replace all usages of db.x instead could just import our wrapper class as db = new WrapperDatabase and everything should still work

Copy link
Member Author

Choose a reason for hiding this comment

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

maybe we address this in another ticket?

src/utils/patchCollector.ts Show resolved Hide resolved
src/collector.ts Outdated Show resolved Hide resolved
src/collector.ts Outdated Show resolved Hide resolved
src/collector.ts Outdated Show resolved Hide resolved
src/collector.ts Outdated Show resolved Hide resolved
src/collector.ts Outdated Show resolved Hide resolved
src/collector.ts Outdated Show resolved Hide resolved
src/utils/patchCollector.ts Outdated Show resolved Hide resolved
src/collector.ts Outdated Show resolved Hide resolved
@@ -5,6 +5,7 @@ import { insertOrUpdateCycle } from '../storage/cycle'
import { processReceiptData } from '../storage/receipt'
import { processOriginalTxData } from '../storage/originalTxData'
import { CycleLogWriter, ReceiptLogWriter, OriginalTxDataLogWriter } from './DataLogWriter'
import * as checkpoint from '../storage/checkpoint'

Choose a reason for hiding this comment

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

this import isn't needed

src/collector.ts Outdated
console.log('Attempting fix..')

// Starts the syncing process from the beginning
const status = await startPatching(0)

Choose a reason for hiding this comment

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

this is not correct right? it should start syncing from whatever checkpoint we have in DB.
I also hope we considered syncing last 100 cycles by default on restart @abdulazeem-tk4vr

…ustness

fix : add error logs

fix: ensure start cycle does not go below zero in patching process
@aniketdivekar aniketdivekar marked this pull request as ready for review February 6, 2025 12:49
aniketdivekar
aniketdivekar previously approved these changes Feb 6, 2025
urnotsam
urnotsam previously approved these changes Feb 6, 2025
@aniketdivekar aniketdivekar dismissed stale reviews from urnotsam and themself via f6b0add February 6, 2025 18:34
@aniketdivekar aniketdivekar merged commit 135c03e into dev Feb 6, 2025
7 checks passed
@aniketdivekar aniketdivekar deleted the checkpoint branch February 6, 2025 18:49
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.

4 participants