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

[Voyager] Assess Migration fails if pg_stat_statements is created in a non public schema #1864

Open
1 task done
shubham-yb opened this issue Nov 8, 2024 · 0 comments
Open
1 task done

Comments

@shubham-yb
Copy link
Contributor

shubham-yb commented Nov 8, 2024

Jira Link: DB-13958

Description

if the user creates the pg_stat_statements extension in some schema other than public, assess migration command will fail with:
ERROR: relation "pg_stat_statements" does not exist

This is because we check for the existence of the pg_stat_statements extension in the entire database and not in any particular schema. Once this check goes through, we run the metadata queries on the public schema. This is where the command fails.

Example:

postgres=# set search_path to schema2;
SET
postgres=# create extension pg_stat_statements;
CREATE EXTENSION
postgres=# set search_path to public;
SET

postgres=# SELECT 1 FROM pg_extension WHERE extname = 'pg_stat_statements';
 ?column? 
----------
        1
(1 row)

postgres=# CREATE TEMP TABLE temp_table AS
SELECT
    queryid,
    query
FROM
    pg_stat_statements
WHERE
    dbid = (SELECT oid FROM pg_database WHERE datname = current_database());
ERROR:  relation "pg_stat_statements" does not exist
LINE 6:     pg_stat_statements
            ^

Complete command error:

yb-voyager assess-migration --export-dir ${EXPORT_DIR}         --source-db-type ${SOURCE_DB_TYPE}         --source-db-host ${SOURCE_DB_HOST}         --source-db-user ${SOURCE_DB_USER}         --source-db-schema ${SOURCE_DB_SCHEMA}         --source-db-password ${SOURCE_DB_PASSWORD}         --source-db-name ${SOURCE_DB_NAME} --start-clean t --yes --iops-capture-interval 1
migrationID: 4389dc4c-f88a-4455-bac7-91f1e59179d1
gathering metadata and stats from 'postgresql' source database...
sleep interval for calculating iops: 1 seconds
Assessment metadata collection started for ''public|schema2'' schemas
Collecting db queries summary...
psql:/etc/yb-voyager/gather-assessment-metadata/postgresql/db-queries-summary.psql:8: ERROR:  relation "pg_stat_statements" does not exist
LINE 6:     pg_stat_statements
            ^
command failed: psql -q 'postgresql://postgres@localhost:5432/postgres' -f /etc/yb-voyager/gather-assessment-metadata/postgresql/db-queries-summary.psql -v schema_list='public|schema2' -v ON_ERROR_STOP=on
failed to assess migration: failed to gather assessment metadata: error gathering metadata and stats from source PG database: error waiting for gather assessment metadata script to complete: exit status 1

Issue Type

kind/bug

Warning: Please confirm that this issue does not contain any sensitive information

  • I confirm this issue does not contain any sensitive information.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants