]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
[#1434] renamed members and functions
authorRazvan Becheriu <razvan@isc.org>
Wed, 21 Oct 2020 15:23:42 +0000 (18:23 +0300)
committerRazvan Becheriu <razvan@isc.org>
Thu, 22 Oct 2020 14:47:14 +0000 (17:47 +0300)
17 files changed:
ChangeLog
src/hooks/dhcp/high_availability/ha_service.cc
src/hooks/dhcp/lease_cmds/lease_cmds.cc
src/hooks/dhcp/lease_cmds/tests/lease_cmds_unittest.cc
src/lib/dhcpsrv/cql_lease_mgr.cc
src/lib/dhcpsrv/cql_lease_mgr.h
src/lib/dhcpsrv/lease.cc
src/lib/dhcpsrv/lease.h
src/lib/dhcpsrv/memfile_lease_mgr.cc
src/lib/dhcpsrv/memfile_lease_mgr.h
src/lib/dhcpsrv/mysql_lease_mgr.cc
src/lib/dhcpsrv/mysql_lease_mgr.h
src/lib/dhcpsrv/pgsql_lease_mgr.cc
src/lib/dhcpsrv/pgsql_lease_mgr.h
src/lib/dhcpsrv/tests/alloc_engine6_unittest.cc
src/lib/dhcpsrv/tests/generic_lease_mgr_unittest.cc
src/lib/dhcpsrv/tests/lease_unittest.cc

index 76fd1d3fa72ffa56cd2912cebdb551a728515dbb..cf1db1cc1334000af39fe40df21933a22bb74e1f 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,10 +1,10 @@
 1820.  [bug]           razvan
-       Fixed lease update when using hooks with database backend.
-       Previously, HA updates were rejected because the database
-       backend rejects operations on the lease if lease old expire
-       is different than what is already stored, to act as a
-       protection mechanism for parallel updates from several threads
-       or processes.
+       Fixed lease update when using HA and lease_cmds hooks with
+       database backend. Previously, HA updates were rejected because
+       the database backend rejects operations on the lease if the old
+       expiration time is different than what it is already stored, to
+       act as a protection mechanism for parallel updates from several
+       threads or processes.
        (Gitlab #1434)
 
 1819.  [func]          fdupont
index cb225b38e26a5d4abeb8cd7fd918769069932f59..54e0d50690b569a85ed3ad1010f6bb80838148d5 100644 (file)
@@ -1699,10 +1699,10 @@ HAService::asyncSyncLeasesInternal(http::HttpClient& http_client,
                                 } else if (existing_lease->cltt_ < lease->cltt_) {
                                     // If the existing lease is older than the fetched lease, update
                                     // the lease in our local database.
-                                    // Update lease old expire with value received from the database.
-                                    // Some database backends reject operations on the lease if the
-                                    // old expire value does not match what is stored.
-                                    Lease::syncExistingLifetime(*existing_lease, *lease);
+                                    // Update lease current expiration time with value received from the
+                                    // database. Some database backends reject operations on the lease if
+                                    // the current expiration time value does not match what is stored.
+                                    Lease::syncCurrentExpirationTime(*existing_lease, *lease);
                                     LeaseMgrFactory::instance().updateLease4(lease);
 
                                 } else {
@@ -1732,10 +1732,10 @@ HAService::asyncSyncLeasesInternal(http::HttpClient& http_client,
                                 } else if (existing_lease->cltt_ < lease->cltt_) {
                                     // If the existing lease is older than the fetched lease, update
                                     // the lease in our local database.
-                                    // Update lease old expire with value received from the database.
-                                    // Some database backends reject operations on the lease if the
-                                    // old expire value does not match what is stored.
-                                    Lease::syncExistingLifetime(*existing_lease, *lease);
+                                    // Update lease current expiration time with value received from the
+                                    // database. Some database backends reject operations on the lease if
+                                    // the current expiration time value does not match what is stored.
+                                    Lease::syncCurrentExpirationTime(*existing_lease, *lease);
                                     LeaseMgrFactory::instance().updateLease6(lease);
 
                                 } else {
index a85a9e65c298ed153bfa373d286cfc1de8946825..d11788c0ed631078d6d1f75fadfecd6dcedc2ff4 100644 (file)
@@ -655,10 +655,10 @@ LeaseCmdsImpl::addOrUpdate4(Lease4Ptr lease, bool force_create) {
         return (true);
     }
     if (existing) {
-        // Update lease old expire with value received from the database.
-        // Some database backends reject operations on the lease if the
-        // old expire value does not match what is stored.
-        Lease::syncExistingLifetime(*existing, *lease);
+        // Update lease current expiration time with value received from the
+        // database. Some database backends reject operations on the lease if
+        // the current expiration time value does not match what is stored.
+        Lease::syncCurrentExpirationTime(*existing, *lease);
     }
     try {
         LeaseMgrFactory::instance().updateLease4(lease);
@@ -687,10 +687,10 @@ LeaseCmdsImpl::addOrUpdate6(Lease6Ptr lease, bool force_create) {
         return (true);
     }
     if (existing) {
-        // Update lease old expire with value received from the database.
-        // Some database backends reject operations on the lease if the
-        // old expire value does not match what is stored.
-        Lease::syncExistingLifetime(*existing, *lease);
+        // Update lease current expiration time with value received from the
+        // database. Some database backends reject operations on the lease if
+        // the current expiration time value does not match what is stored.
+        Lease::syncCurrentExpirationTime(*existing, *lease);
     }
     try {
         LeaseMgrFactory::instance().updateLease6(lease);
index d9df18bb70d4d826183571f29b41fc2958486524..214eef12fd1a8d981f9f06c0189d936d68c7cfa5 100644 (file)
@@ -417,7 +417,7 @@ public:
         // expiration time is cast properly.
         lease->valid_lft_ = HIGH_VALID_LIFETIME; // Very high valid lifetime
         lease->cltt_ = DEC_2030_TIME; // December 11th 2030
-        lease->updateExistingLifetime();
+        lease->updateCurrentExpirationTime();
         if (declined) {
             lease->state_ = Lease::STATE_DECLINED;
         }
@@ -458,7 +458,7 @@ public:
         // expiration time is cast properly.
         lease->valid_lft_ = HIGH_VALID_LIFETIME; // Very high valid lifetime
         lease->cltt_ = DEC_2030_TIME; // December 11th 2030
-        lease->updateExistingLifetime();
+        lease->updateCurrentExpirationTime();
         if (declined) {
             lease->state_ = Lease::STATE_DECLINED;
         }
index 33aaad42598a27bfbf111f5ea10c468c9b8d3b2c..e0cf89b223a853acb08ab4632e554cae3aef6253 100644 (file)
@@ -52,9 +52,9 @@ public:
     ///
     /// @param connection already open Cassandra connection.
     CqlLeaseExchange(const CqlConnection &connection)
-        : connection_(connection), valid_lifetime_(0), expire_(0), old_expire_(0),
-          subnet_id_(0), fqdn_fwd_(cass_false), fqdn_rev_(cass_false),
-          state_(0), user_context_(NULL_USER_CONTEXT) {
+        : connection_(connection), valid_lifetime_(0), expire_(0),
+          current_expire_(0), subnet_id_(0), fqdn_fwd_(cass_false),
+          fqdn_rev_(cass_false), state_(0), user_context_(NULL_USER_CONTEXT) {
     }
 
     /// @brief Create BIND array to receive C++ data.
@@ -91,7 +91,7 @@ protected:
     cass_int64_t expire_;
 
     /// @brief Expiration time of lease before update
-    cass_int64_t old_expire_;
+    cass_int64_t current_expire_;
 
     /// @brief Subnet identifier
     cass_int32_t subnet_id_;
@@ -633,9 +633,10 @@ CqlLease4Exchange::createBindForUpdate(const Lease4Ptr &lease, AnyArray &data,
         data.add(&user_context_);
         data.add(&address_);
 
-        CqlExchange::convertToDatabaseTime(lease_->old_cltt_, lease_->old_valid_lft_,
-                                           old_expire_);
-        data.add(&old_expire_);
+        CqlExchange::convertToDatabaseTime(lease_->current_cltt_,
+                                           lease_->current_valid_lft_,
+                                           current_expire_);
+        data.add(&current_expire_);
     } catch (const Exception &ex) {
         isc_throw(DbOperationError,
                   "CqlLease4Exchange::createBindUpdate(): "
@@ -664,9 +665,10 @@ CqlLease4Exchange::createBindForDelete(const Lease4Ptr &lease, AnyArray &data,
         data.clear();
         data.add(&address_);
 
-        CqlExchange::convertToDatabaseTime(lease_->old_cltt_, lease_->old_valid_lft_,
-                                           old_expire_);
-        data.add(&old_expire_);
+        CqlExchange::convertToDatabaseTime(lease_->current_cltt_,
+                                           lease_->current_valid_lft_,
+                                           current_expire_);
+        data.add(&current_expire_);
     } catch (const Exception &ex) {
         isc_throw(DbOperationError,
                   "CqlLease4Exchange::createBindForDelete(): "
@@ -1424,9 +1426,10 @@ CqlLease6Exchange::createBindForUpdate(const Lease6Ptr &lease, AnyArray &data,
         data.add(&user_context_);
         data.add(&address_);
 
-        CqlExchange::convertToDatabaseTime(lease_->old_cltt_, lease_->old_valid_lft_,
-                                           old_expire_);
-        data.add(&old_expire_);
+        CqlExchange::convertToDatabaseTime(lease_->current_cltt_,
+                                           lease_->current_valid_lft_,
+                                           current_expire_);
+        data.add(&current_expire_);
     } catch (const Exception &ex) {
         isc_throw(DbOperationError,
                   "CqlLease6Exchange::createBindForUpdate(): "
@@ -1461,9 +1464,10 @@ CqlLease6Exchange::createBindForDelete(const Lease6Ptr &lease, AnyArray &data,
         data.clear();
         data.add(&address_);
 
-        CqlExchange::convertToDatabaseTime(lease_->old_cltt_, lease_->old_valid_lft_,
-                                           old_expire_);
-        data.add(&old_expire_);
+        CqlExchange::convertToDatabaseTime(lease_->current_cltt_,
+                                           lease_->current_valid_lft_,
+                                           current_expire_);
+        data.add(&current_expire_);
     } catch (const Exception &ex) {
         isc_throw(DbOperationError,
                   "CqlLease6Exchange::createBindForDelete(): "
@@ -1596,9 +1600,9 @@ CqlLease6Exchange::retrieve() {
 
         time_t cltt = 0;
         CqlExchange::convertFromDatabaseTime(expire_, valid_lifetime_, cltt);
-        // Update cltt_ and old_cltt_ explicitly.
+        // Update cltt_ and current_cltt_ explicitly.
         result->cltt_ = cltt;
-        result->old_cltt_ = cltt;
+        result->current_cltt_ = cltt;
 
         result->state_ = state_;
 
@@ -2146,9 +2150,9 @@ CqlLeaseMgr::addLease(const Lease4Ptr &lease) {
         return false;
     }
 
-    // Update lease lifetime with new values (allows update between the creation
+    // Update lease current expiration time (allows update between the creation
     // of the Lease up to the point of insertion in the database).
-    lease->updateExistingLifetime();
+    lease->updateCurrentExpirationTime();
 
     return true;
 }
@@ -2170,9 +2174,9 @@ CqlLeaseMgr::addLease(const Lease6Ptr &lease) {
         return false;
     }
 
-    // Update lease lifetime with new values (allows update between the creation
+    // Update lease current expiration time (allows update between the creation
     // of the Lease up to the point of insertion in the database).
-    lease->updateExistingLifetime();
+    lease->updateCurrentExpirationTime();
 
     return true;
 }
@@ -2621,8 +2625,8 @@ CqlLeaseMgr::updateLease4(const Lease4Ptr &lease) {
         isc_throw(NoSuchLease, exception.what());
     }
 
-    // Update lease lifetime with new values.
-    lease->updateExistingLifetime();
+    // Update lease current expiration time.
+    lease->updateCurrentExpirationTime();
 }
 
 void
@@ -2640,8 +2644,8 @@ CqlLeaseMgr::updateLease6(const Lease6Ptr &lease) {
         isc_throw(NoSuchLease, exception.what());
     }
 
-    // Update lease lifetime with new values.
-    lease->updateExistingLifetime();
+    // Update lease current expiration time.
+    lease->updateCurrentExpirationTime();
 }
 
 bool
index 61899e1846bb6de2b4d71328e2f2be828e2ceb6a..b0db0b33994feafc081cd27093d2a2c91e481382 100644 (file)
@@ -411,12 +411,14 @@ public:
     /// @throw isc::db::DbOperationError An operation on the open database has
     ///        failed.
     ///
-    /// @note The old_cltt_ and old_valid_lft_ are used to ensure that only one
-    /// thread or process performs an update or delete operation on the lease by
-    /// matching these values with the expired data in the database.
+    /// @note The current_cltt_ and current_valid_lft_ are used to maximize the
+    /// chance that only one thread or process performs an update or delete
+    /// operation on the lease by matching these values with the expiration time
+    /// data in the database.
     /// @note The UPDATE query uses IF expire = ? to update the lease only if
     /// the value matches the one received on the SELECT query, effectively
-    /// enforcing no update on the lease between SELECT and UPDATE.
+    /// enforcing no update on the lease between SELECT and UPDATE with
+    /// different expiration time.
     virtual void updateLease4(const Lease4Ptr& lease4) override;
 
     /// @brief Updates IPv6 lease.
@@ -431,12 +433,14 @@ public:
     /// @throw isc::db::DbOperationError An operation on the open database has
     ///        failed.
     ///
-    /// @note The old_cltt_ and old_valid_lft_ are used to ensure that only one
-    /// thread or process performs an update or delete operation on the lease by
-    /// matching these values with the expired data in the database.
+    /// @note The current_cltt_ and current_valid_lft_ are used to maximize the
+    /// chance that only one thread or process performs an update or delete
+    /// operation on the lease by matching these values with the expiration time
+    /// data in the database.
     /// @note The UPDATE query uses IF expire = ? to update the lease only if
     /// the value matches the one received on the SELECT query, effectively
-    /// enforcing no update on the lease between SELECT and UPDATE.
+    /// enforcing no update on the lease between SELECT and UPDATE with
+    /// different expiration time.
     virtual void updateLease6(const Lease6Ptr& lease6) override;
 
     /// @brief Deletes an IPv4 lease.
@@ -445,12 +449,14 @@ public:
     ///
     /// @return true if deletion was successful, false if no such lease exists.
     ///
-    /// @note The old_cltt_ and old_valid_lft_ are used to ensure that only one
-    /// thread or process performs an update or delete operation on the lease by
-    /// matching these values with the expired data in the database.
+    /// @note The current_cltt_ and current_valid_lft_ are used to maximize the
+    /// chance that only one thread or process performs an update or delete
+    /// operation on the lease by matching these values with the expiration time
+    /// data in the database.
     /// @note The DELETE query uses IF expire = ? to delete the lease only if
     /// the value matches the one received on the SELECT query, effectively
-    /// enforcing no update on the lease between SELECT and DELETE.
+    /// enforcing no update on the lease between SELECT and DELETE with
+    /// different expiration time.
     bool deleteLease(const Lease4Ptr& lease) override final;
 
     /// @brief Deletes an IPv6 lease.
@@ -459,12 +465,14 @@ public:
     ///
     /// @return true if deletion was successful, false if no such lease exists.
     ///
-    /// @note The old_cltt_ and old_valid_lft_ are used to ensure that only one
-    /// thread or process performs an update or delete operation on the lease by
-    /// matching these values with the expired data in the database.
+    /// @note The current_cltt_ and current_valid_lft_ are used to maximize the
+    /// chance that only one thread or process performs an update or delete
+    /// operation on the lease by matching these values with the expiration time
+    /// data in the database.
     /// @note The DELETE query uses IF expire = ? to delete the lease only if
     /// the value matches the one received on the SELECT query, effectively
-    /// enforcing no update on the lease between SELECT and DELETE.
+    /// enforcing no update on the lease between SELECT and DELETE with
+    /// different expiration time.
     bool deleteLease(const Lease6Ptr& lease) override final;
 
     /// @brief Deletes all expired and reclaimed DHCPv4 leases.
index 17142521b0d4bb46c939f1759c8b614eaadf853f..38495bfae2b9566e785f5fac76a0479f6e0b5fb0 100644 (file)
@@ -40,8 +40,8 @@ Lease::Lease(const isc::asiolink::IOAddress& addr,
              uint32_t valid_lft, SubnetID subnet_id, time_t cltt,
              const bool fqdn_fwd, const bool fqdn_rev,
              const std::string& hostname, const HWAddrPtr& hwaddr)
-    : addr_(addr), valid_lft_(valid_lft), old_valid_lft_(valid_lft),
-      cltt_(cltt), old_cltt_(cltt), subnet_id_(subnet_id),
+    : addr_(addr), valid_lft_(valid_lft), current_valid_lft_(valid_lft),
+      cltt_(cltt), current_cltt_(cltt), subnet_id_(subnet_id),
       hostname_(boost::algorithm::to_lower_copy(hostname)), fqdn_fwd_(fqdn_fwd),
       fqdn_rev_(fqdn_rev), hwaddr_(hwaddr), state_(STATE_DEFAULT) {
 }
@@ -275,18 +275,18 @@ Lease::fromElementCommon(const LeasePtr& lease, const data::ConstElementPtr& ele
         lease->setContext(ctx);
     }
 
-    lease->updateExistingLifetime();
+    lease->updateCurrentExpirationTime();
 }
 
 void
-Lease::updateExistingLifetime() {
-    Lease::syncExistingLifetime(*this, *this);
+Lease::updateCurrentExpirationTime() {
+    Lease::syncCurrentExpirationTime(*this, *this);
 }
 
 void
-Lease::syncExistingLifetime(const Lease& from, Lease& to) {
-    to.old_cltt_ = from.cltt_;
-    to.old_valid_lft_ = from.valid_lft_;
+Lease::syncCurrentExpirationTime(const Lease& from, Lease& to) {
+    to.current_cltt_ = from.cltt_;
+    to.current_valid_lft_ = from.valid_lft_;
 }
 
 Lease4::Lease4(const Lease4& other)
@@ -390,9 +390,9 @@ Lease4::operator=(const Lease4& other) {
     if (this != &other) {
         addr_ = other.addr_;
         valid_lft_ = other.valid_lft_;
-        old_valid_lft_ = other.old_valid_lft_;
+        current_valid_lft_ = other.current_valid_lft_;
         cltt_ = other.cltt_;
-        old_cltt_ = other.old_cltt_;
+        current_cltt_ = other.current_cltt_;
         subnet_id_ = other.subnet_id_;
         hostname_ = other.hostname_;
         fqdn_fwd_ = other.fqdn_fwd_;
@@ -493,7 +493,7 @@ Lease6::Lease6(Lease::Type type, const isc::asiolink::IOAddress& addr,
     }
 
     cltt_ = time(NULL);
-    old_cltt_ = cltt_;
+    current_cltt_ = cltt_;
 }
 
 Lease6::Lease6(Lease::Type type, const isc::asiolink::IOAddress& addr,
@@ -510,7 +510,7 @@ Lease6::Lease6(Lease::Type type, const isc::asiolink::IOAddress& addr,
     }
 
     cltt_ = time(NULL);
-    old_cltt_ = cltt_;
+    current_cltt_ = cltt_;
 }
 
 Lease6::Lease6()
@@ -599,9 +599,9 @@ Lease4::operator==(const Lease4& other) const {
             addr_ == other.addr_ &&
             subnet_id_ == other.subnet_id_ &&
             valid_lft_ == other.valid_lft_ &&
-            old_valid_lft_ == other.old_valid_lft_ &&
+            current_valid_lft_ == other.current_valid_lft_ &&
             cltt_ == other.cltt_ &&
-            old_cltt_ == other.old_cltt_ &&
+            current_cltt_ == other.current_cltt_ &&
             hostname_ == other.hostname_ &&
             fqdn_fwd_ == other.fqdn_fwd_ &&
             fqdn_rev_ == other.fqdn_rev_ &&
@@ -619,9 +619,9 @@ Lease6::operator==(const Lease6& other) const {
             iaid_ == other.iaid_ &&
             preferred_lft_ == other.preferred_lft_ &&
             valid_lft_ == other.valid_lft_ &&
-            old_valid_lft_ == other.old_valid_lft_ &&
+            current_valid_lft_ == other.current_valid_lft_ &&
             cltt_ == other.cltt_ &&
-            old_cltt_ == other.old_cltt_ &&
+            current_cltt_ == other.current_cltt_ &&
             subnet_id_ == other.subnet_id_ &&
             hostname_ == other.hostname_ &&
             fqdn_fwd_ == other.fqdn_fwd_ &&
index 374674ebd7349b0f145763f3e8e356248da4c68f..5dbee9823acc7bc502364c2eca36ce43a56add7f 100644 (file)
@@ -98,12 +98,12 @@ struct Lease : public isc::data::UserContext, public isc::data::CfgToElement {
     /// @param hostname FQDN of the client which gets the lease.
     /// @param hwaddr Hardware/MAC address
     ///
-    /// @note When creating a new Lease object, old_cltt_ matches cltt_ and
-    /// old_valid_lft_ matches valid_lft_. Any update operation that changes
-    /// cltt_ or valid_lft_ in the database must also update the old_cltt_ and
-    /// old_valid_lft_ after the database response so that additional operations
-    /// can be performed on the same object. Failing to do so will result in
-    /// the new actions to be rejected by the database.
+    /// @note When creating a new Lease object, current_cltt_ matches cltt_ and
+    /// current_valid_lft_ matches valid_lft_. Any update operation that changes
+    /// cltt_ or valid_lft_ in the database must also update the current_cltt_
+    /// and current_valid_lft_ after the database response so that additional
+    /// operations can be performed on the same object. Failing to do so will
+    /// result in the new actions to be rejected by the database.
     Lease(const isc::asiolink::IOAddress& addr,
           uint32_t valid_lft, SubnetID subnet_id, time_t cltt,
           const bool fqdn_fwd, const bool fqdn_rev,
@@ -123,10 +123,10 @@ struct Lease : public isc::data::UserContext, public isc::data::CfgToElement {
     /// Expressed as number of seconds since cltt.
     uint32_t valid_lft_;
 
-    /// @brief Old valid lifetime
+    /// @brief Current valid lifetime
     ///
     /// Expressed as number of seconds since cltt before update.
-    uint32_t old_valid_lft_;
+    uint32_t current_valid_lft_;
 
     /// @brief Client last transmission time
     ///
@@ -134,11 +134,11 @@ struct Lease : public isc::data::UserContext, public isc::data::CfgToElement {
     /// client was received.
     time_t cltt_;
 
-    /// @brief Old client last transmission time
+    /// @brief Current client last transmission time
     ///
     /// Specifies a timestamp giving the time when the last transmission from a
     /// client was received before update.
-    time_t old_cltt_;
+    time_t current_cltt_;
 
     /// @brief Subnet identifier
     ///
@@ -237,25 +237,26 @@ struct Lease : public isc::data::UserContext, public isc::data::CfgToElement {
     /// Avoid a clang spurious error
     using isc::data::CfgToElement::toElement;
 
-    /// Sync lease lifetime with value of a newer version of the lease, so that
-    /// additional operations can be done without performing extra read from the
-    /// database.
+    /// Sync lease current expiration time with new value from another lease,
+    /// so that additional operations can be done without performing extra read
+    /// from the database.
     ///
-    /// @note The old lease lifetime is represented by the @ref old_cltt_ and
-    /// @ref old_valid_lft_ and the new lifetime by @ref cltt_ and
-    /// @ref valid_lft_
+    /// @note The lease current expiration time is represented by the
+    /// @ref current_cltt_ and  @ref current_valid_lft_ and the new value by
+    /// @ref cltt_ and @ref valid_lft_
     ///
-    /// @param from The lease with latest value of lifetime.
+    /// @param from The lease with latest value of expiration time.
     /// @param [out] to The lease that needs to be updated.
-    static void syncExistingLifetime(const Lease& from, Lease& to);
+    static void syncCurrentExpirationTime(const Lease& from, Lease& to);
 
-    /// Update lifetime with new value, so that additional operations can be
-    /// done without performing extra read from the database.
+    /// Update lease current expiration time with new value,
+    /// so that additional operations can be done without performing extra read
+    /// from the database.
     ///
-    /// @note The old lease lifetime is represented by the @ref old_cltt_ and
-    /// @ref old_valid_lft_ and the new lifetime by @ref cltt_ and
-    /// @ref valid_lft_
-    void updateExistingLifetime();
+    /// @note The lease current expiration time is represented by the
+    /// @ref current_cltt_ and  @ref current_valid_lft_ and the new value by
+    /// @ref cltt_ and @ref valid_lft_
+    void updateCurrentExpirationTime();
 
 protected:
 
index c1896999b5631ab8df5de3f5e45de99f46c19de7..349e3bfcbdc9606c3fbe5b1b0b04efc555246367 100644 (file)
@@ -705,9 +705,9 @@ Memfile_LeaseMgr::addLeaseInternal(const Lease4Ptr& lease) {
 
     storage4_.insert(lease);
 
-    // Update lease lifetime with new values (allows update between the creation
+    // Update lease current expiration time (allows update between the creation
     // of the Lease up to the point of insertion in the database).
-    lease->updateExistingLifetime();
+    lease->updateCurrentExpirationTime();
 
     return (true);
 }
@@ -741,9 +741,9 @@ Memfile_LeaseMgr::addLeaseInternal(const Lease6Ptr& lease) {
 
     storage6_.insert(lease);
 
-    // Update lease lifetime with new values (allows update between the creation
+    // Update lease current expiration time (allows update between the creation
     // of the Lease up to the point of insertion in the database).
-    lease->updateExistingLifetime();
+    lease->updateCurrentExpirationTime();
 
     return (true);
 }
@@ -1426,8 +1426,8 @@ Memfile_LeaseMgr::updateLease4Internal(const Lease4Ptr& lease) {
     if (lease_it == index.end()) {
         isc_throw(NoSuchLease, "failed to update the lease with address "
                   << lease->addr_ << " - no such lease");
-    } else if ((!persist) && (((*lease_it)->cltt_ != lease->old_cltt_) ||
-        ((*lease_it)->valid_lft_ != lease->old_valid_lft_))) {
+    } else if ((!persist) && (((*lease_it)->cltt_ != lease->current_cltt_) ||
+        ((*lease_it)->valid_lft_ != lease->current_valid_lft_))) {
         // For test purpose only: check that the lease has not changed in
         // the database.
         isc_throw(NoSuchLease, "failed to update the lease with address "
@@ -1441,8 +1441,8 @@ Memfile_LeaseMgr::updateLease4Internal(const Lease4Ptr& lease) {
         lease_file4_->append(*lease);
     }
 
-    // Update lease lifetime with new values.
-    lease->updateExistingLifetime();
+    // Update lease current expiration time.
+    lease->updateCurrentExpirationTime();
 
     // Use replace() to re-index leases.
     index.replace(lease_it, Lease4Ptr(new Lease4(*lease)));
@@ -1473,8 +1473,8 @@ Memfile_LeaseMgr::updateLease6Internal(const Lease6Ptr& lease) {
     if (lease_it == index.end()) {
         isc_throw(NoSuchLease, "failed to update the lease with address "
                   << lease->addr_ << " - no such lease");
-    } else if ((!persist) && (((*lease_it)->cltt_ != lease->old_cltt_) ||
-        ((*lease_it)->valid_lft_ != lease->old_valid_lft_))) {
+    } else if ((!persist) && (((*lease_it)->cltt_ != lease->current_cltt_) ||
+        ((*lease_it)->valid_lft_ != lease->current_valid_lft_))) {
         // For test purpose only: check that the lease has not changed in
         // the database.
         isc_throw(NoSuchLease, "failed to update the lease with address "
@@ -1488,8 +1488,8 @@ Memfile_LeaseMgr::updateLease6Internal(const Lease6Ptr& lease) {
         lease_file6_->append(*lease);
     }
 
-    // Update lease lifetime with new values.
-    lease->updateExistingLifetime();
+    // Update lease current expiration time.
+    lease->updateCurrentExpirationTime();
 
     // Use replace() to re-index leases.
     index.replace(lease_it, Lease6Ptr(new Lease6(*lease)));
@@ -1527,8 +1527,8 @@ Memfile_LeaseMgr::deleteLeaseInternal(const Lease4Ptr& lease) {
         } else {
             // For test purpose only: check that the lease has not changed in
             // the database.
-            if (((*l)->cltt_ != lease->old_cltt_) ||
-                ((*l)->valid_lft_ != lease->old_valid_lft_)) {
+            if (((*l)->cltt_ != lease->current_cltt_) ||
+                ((*l)->valid_lft_ != lease->current_valid_lft_)) {
                 return false;
             }
         }
@@ -1569,8 +1569,8 @@ Memfile_LeaseMgr::deleteLeaseInternal(const Lease6Ptr& lease) {
         } else {
             // For test purpose only: check that the lease has not changed in
             // the database.
-            if (((*l)->cltt_ != lease->old_cltt_) ||
-                ((*l)->valid_lft_ != lease->old_valid_lft_)) {
+            if (((*l)->cltt_ != lease->current_cltt_) ||
+                ((*l)->valid_lft_ != lease->current_valid_lft_)) {
                 return false;
             }
         }
index e854c31841045d3dccd0c1e4ab82479b7c636add..5975e5ff5309d1141c850afa907915b5da83dc54 100644 (file)
@@ -405,13 +405,14 @@ public:
     ///
     /// @throw NoSuchLease if there is no such lease to be updated.
     ///
-    /// @note The old_cltt_ and old_valid_lft_ are used to ensure that only one
-    /// thread or process performs an update or delete operation on the lease by
-    /// matching these values with the expired data in the database.
+    /// @note The current_cltt_ and current_valid_lft_ are used to maximize the
+    /// chance that only one thread or process performs an update or delete
+    /// operation on the lease by matching these values with the expiration time
+    /// data in the database.
     /// @note For test purposes only, when persistence is disabled, the update
     /// of the lease is performed only if the value matches the one received on
     /// the SELECT query, effectively enforcing no update on the lease between
-    /// SELECT and UPDATE.
+    /// SELECT and UPDATE with different expiration time.
     virtual void updateLease4(const Lease4Ptr& lease4);
 
     /// @brief Updates IPv6 lease.
@@ -423,13 +424,14 @@ public:
     ///
     /// @throw NoSuchLease if there is no such lease to be updated.
     ///
-    /// @note The old_cltt_ and old_valid_lft_ are used to ensure that only one
-    /// thread or process performs an update or delete operation on the lease by
-    /// matching these values with the expired data in the database.
+    /// @note The current_cltt_ and current_valid_lft_ are used to maximize the
+    /// chance that only one thread or process performs an update or delete
+    /// operation on the lease by matching these values with the expiration time
+    /// data in the database.
     /// @note For test purposes only, when persistence is disabled, the update
     /// of the lease is performed only if the value matches the one received on
     /// the SELECT query, effectively enforcing no update on the lease between
-    /// SELECT and UPDATE.
+    /// SELECT and UPDATE with different expiration time.
     virtual void updateLease6(const Lease6Ptr& lease6);
 
     /// @brief Deletes an IPv4 lease.
@@ -438,13 +440,14 @@ public:
     ///
     /// @return true if deletion was successful, false if no such lease exists.
     ///
-    /// @note The old_cltt_ and old_valid_lft_ are used to ensure that only one
-    /// thread or process performs an update or delete operation on the lease by
-    /// matching these values with the expired data in the database.
+    /// @note The current_cltt_ and current_valid_lft_ are used to maximize the
+    /// chance that only one thread or process performs an update or delete
+    /// operation on the lease by matching these values with the expiration time
+    /// data in the database.
     /// @note For test purposes only, when persistence is disabled, the deletion
     /// of the lease is performed only if the value matches the one received on
     /// the SELECT query, effectively enforcing no update on the lease between
-    /// SELECT and DELETE.
+    /// SELECT and DELETE with different expiration time.
     virtual bool deleteLease(const Lease4Ptr& lease);
 
     /// @brief Deletes an IPv6 lease.
@@ -453,13 +456,14 @@ public:
     ///
     /// @return true if deletion was successful, false if no such lease exists.
     ///
-    /// @note The old_cltt_ and old_valid_lft_ are used to ensure that only one
-    /// thread or process performs an update or delete operation on the lease by
-    /// matching these values with the expired data in the database.
+    /// @note The current_cltt_ and current_valid_lft_ are used to maximize the
+    /// chance that only one thread or process performs an update or delete
+    /// operation on the lease by matching these values with the expiration time
+    /// data in the database.
     /// @note For test purposes only, when persistence is disabled, the deletion
     /// of the lease is performed only if the value matches the one received on
     /// the SELECT query, effectively enforcing no update on the lease between
-    /// SELECT and DELETE.
+    /// SELECT and DELETE with different expiration time.
     virtual bool deleteLease(const Lease6Ptr& lease);
 
     /// @brief Deletes all expired-reclaimed DHCPv4 leases.
@@ -695,13 +699,14 @@ private:
     ///
     /// @throw NoSuchLease if there is no such lease to be updated.
     ///
-    /// @note The old_cltt_ and old_valid_lft_ are used to ensure that only one
-    /// thread or process performs an update or delete operation on the lease by
-    /// matching these values with the expired data in the database.
+    /// @note The current_cltt_ and current_valid_lft_ are used to maximize the
+    /// chance that only one thread or process performs an update or delete
+    /// operation on the lease by matching these values with the expiration time
+    /// data in the database.
     /// @note For test purposes only, when persistence is disabled, the update
     /// of the lease is performed only if the value matches the one received on
     /// the SELECT query, effectively enforcing no update on the lease between
-    /// SELECT and UPDATE.
+    /// SELECT and UPDATE with different expiration time.
     void updateLease4Internal(const Lease4Ptr& lease4);
 
     /// @brief Updates IPv6 lease.
@@ -710,13 +715,14 @@ private:
     ///
     /// @throw NoSuchLease if there is no such lease to be updated.
     ///
-    /// @note The old_cltt_ and old_valid_lft_ are used to ensure that only one
-    /// thread or process performs an update or delete operation on the lease by
-    /// matching these values with the expired data in the database.
+    /// @note The current_cltt_ and current_valid_lft_ are used to maximize the
+    /// chance that only one thread or process performs an update or delete
+    /// operation on the lease by matching these values with the expiration time
+    /// data in the database.
     /// @note For test purposes only, when persistence is disabled, the update
     /// of the lease is performed only if the value matches the one received on
     /// the SELECT query, effectively enforcing no update on the lease between
-    /// SELECT and UPDATE.
+    /// SELECT and UPDATE with different expiration time.
     void updateLease6Internal(const Lease6Ptr& lease6);
 
     /// @brief Deletes an IPv4 lease.
@@ -725,13 +731,14 @@ private:
     ///
     /// @return true if deletion was successful, false if no such lease exists.
     ///
-    /// @note The old_cltt_ and old_valid_lft_ are used to ensure that only one
-    /// thread or process performs an update or delete operation on the lease by
-    /// matching these values with the expired data in the database.
+    /// @note The current_cltt_ and current_valid_lft_ are used to maximize the
+    /// chance that only one thread or process performs an update or delete
+    /// operation on the lease by matching these values with the expiration time
+    /// data in the database.
     /// @note For test purposes only, when persistence is disabled, the deletion
     /// of the lease is performed only if the value matches the one received on
     /// the SELECT query, effectively enforcing no update on the lease between
-    /// SELECT and DELETE.
+    /// SELECT and DELETE with different expiration time.
     bool deleteLeaseInternal(const Lease4Ptr& addr);
 
     /// @brief Deletes an IPv6 lease.
@@ -740,13 +747,14 @@ private:
     ///
     /// @return true if deletion was successful, false if no such lease exists.
     ///
-    /// @note The old_cltt_ and old_valid_lft_ are used to ensure that only one
-    /// thread or process performs an update or delete operation on the lease by
-    /// matching these values with the expired data in the database.
+    /// @note The current_cltt_ and current_valid_lft_ are used to maximize the
+    /// chance that only one thread or process performs an update or delete
+    /// operation on the lease by matching these values with the expiration time
+    /// data in the database.
     /// @note For test purposes only, when persistence is disabled, the deletion
     /// of the lease is performed only if the value matches the one received on
     /// the SELECT query, effectively enforcing no update on the lease between
-    /// SELECT and DELETE.
+    /// SELECT and DELETE with different expiration time.
     bool deleteLeaseInternal(const Lease6Ptr& addr);
 
     /// @brief Removes specified IPv4 leases.
index 9bd7fdf258a4ffeae022cc2b78e98c40c3362c7a..2e9a6a714b25515bb04dd62346ba9246e383d384 100644 (file)
@@ -1425,9 +1425,9 @@ public:
             valid_lft = 0;
         }
         MySqlConnection::convertFromDatabaseTime(expire_, valid_lft, cltt);
-        // Update cltt_ and old_cltt_ explicitly.
+        // Update cltt_ and current_cltt_ explicitly.
         result->cltt_ = cltt;
-        result->old_cltt_ = cltt;
+        result->current_cltt_ = cltt;
 
         // Set state.
         result->state_ = state_;
@@ -1872,9 +1872,9 @@ MySqlLeaseMgr::addLease(const Lease4Ptr& lease) {
     // ... and drop to common code.
     auto result = addLeaseCommon(ctx, INSERT_LEASE4, bind);
 
-    // Update lease lifetime with new values (allows update between the creation
+    // Update lease current expiration time (allows update between the creation
     // of the Lease up to the point of insertion in the database).
-    lease->updateExistingLifetime();
+    lease->updateCurrentExpirationTime();
 
     return (result);
 }
@@ -1895,9 +1895,9 @@ MySqlLeaseMgr::addLease(const Lease6Ptr& lease) {
     // ... and drop to common code.
     auto result = addLeaseCommon(ctx, INSERT_LEASE6, bind);
 
-    // Update lease lifetime with new values (allows update between the creation
+    // Update lease current expiration time (allows update between the creation
     // of the Lease up to the point of insertion in the database).
-    lease->updateExistingLifetime();
+    lease->updateCurrentExpirationTime();
 
     return (result);
 }
@@ -2761,7 +2761,8 @@ MySqlLeaseMgr::updateLease4(const Lease4Ptr& lease) {
     bind.push_back(inbind[0]);
 
     MYSQL_TIME expire;
-    MySqlConnection::convertToDatabaseTime(lease->old_cltt_, lease->old_valid_lft_,
+    MySqlConnection::convertToDatabaseTime(lease->current_cltt_,
+                                           lease->current_valid_lft_,
                                            expire);
     inbind[1].buffer_type = MYSQL_TYPE_TIMESTAMP;
     inbind[1].buffer = reinterpret_cast<char*>(&expire);
@@ -2772,8 +2773,8 @@ MySqlLeaseMgr::updateLease4(const Lease4Ptr& lease) {
     // Drop to common update code
     updateLeaseCommon(ctx, stindex, &bind[0], lease);
 
-    // Update lease lifetime with new values.
-    lease->updateExistingLifetime();
+    // Update lease current expiration time.
+    lease->updateCurrentExpirationTime();
 }
 
 void
@@ -2808,7 +2809,8 @@ MySqlLeaseMgr::updateLease6(const Lease6Ptr& lease) {
     bind.push_back(inbind[0]);
 
     MYSQL_TIME expire;
-    MySqlConnection::convertToDatabaseTime(lease->old_cltt_, lease->old_valid_lft_,
+    MySqlConnection::convertToDatabaseTime(lease->current_cltt_,
+                                           lease->current_valid_lft_,
                                            expire);
     inbind[1].buffer_type = MYSQL_TYPE_TIMESTAMP;
     inbind[1].buffer = reinterpret_cast<char*>(&expire);
@@ -2819,8 +2821,8 @@ MySqlLeaseMgr::updateLease6(const Lease6Ptr& lease) {
     // Drop to common update code
     updateLeaseCommon(ctx, stindex, &bind[0], lease);
 
-    // Update lease lifetime with new values.
-    lease->updateExistingLifetime();
+    // Update lease current expiration time.
+    lease->updateCurrentExpirationTime();
 }
 
 // Delete lease methods.  Similar to other groups of methods, these comprise
@@ -2866,7 +2868,8 @@ MySqlLeaseMgr::deleteLease(const Lease4Ptr& lease) {
     inbind[0].is_unsigned = MLM_TRUE;
 
     MYSQL_TIME expire;
-    MySqlConnection::convertToDatabaseTime(lease->old_cltt_, lease->old_valid_lft_,
+    MySqlConnection::convertToDatabaseTime(lease->current_cltt_,
+                                           lease->current_valid_lft_,
                                            expire);
     inbind[1].buffer_type = MYSQL_TYPE_TIMESTAMP;
     inbind[1].buffer = reinterpret_cast<char*>(&expire);
@@ -2912,7 +2915,8 @@ MySqlLeaseMgr::deleteLease(const Lease6Ptr& lease) {
     inbind[0].length = &addr6_length;
 
     MYSQL_TIME expire;
-    MySqlConnection::convertToDatabaseTime(lease->old_cltt_, lease->old_valid_lft_,
+    MySqlConnection::convertToDatabaseTime(lease->current_cltt_,
+                                           lease->current_valid_lft_,
                                            expire);
     inbind[1].buffer_type = MYSQL_TYPE_TIMESTAMP;
     inbind[1].buffer = reinterpret_cast<char*>(&expire);
index b0badaeca1a733be610fe9d9e837208712774455..64af58ad6c04152fa001249c38afa7b2148558ba 100644 (file)
@@ -454,12 +454,14 @@ public:
     /// @throw isc::db::DbOperationError An operation on the open database has
     ///        failed.
     ///
-    /// @note The old_cltt_ and old_valid_lft_ are used to ensure that only one
-    /// thread or process performs an update or delete operation on the lease by
-    /// matching these values with the expired data in the database.
+    /// @note The current_cltt_ and current_valid_lft_ are used to maximize the
+    /// chance that only one thread or process performs an update or delete
+    /// operation on the lease by matching these values with the expiration time
+    /// data in the database.
     /// @note The UPDATE query uses WHERE expire = ? to update the lease only if
     /// the value matches the one received on the SELECT query, effectively
-    /// enforcing no update on the lease between SELECT and UPDATE.
+    /// enforcing no update on the lease between SELECT and UPDATE with
+    /// different expiration time.
     virtual void updateLease4(const Lease4Ptr& lease4);
 
     /// @brief Updates IPv6 lease.
@@ -474,12 +476,14 @@ public:
     /// @throw isc::db::DbOperationError An operation on the open database has
     ///        failed.
     ///
-    /// @note The old_cltt_ and old_valid_lft_ are used to ensure that only one
-    /// thread or process performs an update or delete operation on the lease by
-    /// matching these values with the expired data in the database.
+    /// @note The current_cltt_ and current_valid_lft_ are used to maximize the
+    /// chance that only one thread or process performs an update or delete
+    /// operation on the lease by matching these values with the expiration time
+    /// data in the database.
     /// @note The UPDATE query uses WHERE expire = ? to update the lease only if
     /// the value matches the one received on the SELECT query, effectively
-    /// enforcing no update on the lease between SELECT and UPDATE.
+    /// enforcing no update on the lease between SELECT and UPDATE with
+    /// different expiration time.
     virtual void updateLease6(const Lease6Ptr& lease6);
 
     /// @brief Deletes an IPv4 lease.
@@ -488,12 +492,14 @@ public:
     ///
     /// @return true if deletion was successful, false if no such lease exists.
     ///
-    /// @note The old_cltt_ and old_valid_lft_ are used to ensure that only one
-    /// thread or process performs an update or delete operation on the lease by
-    /// matching these values with the expired data in the database.
+    /// @note The current_cltt_ and current_valid_lft_ are used to maximize the
+    /// chance that only one thread or process performs an update or delete
+    /// operation on the lease by matching these values with the expiration time
+    /// data in the database.
     /// @note The DELETE query uses WHERE expire = ? to delete the lease only if
     /// the value matches the one received on the SELECT query, effectively
-    /// enforcing no update on the lease between SELECT and DELETE.
+    /// enforcing no update on the lease between SELECT and DELETE with
+    /// different expiration time.
     virtual bool deleteLease(const Lease4Ptr& lease);
 
     /// @brief Deletes an IPv6 lease.
@@ -502,12 +508,14 @@ public:
     ///
     /// @return true if deletion was successful, false if no such lease exists.
     ///
-    /// @note The old_cltt_ and old_valid_lft_ are used to ensure that only one
-    /// thread or process performs an update or delete operation on the lease by
-    /// matching these values with the expired data in the database.
+    /// @note The current_cltt_ and current_valid_lft_ are used to maximize the
+    /// chance that only one thread or process performs an update or delete
+    /// operation on the lease by matching these values with the expiration time
+    /// data in the database.
     /// @note The DELETE query uses WHERE expire = ? to delete the lease only if
     /// the value matches the one received on the SELECT query, effectively
-    /// enforcing no update on the lease between SELECT and DELETE.
+    /// enforcing no update on the lease between SELECT and DELETE with
+    /// different expiration time.
     virtual bool deleteLease(const Lease6Ptr& lease);
 
     /// @brief Deletes all expired-reclaimed DHCPv4 leases.
index 8c5d0977a45ffd9f933750692a2860f81625c29d..8d9ebcb6346cdf43ae73125886ac0d803813265a 100644 (file)
@@ -911,9 +911,9 @@ public:
                                                         subnet_id_, fqdn_fwd_,
                                                         fqdn_rev_, hostname_,
                                                         hwaddr, prefix_len_));
-            // Update cltt_ and old_cltt_ explicitly.
+            // Update cltt_ and current_cltt_ explicitly.
             result->cltt_ = cltt_;
-            result->old_cltt_ = cltt_;
+            result->current_cltt_ = cltt_;
 
             result->state_ = state;
 
@@ -1307,9 +1307,9 @@ PgSqlLeaseMgr::addLease(const Lease4Ptr& lease) {
     ctx->exchange4_->createBindForSend(lease, bind_array);
     auto result = addLeaseCommon(ctx, INSERT_LEASE4, bind_array);
 
-    // Update lease lifetime with new values (allows update between the creation
+    // Update lease current expiration time (allows update between the creation
     // of the Lease up to the point of insertion in the database).
-    lease->updateExistingLifetime();
+    lease->updateCurrentExpirationTime();
 
     return (result);
 }
@@ -1329,9 +1329,9 @@ PgSqlLeaseMgr::addLease(const Lease6Ptr& lease) {
 
     auto result = addLeaseCommon(ctx, INSERT_LEASE6, bind_array);
 
-    // Update lease lifetime with new values (allows update between the creation
+    // Update lease current expiration time (allows update between the creation
     // of the Lease up to the point of insertion in the database).
-    lease->updateExistingLifetime();
+    lease->updateCurrentExpirationTime();
 
     return (result);
 }
@@ -1985,15 +1985,15 @@ PgSqlLeaseMgr::updateLease4(const Lease4Ptr& lease) {
     std::string addr4_str = boost::lexical_cast<std::string>(lease->addr_.toUint32());
     bind_array.add(addr4_str);
 
-    std::string expire_str = PgSqlLeaseExchange::convertToDatabaseTime(lease->old_cltt_,
-                                                                       lease->old_valid_lft_);
+    std::string expire_str = PgSqlLeaseExchange::convertToDatabaseTime(lease->current_cltt_,
+                                                                       lease->current_valid_lft_);
     bind_array.add(expire_str);
 
     // Drop to common update code
     updateLeaseCommon(ctx, stindex, bind_array, lease);
 
-    // Update lease lifetime with new values.
-    lease->updateExistingLifetime();
+    // Update lease current expiration time.
+    lease->updateCurrentExpirationTime();
 }
 
 void
@@ -2016,15 +2016,15 @@ PgSqlLeaseMgr::updateLease6(const Lease6Ptr& lease) {
     std::string addr_str = lease->addr_.toText();
     bind_array.add(addr_str);
 
-    std::string expire_str = PgSqlLeaseExchange::convertToDatabaseTime(lease->old_cltt_,
-                                                                       lease->old_valid_lft_);
+    std::string expire_str = PgSqlLeaseExchange::convertToDatabaseTime(lease->current_cltt_,
+                                                                       lease->current_valid_lft_);
     bind_array.add(expire_str);
 
     // Drop to common update code
     updateLeaseCommon(ctx, stindex, bind_array, lease);
 
-    // Update lease lifetime with new values.
-    lease->updateExistingLifetime();
+    // Update lease current expiration time.
+    lease->updateCurrentExpirationTime();
 }
 
 uint64_t
@@ -2058,8 +2058,8 @@ PgSqlLeaseMgr::deleteLease(const Lease4Ptr& lease) {
     std::string addr4_str = boost::lexical_cast<std::string>(addr.toUint32());
     bind_array.add(addr4_str);
 
-    std::string expire_str = PgSqlLeaseExchange::convertToDatabaseTime(lease->old_cltt_,
-                                                                       lease->old_valid_lft_);
+    std::string expire_str = PgSqlLeaseExchange::convertToDatabaseTime(lease->current_cltt_,
+                                                                       lease->current_valid_lft_);
     bind_array.add(expire_str);
 
     auto affected_rows = deleteLeaseCommon(DELETE_LEASE4, bind_array);
@@ -2093,8 +2093,8 @@ PgSqlLeaseMgr::deleteLease(const Lease6Ptr& lease) {
     std::string addr6_str = addr.toText();
     bind_array.add(addr6_str);
 
-    std::string expire_str = PgSqlLeaseExchange::convertToDatabaseTime(lease->old_cltt_,
-                                                                       lease->old_valid_lft_);
+    std::string expire_str = PgSqlLeaseExchange::convertToDatabaseTime(lease->current_cltt_,
+                                                                       lease->current_valid_lft_);
     bind_array.add(expire_str);
 
     auto affected_rows = deleteLeaseCommon(DELETE_LEASE6, bind_array);
index e7e458e9cedd0495de86c6fd69210deacf27dce6..e221854e9faa3b3ef24021871f8b091cad24593f 100644 (file)
@@ -429,12 +429,14 @@ public:
     /// @throw isc::db::DbOperationError An operation on the open database has
     ///        failed.
     ///
-    /// @note The old_cltt_ and old_valid_lft_ are used to ensure that only one
-    /// thread or process performs an update or delete operation on the lease by
-    /// matching these values with the expired data in the database.
+    /// @note The current_cltt_ and current_valid_lft_ are used to maximize the
+    /// chance that only one thread or process performs an update or delete
+    /// operation on the lease by matching these values with the expiration time
+    /// data in the database.
     /// @note The UPDATE query uses WHERE expire = ? to update the lease only if
     /// the value matches the one received on the SELECT query, effectively
-    /// enforcing no update on the lease between SELECT and UPDATE.
+    /// enforcing no update on the lease between SELECT and UPDATE with
+    /// different expiration time.
     virtual void updateLease4(const Lease4Ptr& lease4);
 
     /// @brief Updates IPv6 lease.
@@ -449,12 +451,14 @@ public:
     /// @throw isc::db::DbOperationError An operation on the open database has
     ///        failed.
     ///
-    /// @note The old_cltt_ and old_valid_lft_ are used to ensure that only one
-    /// thread or process performs an update or delete operation on the lease by
-    /// matching these values with the expired data in the database.
+    /// @note The current_cltt_ and current_valid_lft_ are used to maximize the
+    /// chance that only one thread or process performs an update or delete
+    /// operation on the lease by matching these values with the expiration time
+    /// data in the database.
     /// @note The UPDATE query uses WHERE expire = ? to update the lease only if
     /// the value matches the one received on the SELECT query, effectively
-    /// enforcing no update on the lease between SELECT and UPDATE.
+    /// enforcing no update on the lease between SELECT and UPDATE with
+    /// different expiration time.
     virtual void updateLease6(const Lease6Ptr& lease6);
 
     /// @brief Deletes an IPv4 lease.
@@ -463,12 +467,14 @@ public:
     ///
     /// @return true if deletion was successful, false if no such lease exists.
     ///
-    /// @note The old_cltt_ and old_valid_lft_ are used to ensure that only one
-    /// thread or process performs an update or delete operation on the lease by
-    /// matching these values with the expired data in the database.
+    /// @note The current_cltt_ and current_valid_lft_ are used to maximize the
+    /// chance that only one thread or process performs an update or delete
+    /// operation on the lease by matching these values with the expiration time
+    /// data in the database.
     /// @note The DELETE query uses WHERE expire = ? to delete the lease only if
     /// the value matches the one received on the SELECT query, effectively
-    /// enforcing no update on the lease between SELECT and DELETE.
+    /// enforcing no update on the lease between SELECT and DELETE with
+    /// different expiration time.
     virtual bool deleteLease(const Lease4Ptr& lease);
 
     /// @brief Deletes an IPv6 lease.
@@ -477,12 +483,14 @@ public:
     ///
     /// @return true if deletion was successful, false if no such lease exists.
     ///
-    /// @note The old_cltt_ and old_valid_lft_ are used to ensure that only one
-    /// thread or process performs an update or delete operation on the lease by
-    /// matching these values with the expired data in the database.
+    /// @note The current_cltt_ and current_valid_lft_ are used to maximize the
+    /// chance that only one thread or process performs an update or delete
+    /// operation on the lease by matching these values with the expiration time
+    /// data in the database.
     /// @note The DELETE query uses WHERE expire = ? to delete the lease only if
     /// the value matches the one received on the SELECT query, effectively
-    /// enforcing no update on the lease between SELECT and DELETE.
+    /// enforcing no update on the lease between SELECT and DELETE with
+    /// different expiration time.
     virtual bool deleteLease(const Lease6Ptr& lease);
 
     /// @brief Deletes all expired-reclaimed DHCPv4 leases.
index 0e44907f5b2d59780937a9afe8b3e7aa99ab6203..a2113f405807959695362cd29b8eb981844b4c55 100644 (file)
@@ -3610,7 +3610,7 @@ TEST_F(AllocEngine6Test, globalHostReservedAddress) {
     // We verify the "time" change in case the lease returned to us
     // by expectOneLease ever becomes a copy and not what is in the lease mgr.
     --lease->cltt_;
-    lease->updateExistingLifetime();
+    lease->updateCurrentExpirationTime();
     Lease6Ptr from_mgr = LeaseMgrFactory::instance().getLease6(lease->type_,
                                                                lease->addr_);
     ASSERT_TRUE(from_mgr);
@@ -3675,7 +3675,7 @@ TEST_F(AllocEngine6Test, globalHostReservedPrefix) {
     // We verify the "time" change in case the lease returned to us
     // by expectOneLease ever becomes a copy and not what is in the lease mgr.
     --lease->cltt_;
-    lease->updateExistingLifetime();
+    lease->updateCurrentExpirationTime();
     Lease6Ptr from_mgr = LeaseMgrFactory::instance().getLease6(lease->type_,
                                                                lease->addr_);
     ASSERT_TRUE(from_mgr);
index 1eaa775c2f64447ef6d7054ef19776c7100c5ef9..9d7a3f4d843f1926b9d44c6982d56ca4e811d804 100644 (file)
@@ -93,7 +93,7 @@ GenericLeaseMgrTest::initializeLease4(std::string address) {
         lease->client_id_ = ClientIdPtr(new ClientId(vector<uint8_t>(8, 0x42)));
         lease->valid_lft_ = 8677;
         lease->cltt_ = 168256;
-        lease->updateExistingLifetime();
+        lease->updateCurrentExpirationTime();
         lease->subnet_id_ = 23;
         lease->fqdn_rev_ = true;
         lease->fqdn_fwd_ = false;
@@ -105,7 +105,7 @@ GenericLeaseMgrTest::initializeLease4(std::string address) {
             new ClientId(vector<uint8_t>(8, 0x53)));
         lease->valid_lft_ = 3677;
         lease->cltt_ = 123456;
-        lease->updateExistingLifetime();
+        lease->updateCurrentExpirationTime();
         lease->subnet_id_ = 73;
         lease->fqdn_rev_ = true;
         lease->fqdn_fwd_ = true;
@@ -116,7 +116,7 @@ GenericLeaseMgrTest::initializeLease4(std::string address) {
         lease->client_id_ = ClientIdPtr(new ClientId(vector<uint8_t>(8, 0x64)));
         lease->valid_lft_ = 5412;
         lease->cltt_ = 234567;
-        lease->updateExistingLifetime();
+        lease->updateCurrentExpirationTime();
         lease->subnet_id_ = 73;                         // Same as lease 1
         lease->fqdn_rev_ = false;
         lease->fqdn_fwd_ = false;
@@ -134,7 +134,7 @@ GenericLeaseMgrTest::initializeLease4(std::string address) {
         // @TODO: test overflow conditions when code has been fixed.
         lease->valid_lft_ = 7000;
         lease->cltt_ = 234567;
-        lease->updateExistingLifetime();
+        lease->updateCurrentExpirationTime();
         lease->subnet_id_ = 37;
         lease->fqdn_rev_ = true;
         lease->fqdn_fwd_ = true;
@@ -147,7 +147,7 @@ GenericLeaseMgrTest::initializeLease4(std::string address) {
             new ClientId(vector<uint8_t>(8, 0x53)));    // Same as lease 1
         lease->valid_lft_ = 7736;
         lease->cltt_ = 222456;
-        lease->updateExistingLifetime();
+        lease->updateCurrentExpirationTime();
         lease->subnet_id_ = 85;
         lease->fqdn_rev_ = true;
         lease->fqdn_fwd_ = true;
@@ -161,7 +161,7 @@ GenericLeaseMgrTest::initializeLease4(std::string address) {
             new ClientId(vector<uint8_t>(8, 0x53)));    // Same as lease 1
         lease->valid_lft_ = 7832;
         lease->cltt_ = 227476;
-        lease->updateExistingLifetime();
+        lease->updateCurrentExpirationTime();
         lease->subnet_id_ = 175;
         lease->fqdn_rev_ = false;
         lease->fqdn_fwd_ = false;
@@ -175,7 +175,7 @@ GenericLeaseMgrTest::initializeLease4(std::string address) {
             new ClientId(vector<uint8_t>(8, 0x53)));    // Same as lease 1
         lease->valid_lft_ = 1832;
         lease->cltt_ = 627476;
-        lease->updateExistingLifetime();
+        lease->updateCurrentExpirationTime();
         lease->subnet_id_ = 112;
         lease->fqdn_rev_ = false;
         lease->fqdn_fwd_ = true;
@@ -187,7 +187,7 @@ GenericLeaseMgrTest::initializeLease4(std::string address) {
             new ClientId(vector<uint8_t>(8, 0x77)));
         lease->valid_lft_ = 7975;
         lease->cltt_ = 213876;
-        lease->updateExistingLifetime();
+        lease->updateCurrentExpirationTime();
         lease->subnet_id_ = 19;
         lease->fqdn_rev_ = true;
         lease->fqdn_fwd_ = true;
@@ -219,7 +219,7 @@ GenericLeaseMgrTest::initializeLease6(std::string address) {
         lease->preferred_lft_ = 900;
         lease->valid_lft_ = 8677;
         lease->cltt_ = 168256;
-        lease->updateExistingLifetime();
+        lease->updateCurrentExpirationTime();
         lease->subnet_id_ = 23;
         lease->fqdn_fwd_ = true;
         lease->fqdn_rev_ = true;
@@ -233,7 +233,7 @@ GenericLeaseMgrTest::initializeLease6(std::string address) {
         lease->preferred_lft_ = 3600;
         lease->valid_lft_ = 3677;
         lease->cltt_ = 123456;
-        lease->updateExistingLifetime();
+        lease->updateCurrentExpirationTime();
         lease->subnet_id_ = 73;
         lease->fqdn_fwd_ = false;
         lease->fqdn_rev_ = true;
@@ -247,7 +247,7 @@ GenericLeaseMgrTest::initializeLease6(std::string address) {
         lease->preferred_lft_ = 1800;
         lease->valid_lft_ = 5412;
         lease->cltt_ = 234567;
-        lease->updateExistingLifetime();
+        lease->updateCurrentExpirationTime();
         lease->subnet_id_ = 73;                     // Same as lease 1
         lease->fqdn_fwd_ = false;
         lease->fqdn_rev_ = false;
@@ -270,7 +270,7 @@ GenericLeaseMgrTest::initializeLease6(std::string address) {
         lease->preferred_lft_ = 7200;
         lease->valid_lft_ = 7000;
         lease->cltt_ = 234567;
-        lease->updateExistingLifetime();
+        lease->updateCurrentExpirationTime();
         lease->subnet_id_ = 37;
         lease->fqdn_fwd_ = true;
         lease->fqdn_rev_ = false;
@@ -285,7 +285,7 @@ GenericLeaseMgrTest::initializeLease6(std::string address) {
         lease->preferred_lft_ = 4800;
         lease->valid_lft_ = 7736;
         lease->cltt_ = 222456;
-        lease->updateExistingLifetime();
+        lease->updateCurrentExpirationTime();
         lease->subnet_id_ = 671;
         lease->fqdn_fwd_ = true;
         lease->fqdn_rev_ = true;
@@ -301,7 +301,7 @@ GenericLeaseMgrTest::initializeLease6(std::string address) {
         lease->preferred_lft_ = 5400;
         lease->valid_lft_ = 7832;
         lease->cltt_ = 227476;
-        lease->updateExistingLifetime();
+        lease->updateCurrentExpirationTime();
         lease->subnet_id_ = 175;
         lease->fqdn_fwd_ = false;
         lease->fqdn_rev_ = true;
@@ -318,7 +318,7 @@ GenericLeaseMgrTest::initializeLease6(std::string address) {
         lease->preferred_lft_ = 5400;
         lease->valid_lft_ = 1832;
         lease->cltt_ = 627476;
-        lease->updateExistingLifetime();
+        lease->updateCurrentExpirationTime();
         lease->subnet_id_ = 112;
         lease->fqdn_fwd_ = false;
         lease->fqdn_rev_ = true;
@@ -333,7 +333,7 @@ GenericLeaseMgrTest::initializeLease6(std::string address) {
         lease->preferred_lft_ = 5600;
         lease->valid_lft_ = 7975;
         lease->cltt_ = 213876;
-        lease->updateExistingLifetime();
+        lease->updateCurrentExpirationTime();
         lease->subnet_id_ = 19;
         lease->fqdn_fwd_ = false;
         lease->fqdn_rev_ = true;
index c8a05eca0fe0586797a5017d634d231c9e8b4fa1..92e1d21a4f45f51222b078ec86ba6cc91ee98315 100644 (file)
@@ -577,9 +577,9 @@ TEST_F(Lease4Test, fromElement) {
     ASSERT_TRUE(lease->client_id_);
     EXPECT_EQ("17:34:e2:ff:09:92:54", lease->client_id_->toText());
     EXPECT_EQ(12345678, lease->cltt_);
-    EXPECT_EQ(lease->cltt_, lease->old_cltt_);
+    EXPECT_EQ(lease->cltt_, lease->current_cltt_);
     EXPECT_EQ(3600, lease->valid_lft_);
-    EXPECT_EQ(lease->valid_lft_, lease->old_valid_lft_);
+    EXPECT_EQ(lease->valid_lft_, lease->current_valid_lft_);
     EXPECT_TRUE(lease->fqdn_fwd_);
     EXPECT_TRUE(lease->fqdn_rev_);
     EXPECT_EQ("urania.example.org", lease->hostname_);
@@ -1251,9 +1251,9 @@ TEST(Lease6Test, fromElementNA) {
     ASSERT_TRUE(lease->hwaddr_);
     EXPECT_EQ("hwtype=1 08:00:2b:02:3f:4e", lease->hwaddr_->toText());
     EXPECT_EQ(12345678, lease->cltt_);
-    EXPECT_EQ(lease->cltt_, lease->old_cltt_);
+    EXPECT_EQ(lease->cltt_, lease->current_cltt_);
     EXPECT_EQ(800, lease->valid_lft_);
-    EXPECT_EQ(lease->valid_lft_, lease->old_valid_lft_);
+    EXPECT_EQ(lease->valid_lft_, lease->current_valid_lft_);
     EXPECT_FALSE(lease->fqdn_fwd_);
     EXPECT_FALSE(lease->fqdn_rev_);
     EXPECT_EQ("urania.example.org", lease->hostname_);
@@ -1299,9 +1299,9 @@ TEST(Lease6Test, fromElementPD) {
     ASSERT_TRUE(lease->hwaddr_);
     EXPECT_EQ("hwtype=1 08:00:2b:02:3f:4e", lease->hwaddr_->toText());
     EXPECT_EQ(12345678, lease->cltt_);
-    EXPECT_EQ(lease->cltt_, lease->old_cltt_);
+    EXPECT_EQ(lease->cltt_, lease->current_cltt_);
     EXPECT_EQ(600, lease->valid_lft_);
-    EXPECT_EQ(lease->valid_lft_, lease->old_valid_lft_);
+    EXPECT_EQ(lease->valid_lft_, lease->current_valid_lft_);
     EXPECT_FALSE(lease->fqdn_fwd_);
     EXPECT_FALSE(lease->fqdn_rev_);
     EXPECT_EQ("urania.example.org", lease->hostname_);