Skip to content

Commit dda9bd0

Browse files
authored
[exporter/dorisexporter] fix ddl for doris 3.0.6 and 2.1.10 (#40819)
<!--Ex. Fixing a bug - Describe the bug and how this fixes the issue. Ex. Adding a feature - Explain what this achieves.--> #### Description 1. Use `size_based` compaction policy for the trace graph table instead of `time_series`. 2. Use `zstd` as the default compression algorithm for all tables. 3. Use `"inverted_index_storage_format"="V2"`. <!-- Issue number (e.g. #1234) or full URL to issue, if applicable. --> #### Link to tracking issue Fixes #40578 #40827 <!--Please delete paragraphs that you did not use before submitting.-->
1 parent 5c3822a commit dda9bd0

File tree

3 files changed

+44
-4
lines changed

3 files changed

+44
-4
lines changed

.chloggen/doris306.yaml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# Use this changelog template to create an entry for release notes.
2+
3+
# One of 'breaking', 'deprecation', 'new_component', 'enhancement', 'bug_fix'
4+
change_type: bug_fix
5+
6+
# The name of the component, or a single word describing the area of concern, (e.g. filelogreceiver)
7+
component: dorisexporter
8+
9+
# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`).
10+
note: fix ddl for doris 3.0.6 and 2.1.10
11+
12+
# Mandatory: One or more tracking issues related to the change. You can use the PR number here if no issue exists.
13+
issues: [40578, 40827]
14+
15+
# (Optional) One or more lines of additional information to render under the primary note.
16+
# These lines will be padded with 2 spaces and then inserted directly into the document.
17+
# Use pipe (|) for multiline entries.
18+
subtext: 1. Use `size_based` compaction policy for the trace graph table instead of `time_series`. | 2. Use `"inverted_index_storage_format"="V2"`. | 3. Use `zstd` as the default compression algorithm for all tables.
19+
20+
# If your change doesn't affect end users or the exported elements of any package,
21+
# you should instead start your pull request title with [chore] or use the "Skip Changelog" label.
22+
# Optional: The change log or logs in which this entry should be included.
23+
# e.g. '[user]' or '[user, api]'
24+
# Include 'user' if the change is relevant to end users.
25+
# Include 'api' if there is a change to a library API.
26+
# Default: '[user]'
27+
change_logs: [user]

exporter/dorisexporter/config.go

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -128,18 +128,31 @@ const (
128128
properties = `
129129
PROPERTIES (
130130
"replication_num" = "%d",
131-
"compaction_policy" = "time_series",
131+
"compaction_policy" = "%s",
132132
"dynamic_partition.enable" = "true",
133133
"dynamic_partition.create_history_partition" = "true",
134134
"dynamic_partition.time_unit" = "DAY",
135135
"dynamic_partition.start" = "%d",
136136
"dynamic_partition.history_partition_num" = "%d",
137137
"dynamic_partition.end" = "1",
138-
"dynamic_partition.prefix" = "p"
138+
"dynamic_partition.prefix" = "p",
139+
"compression" = "zstd",
140+
"inverted_index_storage_format" = "V2"
139141
)
140142
`
141143
)
142144

145+
const (
146+
compactionPolicySizeBased = "size_based"
147+
compactionPolicyTimeSeries = "time_series"
148+
)
149+
150+
// // propertiesStr returns the properties string for non-unique key tables.
143151
func (cfg *Config) propertiesStr() string {
144-
return fmt.Sprintf(properties, cfg.ReplicationNum, cfg.startHistoryDays(), cfg.CreateHistoryDays)
152+
return fmt.Sprintf(properties, cfg.ReplicationNum, compactionPolicyTimeSeries, cfg.startHistoryDays(), cfg.CreateHistoryDays)
153+
}
154+
155+
// // propertiesStrForUniqueKey returns the properties string for unique key tables.
156+
func (cfg *Config) propertiesStrForUniqueKey() string {
157+
return fmt.Sprintf(properties, cfg.ReplicationNum, compactionPolicySizeBased, cfg.startHistoryDays(), cfg.CreateHistoryDays)
145158
}

exporter/dorisexporter/exporter_traces.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ func (e *tracesExporter) start(ctx context.Context, host component.Host) error {
109109
e.logger.Warn("failed to create materialized view", zap.Error(err))
110110
}
111111

112-
ddl = fmt.Sprintf(tracesGraphDDL, e.cfg.Traces, e.cfg.propertiesStr())
112+
ddl = fmt.Sprintf(tracesGraphDDL, e.cfg.Traces, e.cfg.propertiesStrForUniqueKey())
113113
_, err = conn.ExecContext(ctx, ddl)
114114
if err != nil {
115115
return err

0 commit comments

Comments
 (0)