Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add alter statements for altering table ttl after table creation #121

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions sqlscripts/jaeger-index-alter.tmpl.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
ALTER TABLE {{.SpansIndexTable}}
{{if .Replication}}ON CLUSTER '{cluster}'{{end}}
MODIFY {{.TTLTimestamp}}
3 changes: 3 additions & 0 deletions sqlscripts/jaeger-spans-alter.tmpl.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
ALTER TABLE {{.SpansTable}}
{{if .Replication}}ON CLUSTER '{cluster}'{{end}}
MODIFY {{.TTLTimestamp}}
3 changes: 3 additions & 0 deletions sqlscripts/jaeger-spans-archive-alter.tmpl.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
ALTER TABLE {{.SpansArchiveTable}}
{{if .Replication}}ON CLUSTER '{cluster}'{{end}}
MODIFY {{.TTLTimestamp}}
6 changes: 6 additions & 0 deletions storage/store.go
Original file line number Diff line number Diff line change
Expand Up @@ -268,6 +268,12 @@ func runInitScripts(logger hclog.Logger, db *sql.DB, cfg Configuration) error {
sqlStatements = append(sqlStatements, render(templates, "jaeger-spans.tmpl.sql", args))
sqlStatements = append(sqlStatements, render(templates, "jaeger-spans-archive.tmpl.sql", args))

if cfg.TTLDays > 0 {
sqlStatements = append(sqlStatements, render(templates, "jaeger-index-alter.tmpl.sql", args))
sqlStatements = append(sqlStatements, render(templates, "jaeger-spans-alter.tmpl.sql", args))
sqlStatements = append(sqlStatements, render(templates, "jaeger-spans-archive-alter.tmpl.sql", args))
}

if cfg.Replication {
// Now these tables omit the "_local" suffix
distargs := distributedTableArgs{
Expand Down