diff options
author | Thomas Markwalder <tmark@isc.org> | 2024-04-18 20:33:11 +0200 |
---|---|---|
committer | Thomas Markwalder <tmark@isc.org> | 2024-04-22 13:24:32 +0200 |
commit | f04c101f64bbb3ee3bc7d16f78244bffad660a48 (patch) | |
tree | 5956fe0098ec598d1b63fe97fabcb138f26bfbdb /src/bin | |
parent | [#3125] Add ChangeLog for #3125 (diff) | |
download | kea-f04c101f64bbb3ee3bc7d16f78244bffad660a48.tar.xz kea-f04c101f64bbb3ee3bc7d16f78244bffad660a48.zip |
[#2957] Fix dhcp4_server_modification_ts index
src/share/database/scripts/pgsql/upgrade_020_to_021.sh.in
- new file, corrects dhcp4_server_modifcation_ts index
configure.ac
added src/share/database/scripts/pgsql/upgrade_020_to_021.sh
src/bin/admin/tests/pgsql_tests.sh.in
Added pgsql_upgrade_20_to_21_test()
src/lib/pgsql/pgsql_connection.h
Updated schema version
src/share/database/scripts/pgsql/.gitignore
src/share/database/scripts/pgsql/Makefile.am
Added upgrade_020_to_021.sh
src/share/database/scripts/pgsql/dhcpdb_create.pgsql
Added correction of dhcp4_server_modifcation_ts index
Diffstat (limited to 'src/bin')
-rw-r--r-- | src/bin/admin/tests/pgsql_tests.sh.in | 28 |
1 files changed, 24 insertions, 4 deletions
diff --git a/src/bin/admin/tests/pgsql_tests.sh.in b/src/bin/admin/tests/pgsql_tests.sh.in index 2f9404a774..f710bf8fbb 100644 --- a/src/bin/admin/tests/pgsql_tests.sh.in +++ b/src/bin/admin/tests/pgsql_tests.sh.in @@ -888,10 +888,27 @@ pgsql_upgrade_18_to_19_test() { } pgsql_upgrade_19_to_20_test() { - # For now this function only verifies version number. - version=$("${kea_admin}" db-version pgsql -u "${db_user}" -p "${db_password}" -n "${db_name}" -d "${db_scripts_dir}") - assert_str_eq "20.0" "${version}" 'Expected kea-admin to return %s, returned value was %s' + # Verify that lease6_by_sunet_id_address index on lease6 is keyed by + # attributes number 5 and 1 (i.e. subnet-id and address) + qry="select ix.indkey as keys from pg_class t, pg_class i, pg_index ix \ + where t.oid = ix.indrelid and i.oid = ix.indexrelid and \ + i.relname = 'lease6_by_subnet_id_address' and t.relname = 'lease6';" + run_statement "verify lease6_by_subnet_id_address" "$qry" + assert_eq 0 "${EXIT_CODE}" "${query}: expected %d, returned %d" + assert_str_eq '5 1' "${OUTPUT}" "${query}: expected output %s, returned %s" } + +pgsql_upgrade_20_to_21_test() { + # Verify that dhcp4_server_modification_ts index on dhcp4_server is keyed by + # attribute number 4, modification_ts + qry="select ix.indkey as keys from pg_class t, pg_class i, pg_index ix \ + where t.oid = ix.indrelid and i.oid = ix.indexrelid and \ + i.relname = 'dhcp4_server_modification_ts' and t.relname = 'dhcp4_server';" + run_statement "verify lease6_by_subnet_id_address" "$qry" + assert_eq 0 "${EXIT_CODE}" "${query}: expected %d, returned %d" + assert_str_eq '4' "${OUTPUT}" "${query}: expected output %s, returned %s" +} + pgsql_upgrade_test() { test_start "pgsql.upgrade" @@ -910,7 +927,7 @@ pgsql_upgrade_test() { # Verify upgraded schema reports the latest version. version=$("${kea_admin}" db-version pgsql -u "${db_user}" -p "${db_password}" -n "${db_name}" -d "${db_scripts_dir}") - assert_str_eq "20.0" "${version}" 'Expected kea-admin to return %s, returned value was %s' + assert_str_eq "21.0" "${version}" 'Expected kea-admin to return %s, returned value was %s' # Check 1.0 to 2.0 upgrade pgsql_upgrade_1_0_to_2_0_test @@ -966,6 +983,9 @@ pgsql_upgrade_test() { # Check 19 to 20 upgrade pgsql_upgrade_19_to_20_test + # Check 20 to 21 upgrade + pgsql_upgrade_20_to_21_test + # Let's wipe the whole database pgsql_wipe |