You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Appended very large (or a lot of) rows to statement
Flushed
Restarted clickhouse server while still flushing
Received broken pipe or connection reset
Attempted retries forever with same result, since connection never released.
Expected behaviour
Blocks sent on a pool containing connections which are no longer valid should (eventually) be flushable once those connections are cycled out of the pool. The only current alternative client side is to retain a second buffer so that the statement can be completely re-prepared and appended, which requires double the memory.
Code example
// The following test case relies on timing and sufficiently large batches to trigger that timing but is more illustrative of the problem without building mock pool/statement/connection structs in the clickhouse package
Observed
driver.WithCloseOnFlush()
Expected behaviour
Blocks sent on a pool containing connections which are no longer valid should (eventually) be flushable once those connections are cycled out of the pool. The only current alternative client side is to retain a second buffer so that the statement can be completely re-prepared and appended, which requires double the memory.
Code example
// The following test case relies on timing and sufficiently large batches to trigger that timing but is more illustrative of the problem without building mock pool/statement/connection structs in the clickhouse package
package tests
import (
"context"
"errors"
"github.com/ClickHouse/clickhouse-go/v2"
"github.com/ClickHouse/clickhouse-go/v2/lib/driver"
"github.com/stretchr/testify/require"
"github.com/testcontainers/testcontainers-go"
"os"
"syscall"
"testing"
)
//goland:noinspection ALL
const insertQry = "INSERT INTO test (foo, foo2)"
func TestBatchFlushBrokenConn(t *testing.T) {
env, err := GetNativeTestEnvironment()
require.NoError(t, err)
require.NotNil(t, env)
ctx := context.Background()
client, err := testcontainers.NewDockerClientWithOpts(ctx)
require.NoError(t, err)
chClient, err := getConnection(env, env.Database, clickhouse.Settings{}, nil, &clickhouse.Compression{
Method: clickhouse.CompressionLZ4,
})
}
The text was updated successfully, but these errors were encountered: