terraform-provider-yandex icon indicating copy to clipboard operation
terraform-provider-yandex copied to clipboard

Multiple error with MDBs PostgreSQL and extension shared libraries

Open Asgoret opened this issue 2 years ago • 4 comments

Hi. There is multiple errors with mdbs part.

  1. If u doesn't set up shared library in first place, U can't install extentions at databases. Code:
resource "yandex_mdb_postgresql_cluster" "<test>" {
  name        = "<test>"
  environment = "PRESTABLE"
  network_id  = data.yandex_vpc_network.<some_Network>.id
  security_group_ids = [yandex_vpc_security_group.<test>.id]

  config {
    version = 15
    resources {
      resource_preset_id = "s2.micro"
      disk_type_id       = "network-ssd"
      disk_size          = 16
    }
    access {
        data_lens = true
    }
    performance_diagnostics {
        enabled = true
        sessions_sampling_interval = "600"
        statements_sampling_interval = "600"
    }
  }

Error: InvalidArgument desc = The specified extension 'pg_cron' is not present in shared_preload_libraries. If u add shared_preload_libraries = "SHARED_PRELOAD_LIBRARIES_PG_CRON" after cluster created nothing changes. Same error. 2) pg_hint is present in documentation, example, and code Documentation:

image

Code (source: yandex/cloud/mdb/postgresql/v1/config/postgresql15.proto):

const (
	PostgresqlConfig15_SHARED_PRELOAD_LIBRARIES_UNSPECIFIED  PostgresqlConfig15_SharedPreloadLibraries = 0
	PostgresqlConfig15_SHARED_PRELOAD_LIBRARIES_AUTO_EXPLAIN PostgresqlConfig15_SharedPreloadLibraries = 1
	PostgresqlConfig15_SHARED_PRELOAD_LIBRARIES_PG_HINT_PLAN PostgresqlConfig15_SharedPreloadLibraries = 2 <<<< Here
	PostgresqlConfig15_SHARED_PRELOAD_LIBRARIES_TIMESCALEDB  PostgresqlConfig15_SharedPreloadLibraries = 3
	PostgresqlConfig15_SHARED_PRELOAD_LIBRARIES_PG_QUALSTATS PostgresqlConfig15_SharedPreloadLibraries = 4
	PostgresqlConfig15_SHARED_PRELOAD_LIBRARIES_PG_CRON      PostgresqlConfig15_SharedPreloadLibraries = 5
)

// Enum value maps for PostgresqlConfig15_SharedPreloadLibraries.
var (
	PostgresqlConfig15_SharedPreloadLibraries_name = map[int32]string{
		0: "SHARED_PRELOAD_LIBRARIES_UNSPECIFIED",
		1: "SHARED_PRELOAD_LIBRARIES_AUTO_EXPLAIN",
		2: "SHARED_PRELOAD_LIBRARIES_PG_HINT_PLAN", <<<< Here
		3: "SHARED_PRELOAD_LIBRARIES_TIMESCALEDB",
		4: "SHARED_PRELOAD_LIBRARIES_PG_QUALSTATS",
		5: "SHARED_PRELOAD_LIBRARIES_PG_CRON",
	}
	PostgresqlConfig15_SharedPreloadLibraries_value = map[string]int32{
		"SHARED_PRELOAD_LIBRARIES_UNSPECIFIED":  0,
		"SHARED_PRELOAD_LIBRARIES_AUTO_EXPLAIN": 1,
		"SHARED_PRELOAD_LIBRARIES_PG_HINT_PLAN": 2, <<<< Here
		"SHARED_PRELOAD_LIBRARIES_TIMESCALEDB":  3,
		"SHARED_PRELOAD_LIBRARIES_PG_QUALSTATS": 4,
		"SHARED_PRELOAD_LIBRARIES_PG_CRON":      5,
	}
)

Still u get error:

configSpec.postgresqlConfig_15.sharedPreloadLibraries.0: Invalid value 'SHARED_PRELOAD_LIBRARIES_PG_HINT_PLAN', allowed values: 
SHARED_PRELOAD_LIBRARIES_AUTO_EXPLAIN, 
SHARED_PRELOAD_LIBRARIES_PGAUDIT, 
SHARED_PRELOAD_LIBRARIES_PG_CRON, 
SHARED_PRELOAD_LIBRARIES_PG_QUALSTATS

Asgoret avatar Dec 13 '22 18:12 Asgoret

Workaround for issue 1 (from YC technical support):

  1. Setup MDB PSQL with shared library, but without extension on database
  2. Uncomment extension in database and re-run terraform

Asgoret avatar Dec 29 '22 10:12 Asgoret

Having the same issue but with timescaledb on pg 16

elja avatar Jul 17 '24 08:07 elja