]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
[392-search-of-reservations-by-hostname] Addressed some comments
authorFrancis Dupont <fdupont@isc.org>
Mon, 14 Oct 2019 14:30:18 +0000 (16:30 +0200)
committerFrancis Dupont <fdupont@isc.org>
Tue, 15 Oct 2019 09:45:32 +0000 (11:45 +0200)
doc/sphinx/arm/admin.rst
src/lib/dhcpsrv/base_host_data_source.h
src/lib/dhcpsrv/cql_host_data_source.h
src/lib/dhcpsrv/host_container.h
src/lib/dhcpsrv/mysql_host_data_source.h
src/lib/dhcpsrv/pgsql_host_data_source.h

index 1fe978f7a0e349ab869db94a066329f82ab3cee6..f584381b373660de4fc5178edb83948c84b1be46 100644 (file)
@@ -321,6 +321,25 @@ earlier version. To perform an upgrade, issue the following command:
 
    $ kea-admin db-upgrade mysql -u database-user -p database-password -n database-name
 
+.. note::
+
+    To search host reservations by hostname it is critical the collation of
+    the hostname column in the host table to be case-insensitive. Fortunately
+    the default collation in MySQL is case-insensitive. You can verify this
+    on your MySQL installation by:
+
+    .. code-block:: mysql
+
+      mysql> SELECT COLLATION('');
+      +-----------------+
+      | COLLATION('')   |
+      +-----------------+
+      | utf8_general_ci |
+      +-----------------+
+
+    According to the naming of collations when the name finishes by ``_ci``
+    the collation is case-insensitive.
+
 .. _pgsql-database:
 
 PostgreSQL
index cb594811407f5afd08164370300fe3a59da7c5fd..b7c6af6b4f2770cd35fae6bccb151877ac5e66cf 100644 (file)
@@ -141,6 +141,10 @@ public:
     /// This method returns all @c Host objects which represent reservations
     /// using a specified hostname.
     ///
+    /// @note: as hostnames are case-insensitive the search key is given
+    /// in lower cases, search indexes should either be case-insensitive
+    /// or be case-sensitive using the lower case version of hostnames.
+    ///
     /// @param hostname The lower case hostname.
     ///
     /// @return Collection of const @c Host objects.
index c90e3b1f559698a07fa3913a4ed9d37065a01b36..a4be71b1593878a917636d2113ff0123b77ed1aa 100644 (file)
@@ -198,6 +198,8 @@ public:
     /// This method returns all @c Host objects which represent reservations
     /// using a specified hostname.
     ///
+    /// Cassandra uses the new indexed lower_case_hostname column.
+    ///
     /// @param hostname The lower case hostname.
     ///
     /// @return Collection of const @c Host objects.
index 55692cf25d3714840d214de6da2a70c5f8d4dc96..113f4b8b139fc760e62ad2cc891aaf3ffb709877 100644 (file)
@@ -91,6 +91,7 @@ typedef boost::multi_index_container<
         >,
 
         // Sixth index is used to search for the host using hostname
+        // (case-sensitive compare so the key is in lower case).
         boost::multi_index::ordered_non_unique<
             // Index using values returned by the @c Host::getLowerHostname
             boost::multi_index::const_mem_fun<Host, std::string,
index 759f3304fa8f0928ff032dc60c180e889d6bdb8c..450ebfd591b8069e85732d7122305827374804e4 100644 (file)
@@ -158,6 +158,8 @@ public:
     /// This method returns all @c Host objects which represent reservations
     /// using a specified hostname.
     ///
+    /// MySQL uses the case-insensitive hosts_by_hostname index on hostname.
+    ///
     /// @param hostname The lower case hostname.
     ///
     /// @return Collection of const @c Host objects.
index 29711e13a62b0c25c7c6fa31b140c4b554811684..4b4a662784d4d3757b095c8432515c163ce09a0f 100644 (file)
@@ -187,6 +187,8 @@ public:
     /// This method returns all @c Host objects which represent reservations
     /// using a specified hostname.
     ///
+    /// PostgreSQL uses the hosts_by_hostname index on LOWER(hostname).
+    ///
     /// @param hostname The lower case hostname.
     ///
     /// @return Collection of const @c Host objects.