Commit 9591b8fa authored by Francis Dupont's avatar Francis Dupont

[5584] Addressed comments

parent e0216b1d
......@@ -1502,7 +1502,7 @@ AC_CONFIG_FILES([Makefile
src/share/database/scripts/mysql/upgrade_5.0_to_5.1.sh
src/share/database/scripts/mysql/upgrade_5.1_to_5.2.sh
src/share/database/scripts/mysql/upgrade_5.2_to_6.0.sh
src/share/database/scripts/mysql/upgrade_6.0_to_6.1.sh
src/share/database/scripts/mysql/upgrade_6.0_to_7.0.sh
src/share/database/scripts/pgsql/Makefile
src/share/database/scripts/pgsql/upgrade_1.0_to_2.0.sh
src/share/database/scripts/pgsql/upgrade_2.0_to_3.0.sh
......@@ -1510,7 +1510,7 @@ AC_CONFIG_FILES([Makefile
src/share/database/scripts/pgsql/upgrade_3.1_to_3.2.sh
src/share/database/scripts/pgsql/upgrade_3.2_to_3.3.sh
src/share/database/scripts/pgsql/upgrade_3.3_to_4.0.sh
src/share/database/scripts/pgsql/upgrade_4.0_to_4.1.sh
src/share/database/scripts/pgsql/upgrade_4.0_to_5.0.sh
tools/Makefile
tools/path_replacer.sh
])
......
address,duid,valid_lifetime,expire,subnet_id,pref_lifetime,lease_type,iaid,prefix_len,fqdn_fwd,fqdn_rev,hostname,state,user_context,hwaddr,hwtype,hwaddr_source
10,20,30,<timestamp1>,40,50,IA_TA,60,70,1,1,one.example.com,default,,80,90,HWADDR_SOURCE_REMOTE_ID
11,,30,<timestamp2>,40,50,IA_TA,60,70,1,1,,declined,,80,90,HWADDR_SOURCE_RAW
12,21,30,<timestamp3>,40,50,IA_TA,60,70,1,1,three.example.com,expired-reclaimed,,80,90,HWADDR_SOURCE_DUID
address,duid,valid_lifetime,expire,subnet_id,pref_lifetime,lease_type,iaid,prefix_len,fqdn_fwd,fqdn_rev,hostname,state,hwaddr,hwtype,hwaddr_source,user_context
10,20,30,<timestamp1>,40,50,IA_TA,60,70,1,1,one.example.com,default,80,90,HWADDR_SOURCE_REMOTE_ID,
11,,30,<timestamp2>,40,50,IA_TA,60,70,1,1,,declined,80,90,HWADDR_SOURCE_RAW,
12,21,30,<timestamp3>,40,50,IA_TA,60,70,1,1,three.example.com,expired-reclaimed,80,90,HWADDR_SOURCE_DUID,
......@@ -258,7 +258,7 @@ mysql_upgrade_test() {
assert_str_eq "1.0" ${version} "Expected kea-admin to return %s, returned value was %s"
# Ok, we have a 1.0 database. Let's upgrade it to 6.1
# Ok, we have a 1.0 database. Let's upgrade it to 7.0
${keaadmin} lease-upgrade mysql -u $db_user -p $db_password -n $db_name -d $db_scripts_dir
ERRCODE=$?
......@@ -449,7 +449,7 @@ EOF
# lease4/6_stats changes are tested separately
#table: user_context to lease4 and lease6 (upgrade 6.0 -> 6.1)
#table: user_context to lease4 and lease6 (upgrade 6.0 -> 7.0)
# verify that lease4 table includes user_context
qry="select user_context from lease4";
count=`mysql_execute "${qry}"`
......@@ -462,16 +462,16 @@ EOF
ERRCODE=$?
assert_eq 0 $ERRCODE "select user_context from lease6 failed. (expected status code %d, returned %d)"
#table: logs (upgrade 6.0 -> 6.1)
#table: logs (upgrade 6.0 -> 7.0)
mysql -u$db_user -p$db_password $db_name >/dev/null 2>&1 <<EOF
SELECT timestamp, address, log FROM logs;
EOF
ERRCODE=$?
assert_eq 0 $ERRCODE "logs table is missing or broken. (expected status code %d, returned %d)"
# Verify upgraded schema reports version 6.1
# Verify upgraded schema reports version 7.0
version=$(${keaadmin} lease-version mysql -u $db_user -p $db_password -n $db_name -d $db_scripts_dir)
assert_str_eq "6.1" ${version} "Expected kea-admin to return %s, returned value was %s"
assert_str_eq "7.0" ${version} "Expected kea-admin to return %s, returned value was %s"
# Let's wipe the whole database
......
......@@ -120,7 +120,7 @@ pgsql_lease_version_test() {
# Verify that kea-admin lease-version returns the correct version
version=$(${keaadmin} lease-version pgsql -u $db_user -p $db_password -n $db_name)
assert_str_eq "4.1" ${version} "Expected kea-admin to return %s, returned value was %s"
assert_str_eq "5.0" ${version} "Expected kea-admin to return %s, returned value was %s"
# Let's wipe the whole database
pgsql_wipe
......@@ -230,10 +230,10 @@ pgsql_upgrade_2_0_to_3_0() {
assert_eq 1 "$output" "lease_hwaddr_source does not contain entry for HWADDR_SOURCE_UNKNOWN. (record count %d, expected %d)"
}
pgsql_upgrade_3_0_to_4_1() {
# Verify upgraded schema reports version 4.1.
pgsql_upgrade_3_0_to_5_0() {
# Verify upgraded schema reports version 5.0.
version=$(${keaadmin} lease-version pgsql -u $db_user -p $db_password -n $db_name -d $db_scripts_dir)
assert_str_eq "4.1" ${version} "Expected kea-admin to return %s, returned value was %s"
assert_str_eq "5.0" ${version} "Expected kea-admin to return %s, returned value was %s"
# Added user_context to lease4
output=`pgsql_execute "select user_context from lease4;"`
......@@ -270,8 +270,8 @@ pgsql_upgrade_test() {
# Check 2.0 to 3.0 upgrade
pgsql_upgrade_2_0_to_3_0
# Check 3.0 to 4.1 upgrade
pgsql_upgrade_3_0_to_4_1
# Check 3.0 to 5.0 upgrade
pgsql_upgrade_3_0_to_5_0
# Let's wipe the whole database
pgsql_wipe
......
......@@ -40,8 +40,8 @@ extern const int MLM_MYSQL_FETCH_FAILURE;
/// @name Current database schema version values.
//@{
const uint32_t MYSQL_SCHEMA_VERSION_MAJOR = 6;
const uint32_t MYSQL_SCHEMA_VERSION_MINOR = 1;
const uint32_t MYSQL_SCHEMA_VERSION_MAJOR = 7;
const uint32_t MYSQL_SCHEMA_VERSION_MINOR = 0;
//@}
......
......@@ -17,9 +17,9 @@
namespace isc {
namespace dhcp {
/// @brief Define PostgreSQL backend version: 4.1
const uint32_t PG_SCHEMA_VERSION_MAJOR = 4;
const uint32_t PG_SCHEMA_VERSION_MINOR = 1;
/// @brief Define PostgreSQL backend version: 5.0
const uint32_t PG_SCHEMA_VERSION_MAJOR = 5;
const uint32_t PG_SCHEMA_VERSION_MINOR = 0;
// Maximum number of parameters that can be used a statement
// @todo This allows us to use an initializer list (since we can't
......
......@@ -11,7 +11,7 @@ sqlscripts_DATA += upgrade_4.1_to_5.0.sh
sqlscripts_DATA += upgrade_5.0_to_5.1.sh
sqlscripts_DATA += upgrade_5.1_to_5.2.sh
sqlscripts_DATA += upgrade_5.2_to_6.0.sh
sqlscripts_DATA += upgrade_6.0_to_6.1.sh
sqlscripts_DATA += upgrade_6.0_to_7.0.sh
DISTCLEANFILES = upgrade_1.0_to_2.0.sh
DISTCLEANFILES += upgrade_2.0_to_3.0.sh
......@@ -21,6 +21,6 @@ DISTCLEANFILES += upgrade_4.1_to_5.0.sh
DISTCLEANFILES += upgrade_5.0_to_5.1.sh
DISTCLEANFILES += upgrade_5.1_to_5.2.sh
DISTCLEANFILES += upgrade_5.2_to_6.0.sh
DISTCLEANFILES += upgrade_6.0_to_6.1.sh
DISTCLEANFILES += upgrade_6.0_to_7.0.sh
EXTRA_DIST = ${sqlscripts_DATA}
......@@ -764,9 +764,9 @@ CREATE INDEX timestamp_index ON logs (timestamp);
# Update the schema version number
UPDATE schema_version
SET version = '6', minor = '1';
SET version = '7', minor = '0';
# This line concludes database upgrade to version 6.1.
# This line concludes database upgrade to version 7.0.
# Notes:
#
......
......@@ -11,7 +11,7 @@ fi
VERSION=`mysql_version "$@"`
if [ "$VERSION" != "6.0" ]; then
printf "This script upgrades 6.0 to 6.1. Reported version is $VERSION. Skipping upgrade.\n"
printf "This script upgrades 6.0 to 7.0. Reported version is $VERSION. Skipping upgrade.\n"
exit 0
fi
......@@ -104,9 +104,9 @@ CREATE INDEX timestamp_index ON logs (timestamp);
# Update the schema version number
UPDATE schema_version
SET version = '6', minor = '1';
SET version = '7', minor = '0';
# This line concludes database upgrade to version 6.1.
# This line concludes database upgrade to version 7.0.
EOF
......
......@@ -9,7 +9,7 @@ sqlscripts_DATA += upgrade_3.0_to_3.1.sh
sqlscripts_DATA += upgrade_3.1_to_3.2.sh
sqlscripts_DATA += upgrade_3.2_to_3.3.sh
sqlscripts_DATA += upgrade_3.3_to_4.0.sh
sqlscripts_DATA += upgrade_4.0_to_4.1.sh
sqlscripts_DATA += upgrade_4.0_to_5.0.sh
DISTCLEANFILES = upgrade_1.0_to_2.0.sh
DISTCLEANFILES += upgrade_2.0_to_3.0.sh
......@@ -17,6 +17,6 @@ DISTCLEANFILES += upgrade_3.0_to_3.1.sh
DISTCLEANFILES += upgrade_3.1_to_3.2.sh
DISTCLEANFILES += upgrade_3.2_to_3.3.sh
DISTCLEANFILES += upgrade_3.3_to_4.0.sh
DISTCLEANFILES += upgrade_4.0_to_4.1.sh
DISTCLEANFILES += upgrade_4.0_to_5.0.sh
EXTRA_DIST = ${sqlscripts_DATA}
......@@ -754,7 +754,7 @@ UPDATE schema_version
-- Schema 4.0 specification ends here.
-- Upgrade to schema 4.1 begins here:
-- Upgrade to schema 5.0 begins here:
-- Add a column holding leases for user context.
ALTER TABLE lease4 ADD COLUMN user_context TEXT;
......@@ -802,7 +802,7 @@ $$ LANGUAGE SQL;
--
DROP FUNCTION IF EXISTS lease6DumpHeader();
CREATE FUNCTION lease6DumpHeader() RETURNS text AS $$
select cast('address,duid,valid_lifetime,expire,subnet_id,pref_lifetime,lease_type,iaid,prefix_len,fqdn_fwd,fqdn_rev,hostname,state,user_context,hwaddr,hwtype,hwaddr_source' as text) as result;
select cast('address,duid,valid_lifetime,expire,subnet_id,pref_lifetime,lease_type,iaid,prefix_len,fqdn_fwd,fqdn_rev,hostname,state,hwaddr,hwtype,hwaddr_source,user_context' as text) as result;
$$ LANGUAGE SQL;
--
......@@ -823,10 +823,10 @@ CREATE FUNCTION lease6DumpData() RETURNS
fqdn_rev int,
hostname text,
state text,
user_context text,
hwaddr text,
hwtype smallint,
hwaddr_source text
hwaddr_source text,
user_context text
) AS $$
SELECT (l.address,
encode(l.duid,'hex'),
......@@ -841,10 +841,11 @@ CREATE FUNCTION lease6DumpData() RETURNS
l.fqdn_rev::int,
l.hostname,
s.name,
l.user_context,
encode(l.hwaddr,'hex'),
l.hwtype,
h.name
h.name,
l.user_context
)
FROM lease6 l
left outer join lease6_types t on (l.lease_type = t.lease_type)
......@@ -866,11 +867,11 @@ CREATE TABLE logs (
CREATE INDEX timestamp_id ON logs (timestamp);
CREATE INDEX address_id ON logs (address);
-- Set 4.1 schema version.
-- Set 5.0 schema version.
UPDATE schema_version
SET version = '4', minor = '1';
SET version = '5', minor = '0';
-- Schema 4.1 specification ends here.
-- Schema 5.0 specification ends here.
-- Commit the script transaction.
COMMIT;
......
......@@ -11,7 +11,7 @@ fi
VERSION=`pgsql_version "$@"`
if [ "$VERSION" != "4.0" ]; then
printf "This script upgrades 4.0 to 4.1. Reported version is $VERSION. Skipping upgrade.\n"
printf "This script upgrades 4.0 to 5.0. Reported version is $VERSION. Skipping upgrade.\n"
exit 0
fi
......@@ -68,7 +68,7 @@ CREATE FUNCTION lease4DumpData() RETURNS
-- FUNCTION that returns a result set containing the column names for lease6 dumps
DROP FUNCTION IF EXISTS lease6DumpHeader();
CREATE FUNCTION lease6DumpHeader() RETURNS text AS \$\$
select cast('address,duid,valid_lifetime,expire,subnet_id,pref_lifetime,lease_type,iaid,prefix_len,fqdn_fwd,fqdn_rev,hostname,state,user_context,hwaddr,hwtype,hwaddr_source' as text) as result;
select cast('address,duid,valid_lifetime,expire,subnet_id,pref_lifetime,lease_type,iaid,prefix_len,fqdn_fwd,fqdn_rev,hostname,state,hwaddr,hwtype,hwaddr_source,user_context' as text) as result;
\$\$ LANGUAGE SQL;
--
......@@ -90,10 +90,10 @@ CREATE FUNCTION lease6DumpData() RETURNS
fqdn_rev int,
hostname text,
state text,
user_context text,
hwaddr text,
hwtype smallint,
hwaddr_source text
hwaddr_source text,
user_context text
) AS \$\$
SELECT (l.address,
encode(l.duid,'hex'),
......@@ -108,10 +108,10 @@ CREATE FUNCTION lease6DumpData() RETURNS
l.fqdn_rev::int,
l.hostname,
s.name,
l.user_context,
encode(l.hwaddr,'hex'),
l.hwtype,
h.name
h.name,
l.user_context
)
FROM lease6 l
left outer join lease6_types t on (l.lease_type = t.lease_type)
......@@ -133,11 +133,11 @@ CREATE TABLE logs (
CREATE INDEX timestamp_id ON logs (timestamp);
CREATE INDEX address_id ON logs (address);
-- Set 4.1 schema version.
-- Set 5.0 schema version.
UPDATE schema_version
SET version = '4', minor = '1';
SET version = '5', minor = '0';
-- Schema 4.1 specification ends here.
-- Schema 5.0 specification ends here.
-- Commit the script transaction
COMMIT;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment