nats-io / jsm.go

JetStream Management Library for Golang
Apache License 2.0
151 stars 26 forks source link

Resolves #538: add support for writing and restoring snapshots to a buffer in memory instead of requiring a file on disk #539

Closed christopher-wong closed 2 months ago

christopher-wong commented 3 months ago

Support creating and restoring snapshots from io.Reader and io.Writer instead of a file on disk.

christopher-wong commented 3 months ago

@ripienaar would appreciate another look when you have some time.

ripienaar commented 3 months ago

Thank you @christopher-wong have it on my to do list to get back to soon just dealing with some stuff :)

christopher-wong commented 2 months ago

I'm happy and ready to merge. Thanks for the review!

ripienaar commented 2 months ago

Looks like we have a nil pointer in the tests:

=== RUN   TestStream_Snapshot
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x12aface]

goroutine 11917 [running]:
github.com/nats-io/jsm%2ego.(*Stream).createSnapshot.func2(0xc000322230)
    /home/runner/work/jsm.go/jsm.go/snapshots.go:400 +0xce
github.com/nats-io/nats%2ego.(*Conn).waitForMsgs(0xc0008fae00, 0xc0000a0000)
    /home/runner/work/jsm.go/pkg/mod/github.com/nats-io/nats.go@v1.35.0/nats.go:3155 +0x79f
created by github.com/nats-io/nats%2ego.(*Conn).subscribeLocked in goroutine 11566
    /home/runner/work/jsm.go/pkg/mod/github.com/nats-io/nats.go@v1.35.0/nats.go:4368 +0x7ff
FAIL    github.com/nats-io/jsm.go   23.540s
christopher-wong commented 2 months ago

Fixed! Sorry about that - variable shadowing bug.

ripienaar commented 2 months ago

Nice one, thank you