-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathflags.go
More file actions
81 lines (66 loc) · 3.54 KB
/
Copy pathflags.go
File metadata and controls
81 lines (66 loc) · 3.54 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
package flags
import (
"flag"
"strings"
"time"
)
var Port = flag.Uint("port", 50052,
"Listen port")
var LogLevel = flag.String("log-level", "notice",
"Log level: notice, info, warning, severe")
var LogPretty = flag.Bool("log-pretty", false,
"Pretty logging instead of JSON")
type ConfigDefinition struct {
Name string
DefaultValue uint
MinValue uint
MaxValue uint
Description string
Flag *uint
}
func (s *ConfigDefinition) RegisterFlag() *uint {
s.Flag = flag.Uint(strings.ReplaceAll(s.Name, "_", "-"), s.DefaultValue, s.Description)
return s.Flag
}
var WriteBatchSizeSetting = ConfigDefinition{
Name: "write_batch_size", DefaultValue: 100_000, MinValue: 5_000, MaxValue: 100_000,
Description: "Batch size for INSERT operations (uses native protocol)"}
var WriteBatchSize = WriteBatchSizeSetting.RegisterFlag()
var SelectBatchSizeSetting = ConfigDefinition{
Name: "select_batch_size", DefaultValue: 1_500, MinValue: 200, MaxValue: 1_500,
Description: "Batch size for SELECT operations"}
var SelectBatchSize = SelectBatchSizeSetting.RegisterFlag()
var MutationBatchSizeSetting = ConfigDefinition{
Name: "mutation_batch_size", DefaultValue: 1_500, MinValue: 200, MaxValue: 1_500,
Description: "Batch size for ALTER TABLE UPDATE mutations (builds SQL strings, keep low to avoid large queries)"}
var MutationBatchSize = MutationBatchSizeSetting.RegisterFlag()
var HardDeleteBatchSizeSetting = ConfigDefinition{
Name: "hard_delete_batch_size", DefaultValue: 1_500, MinValue: 200, MaxValue: 1_500,
Description: "Batch size for DELETE mutations (builds SQL strings, keep low to avoid large queries)"}
var HardDeleteBatchSize = HardDeleteBatchSizeSetting.RegisterFlag()
var MaxParallelSelects = flag.Uint("max-parallel-selects", 10,
"Max number of parallel SELECT queries")
var MaxIdleConnections = flag.Uint("max-idle-connections", 5,
"Max number of idle connections for ClickHouse client")
var MaxOpenConnections = flag.Uint("max-open-connections", 10,
"Max number of open connections for ClickHouse client (recommended: max-idle-connections + 5)")
var RequestTimeoutDuration = flag.Duration("request-timeout-duration", 300*time.Second,
"Timeout for ClickHouse client requests")
var MaxRetries = flag.Uint("max-retries", 10,
"Max number of retries for ClickHouse client in case of network errors")
var InitialRetryDelayMilliseconds = flag.Uint("initial-retry-delay-ms", 100,
"Initial delay in milliseconds for backoff retries in case of network errors")
var MaxRetryDelayMilliseconds = flag.Uint("max-retry-delay-ms", 10_000,
"Max delay in milliseconds for backoff retries in case of network errors")
var MaxInactiveReplicaCheckRetries = flag.Uint("max-inactive-replica-check-retries", 600,
"Max number of retries when checking inactive replicas before failing")
var InactiveReplicaCheckInterval = flag.Duration("inactive-replica-check-interval", 1*time.Second,
"Interval between inactive replicas check retries")
var MaxAsyncMutationsCheckRetries = flag.Uint("max-async-mutations-check-retries", 600,
"Max number of retries when checking async mutations status before failing")
var AsyncMutationsCheckInterval = flag.Duration("async-mutations-check-interval", 1*time.Second,
"Interval between async mutations status check retries")
var MaxDatabaseCreatedCheckRetries = flag.Uint("max-database-created-check-retries", 30,
"Max number of retries when checking database creation status before failing")
var DatabaseCreatedCheckInterval = flag.Duration("database-created-check-interval", 1*time.Second,
"Interval between database creation status check retries")