internal/postgres: remove dynamic check of symbol history tables
Now that there is only one symbol_history table, we no longer need
to check dynamically which one to use.
Change-Id: Ia1e51af743acafabd07042e473d7444789169f48
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/341589
Trust: Jonathan Amsterdam <jba@google.com>
Run-TryBot: Jonathan Amsterdam <jba@google.com>
Reviewed-by: Jamal Carvalho <jamal@golang.org>
Reviewed-by: Julie Qiu <julie@golang.org>
TryBot-Result: kokoro <noreply+kokoro@google.com>
diff --git a/internal/postgres/insert_symbol_history.go b/internal/postgres/insert_symbol_history.go
index d33fda1..0b68758 100644
--- a/internal/postgres/insert_symbol_history.go
+++ b/internal/postgres/insert_symbol_history.go
@@ -12,7 +12,6 @@
"golang.org/x/pkgsite/internal"
"golang.org/x/pkgsite/internal/database"
"golang.org/x/pkgsite/internal/derrors"
- "golang.org/x/pkgsite/internal/experiment"
"golang.org/x/pkgsite/internal/version"
)
@@ -96,26 +95,8 @@
"goos",
"goarch",
}
- for _, table := range []string{
- "symbol_history",
- "new_symbol_history",
- } {
- if experiment.IsActive(ctx, internal.ExperimentSkipInsertSymbols) {
- if table == "symbol_history" {
- // Skip this table because we can't insert into
- // package_symbol_id due to integer overflow issues.
- continue
- }
- }
- // Only insert if the table exists.
- // TODO(jba): remove after new_symbol_history is renamed to symbol_history.
- if exists, err := tableExists(ctx, ddb, table); err != nil {
- return err
- } else if !exists {
- continue
- }
- if err := ddb.BulkInsert(ctx, table, cols, values,
- fmt.Sprintf(`ON CONFLICT (package_path_id, module_path_id, symbol_name_id, goos, goarch)
+ if err := ddb.BulkInsert(ctx, "symbol_history", cols, values, `
+ ON CONFLICT (package_path_id, module_path_id, symbol_name_id, goos, goarch)
DO UPDATE
SET
symbol_name_id=excluded.symbol_name_id,
@@ -128,9 +109,8 @@
goos=excluded.goos,
goarch=excluded.goarch
WHERE
- %s.sort_version > excluded.sort_version`, table)); err != nil {
- return err
- }
+ symbol_history.sort_version > excluded.sort_version`); err != nil {
+ return err
}
}
}