fractaledmind / litestream-ruby

MIT License
71 stars 6 forks source link

Feature request: Command line arguments #4

Closed supermomonga closed 7 months ago

supermomonga commented 7 months ago

According to the document, replicate command takes some options. I think if litestream:replicate take care of ARGV, it'll be useful.

Usecase

Launch Rails and Sidekiq process after litestream replication is ready(read transaction is established).

bin/rails litestream:replicate -- -exec "foreman start"
# Procfile
web: bin/rails server
worker: bin/sidekiq
fractaledmind commented 7 months ago

This is a great suggestion. Thank you. I will try to get this added shortly.

fractaledmind commented 7 months ago

Version 0.3.2 released to RubyGems

fractaledmind commented 7 months ago

@supermomonga: Did you experience any specific problem by running the replication process alongside the application processes, where data was dropped from the replication stream because the application processes were doing work before the replication stream was up?

My current mental model of Litestream is that it would scoop up that work once it came online anyway, but maybe my model is overly simplistic. I'd love to hear more about your experiences that led you to this issue.

supermomonga commented 7 months ago

@fractaledmind

Version 0.3.2 released to RubyGems

Thank you! I'll use this feature in my product!

Did you experience any specific problem by running the replication process alongside the application processes, where data was dropped from the replication stream because the application processes were doing work before the replication stream was up? My current mental model of Litestream is that it would scoop up that work once it came online anyway, but maybe my model is overly simplistic. I'd love to hear more about your experiences that led you to this issue.

I've only recently started using Litestream, so I haven't actually encountered any problems yet. From reading the How it works documentation, I was a bit paranoid because I wasn't 100% sure if shadow WALs will be created for WALs that were created before Litestream was in a ready. Maybe I'll read actual implementation around that, but sorry, I'm not familier with go.

Additionally, ther is another reason for me. As my understand, If litestream process exits, then it's subprocesses will also terminated. If Litestream process exit for error or some reason, I want to terminate application processes which will write to SQLite. Because I prioritize data safety over the service SLA so I don't want to provide my webapp to user while replication is stopped.