Fix memory leak in secondary, cleanup code.

This commit is contained in:
jdl
2024-01-06 20:50:20 +01:00
parent 6b0b7408bc
commit 0518c5dcca
10 changed files with 27 additions and 100 deletions

View File

@@ -12,7 +12,6 @@ const (
pathStreamWAL = "stream-wal"
)
// TODO: Remove this!
func (rep *Replicator) Handle(w http.ResponseWriter, r *http.Request) {
// We'll handle two types of requests: HTTP GET requests for JSON, or
// streaming requets for state or wall.

11
lib/rep/main_test.go Normal file
View File

@@ -0,0 +1,11 @@
package rep
import (
"testing"
"go.uber.org/goleak"
)
func TestMain(m *testing.M) {
goleak.VerifyTestMain(m)
}

View File

@@ -36,8 +36,8 @@ type App struct {
// SendState: The primary may need to send storage state to a secondary node.
SendState func(conn net.Conn) error
// (1) RecvState: Secondary nodes may need to load state from the primary if the
// WAL is too far behind.
// (1) RecvState: Secondary nodes may need to load state from the primary if
// the WAL is too far behind.
RecvState func(conn net.Conn) error
// (2) InitStorage: Prepare application storage for possible calls to

View File

@@ -56,6 +56,7 @@ func (h TestAppHarness) Run(t *testing.T) {
WALSegMaxAgeSec: 1,
WALSegGCAgeSec: 1,
})
defer app2.Close()
val.MethodByName(method.Name).Call([]reflect.Value{
reflect.ValueOf(t),