satellite/metabase: use better label for ignoring FTS queries

For some test queries we are using workaround to filter them out from
full table scan detection. To avoid confustion what is this all about
we are changing label to be more descriptive.

Change-Id: I41a744e8faf400e3e8de7e416d8f4242f9093fce
This commit is contained in:
Michal Niewrzal 2023-07-24 17:45:32 +02:00 committed by Michał Niewrzał
parent 3d9c217627
commit 4cc167a6bd
2 changed files with 11 additions and 11 deletions

View File

@ -149,7 +149,7 @@ func fullTableScanQueries(ctx context.Context, db *metabase.DB, applicationName
} }
switch { switch {
case strings.Contains(query, "WITH testing AS (SELECT _)"): case strings.Contains(query, "WITH ignore_full_scan_for_test AS (SELECT _)"):
continue continue
case !strings.Contains(strings.ToUpper(query), "WHERE"): // find smarter way to ignore known full table scan queries case !strings.Contains(strings.ToUpper(query), "WHERE"): // find smarter way to ignore known full table scan queries
continue continue

View File

@ -132,12 +132,12 @@ func (db *DB) TestingGetState(ctx context.Context) (_ *RawState, err error) {
// TestingDeleteAll deletes all objects and segments from the database. // TestingDeleteAll deletes all objects and segments from the database.
func (db *DB) TestingDeleteAll(ctx context.Context) (err error) { func (db *DB) TestingDeleteAll(ctx context.Context) (err error) {
_, err = db.db.ExecContext(ctx, ` _, err = db.db.ExecContext(ctx, `
WITH testing AS (SELECT 1) DELETE FROM objects; WITH ignore_full_scan_for_test AS (SELECT 1) DELETE FROM objects;
WITH testing AS (SELECT 1) DELETE FROM pending_objects; WITH ignore_full_scan_for_test AS (SELECT 1) DELETE FROM pending_objects;
WITH testing AS (SELECT 1) DELETE FROM segments; WITH ignore_full_scan_for_test AS (SELECT 1) DELETE FROM segments;
WITH testing AS (SELECT 1) DELETE FROM segment_copies; WITH ignore_full_scan_for_test AS (SELECT 1) DELETE FROM segment_copies;
WITH testing AS (SELECT 1) DELETE FROM node_aliases; WITH ignore_full_scan_for_test AS (SELECT 1) DELETE FROM node_aliases;
WITH testing AS (SELECT 1) SELECT setval('node_alias_seq', 1, false); WITH ignore_full_scan_for_test AS (SELECT 1) SELECT setval('node_alias_seq', 1, false);
`) `)
db.aliasCache = NewNodeAliasCache(db) db.aliasCache = NewNodeAliasCache(db)
return Error.Wrap(err) return Error.Wrap(err)
@ -148,7 +148,7 @@ func (db *DB) testingGetAllObjects(ctx context.Context) (_ []RawObject, err erro
objs := []RawObject{} objs := []RawObject{}
rows, err := db.db.QueryContext(ctx, ` rows, err := db.db.QueryContext(ctx, `
WITH testing AS (SELECT 1) WITH ignore_full_scan_for_test AS (SELECT 1)
SELECT SELECT
project_id, bucket_name, object_key, version, stream_id, project_id, bucket_name, object_key, version, stream_id,
created_at, expires_at, created_at, expires_at,
@ -210,7 +210,7 @@ func (db *DB) testingGetAllPendingObjects(ctx context.Context) (_ []RawPendingOb
objs := []RawPendingObject{} objs := []RawPendingObject{}
rows, err := db.db.QueryContext(ctx, ` rows, err := db.db.QueryContext(ctx, `
WITH testing AS (SELECT 1) WITH ignore_full_scan_for_test AS (SELECT 1)
SELECT SELECT
project_id, bucket_name, object_key, stream_id, project_id, bucket_name, object_key, stream_id,
created_at, expires_at, created_at, expires_at,
@ -261,7 +261,7 @@ func (db *DB) testingGetAllSegments(ctx context.Context) (_ []RawSegment, err er
segs := []RawSegment{} segs := []RawSegment{}
rows, err := db.db.QueryContext(ctx, ` rows, err := db.db.QueryContext(ctx, `
WITH testing AS (SELECT 1) WITH ignore_full_scan_for_test AS (SELECT 1)
SELECT SELECT
stream_id, position, stream_id, position,
created_at, repaired_at, expires_at, created_at, repaired_at, expires_at,
@ -331,7 +331,7 @@ func (db *DB) testingGetAllCopies(ctx context.Context) (_ []RawCopy, err error)
copies := []RawCopy{} copies := []RawCopy{}
rows, err := db.db.QueryContext(ctx, ` rows, err := db.db.QueryContext(ctx, `
WITH testing AS (SELECT 1) WITH ignore_full_scan_for_test AS (SELECT 1)
SELECT SELECT
stream_id, ancestor_stream_id stream_id, ancestor_stream_id
FROM segment_copies FROM segment_copies