]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
[3968] Added ASC sorting for indexes by expiration.
authorMarcin Siodelski <marcin@isc.org>
Thu, 15 Oct 2015 19:48:01 +0000 (21:48 +0200)
committerMarcin Siodelski <marcin@isc.org>
Thu, 15 Oct 2015 19:48:01 +0000 (21:48 +0200)
src/bin/admin/scripts/mysql/dhcpdb_create.mysql
src/bin/admin/scripts/mysql/upgrade_3.0_to_4.0.sh.in
src/lib/dhcpsrv/mysql_lease_mgr.cc
src/lib/dhcpsrv/tests/schema_mysql_copy.h

index cdcc46ac7ac52103838aa858be10363608ec5753..ad85cb59df5e4b6f60d7bb25bbca796486e82ccb 100755 (executable)
@@ -265,8 +265,8 @@ ALTER TABLE lease6
 # by the expiration time. One of the applications is to retrieve all
 # expired leases. However, these indexes can be also used to retrieve
 # leases in a given state regardless of the expiration time.
-CREATE INDEX lease4_by_state_expire ON lease4 (state, expire);
-CREATE INDEX lease6_by_state_expire ON lease6 (state, expire);
+CREATE INDEX lease4_by_state_expire ON lease4 (state ASC, expire ASC);
+CREATE INDEX lease6_by_state_expire ON lease6 (state ASC, expire ASC);
 
 # Create table holding mapping of the lease states to their names.
 # This is not used in queries from the DHCP server but rather in
index ae18cb83a1f11739f57d93424eef45c6df9b3920..a63626d314806a805384756480b49453407f5329 100755 (executable)
@@ -28,8 +28,8 @@ ALTER TABLE lease6
 # by the expiration time. One of the applications is to retrieve all
 # expired leases. However, these indexes can be also used to retrieve
 # leases in a given state regardless of the expiration time.
-CREATE INDEX lease4_by_state_expire ON lease4 (state, expire);
-CREATE INDEX lease6_by_state_expire ON lease6 (state, expire);
+CREATE INDEX lease4_by_state_expire ON lease4 (state ASC, expire ASC);
+CREATE INDEX lease6_by_state_expire ON lease6 (state ASC, expire ASC);
 
 # Create table holding mapping of the lease states to their names.
 # This is not used in queries from the DHCP server but rather in
index 7308ce3d489f968cfc06541de98ff3b81e7bad44..4a7826800f5a5d6691ce0fac06240869a217d340 100755 (executable)
@@ -143,7 +143,7 @@ TaggedStatement tagged_statements[] = {
                         "state "
                             "FROM lease4 "
                             "WHERE state != ? AND expire < ? "
-                            "ORDER BY expire "
+                            "ORDER BY expire ASC "
                             "LIMIT ?"},
     {MySqlLeaseMgr::GET_LEASE6_ADDR,
                     "SELECT address, duid, valid_lifetime, "
@@ -182,7 +182,7 @@ TaggedStatement tagged_statements[] = {
                         "state "
                             "FROM lease6 "
                             "WHERE state != ? AND expire < ? "
-                            "ORDER BY expire "
+                            "ORDER BY expire ASC "
                             "LIMIT ?"},
     {MySqlLeaseMgr::GET_VERSION,
                     "SELECT version, minor FROM schema_version"},
index ba32dd7212f871ed23e159055b336e0c32bfe991..f21ccee7ff062315cbd7be17443a0b1098eb2f5d 100755 (executable)
@@ -220,8 +220,8 @@ const char* create_statement[] = {
     "ALTER TABLE lease6 "
         "ADD COLUMN state INT UNSIGNED DEFAULT 0",
 
-    "CREATE INDEX lease4_by_state_expire ON lease4 (state, expire)",
-    "CREATE INDEX lease6_by_state_expire ON lease6 (state, expire)",
+    "CREATE INDEX lease4_by_state_expire ON lease4 (state ASC, expire ASC)",
+    "CREATE INDEX lease6_by_state_expire ON lease6 (state ASC, expire ASC)",
 
     // Production schema includes the lease_state table and
     // lease_hwaddr_source tables which map to the values in lease4