You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@trafficserver.apache.org by jpeach <gi...@git.apache.org> on 2016/06/13 21:33:03 UTC

[GitHub] trafficserver pull request #704: TS-4531: Clarify time unit confusion in Hos...

GitHub user jpeach opened a pull request:

    https://github.com/apache/trafficserver/pull/704

    TS-4531: Clarify time unit confusion in HostDB sync interval.

    Commit d48b76e tried to fix some of the time unit conversions in
    HostBD, but didn't notice that RefCountedHostsFileMap::next_sync_time
    was getting initialized to a nanosecond timestamp + an interval in
    seconds.
    
    This clarifies most of the timestamps uses in hosts file update
    checking, which are all in Unix epoch seconds. We remove the
    HOST_DB_TIMEOUT_INTERVAL definition since that interval is not
    really a changeable (all the code assumes it is 1 sec).

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/jpeach/trafficserver fix/4531

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/trafficserver/pull/704.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #704
    
----
commit affe97bbd37d9194f4057860ef632a4644c79892
Author: James Peach <jp...@apache.org>
Date:   2016-06-13T21:25:40Z

    TS-4531: Clarify time unit confusion in HostDB sync interval.
    
    Commit d48b76e tried to fix some of the time unit conversions in
    HostBD, but didn't notice that RefCountedHostsFileMap::next_sync_time
    was getting initialized to a nanosecond timestamp + an interval in
    seconds.
    
    This clarifies most of the timestamps uses in hosts file update
    checking, which are all in Unix epoch seconds. We remove the
    HOST_DB_TIMEOUT_INTERVAL definition since that interval is not
    really a changeable (all the code assumes it is 1 sec).

----


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] trafficserver issue #704: TS-4531: Clarify time unit confusion in HostDB syn...

Posted by jpeach <gi...@git.apache.org>.
Github user jpeach commented on the issue:

    https://github.com/apache/trafficserver/pull/704
  
    Oh, I see. I thought that ``HOST_DB_TIMEOUT_INTERVAL`` was intended to be an arbitrary ``hrtime`` value.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] trafficserver issue #704: TS-4531: Clarify time unit confusion in HostDB syn...

Posted by jpeach <gi...@git.apache.org>.
Github user jpeach commented on the issue:

    https://github.com/apache/trafficserver/pull/704
  
    > I looked at the code and I am not of the opinion the code assumes HOST_DB_TIMEOUT_INTERVAL is > one second. For instance, in HostDBContinuation::backgroundEvent it is explicitly scaled by
    > HRTIME_SECOND which is the opposite of assuming it is the specific value one second.
    
    ``HOST_DB_TIMEOUT_INTERVAL`` is in ``hrtime`` units, but the code only works if it is 1 sec. For example, the mtime of the file is used equivalently to the intervals, which can only work if the interval is 1sec, which can only happen if ``HOST_DB_TIMEOUT_INTERVAL`` is 1sec.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] trafficserver issue #704: TS-4531: Clarify time unit confusion in HostDB syn...

Posted by atsci <gi...@git.apache.org>.
Github user atsci commented on the issue:

    https://github.com/apache/trafficserver/pull/704
  
    FreeBSD build *successful*! See https://ci.trafficserver.apache.org/job/Github-FreeBSD/228/ for details.
     



---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] trafficserver issue #704: TS-4531: Clarify time unit confusion in HostDB syn...

Posted by atsci <gi...@git.apache.org>.
Github user atsci commented on the issue:

    https://github.com/apache/trafficserver/pull/704
  
    FreeBSD build *successful*! See https://ci.trafficserver.apache.org/job/Github-FreeBSD/227/ for details.
     



---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] trafficserver issue #704: TS-4531: Clarify time unit confusion in HostDB syn...

Posted by jpeach <gi...@git.apache.org>.
Github user jpeach commented on the issue:

    https://github.com/apache/trafficserver/pull/704
  
    @amc Sounds like you are OK this this? If so I'll merge tomorrow.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] trafficserver issue #704: TS-4531: Clarify time unit confusion in HostDB syn...

Posted by atsci <gi...@git.apache.org>.
Github user atsci commented on the issue:

    https://github.com/apache/trafficserver/pull/704
  
    Linux build *failed*! See https://ci.trafficserver.apache.org/job/Github-Linux/124/ for details.
     



---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] trafficserver issue #704: TS-4531: Clarify time unit confusion in HostDB syn...

Posted by SolidWallOfCode <gi...@git.apache.org>.
Github user SolidWallOfCode commented on the issue:

    https://github.com/apache/trafficserver/pull/704
  
    I looked at the code and I am not of the opinion the code assumes `HOST_DB_TIMEOUT_INTERVAL` is one second. For instance, in `HostDBContinuation::backgroundEvent` it is explicitly scaled by `HRTIME_SECOND` which is the opposite of assuming it is the specific value one second.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] trafficserver issue #704: TS-4531: Clarify time unit confusion in HostDB syn...

Posted by SolidWallOfCode <gi...@git.apache.org>.
Github user SolidWallOfCode commented on the issue:

    https://github.com/apache/trafficserver/pull/704
  
    Right, the interval is presumed to be seconds, which is why `HOST_DB_TIMEOUT_INTERVAL` is scaled by `HRTIME_SECOND` when updating the interval.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] trafficserver pull request #704: TS-4531: Clarify time unit confusion in Hos...

Posted by SolidWallOfCode <gi...@git.apache.org>.
Github user SolidWallOfCode commented on a diff in the pull request:

    https://github.com/apache/trafficserver/pull/704#discussion_r66988505
  
    --- Diff: iocore/hostdb/HostDB.cc ---
    @@ -2224,13 +2227,14 @@ put_hostinfo_ClusterFunction(ClusterHandler *ch, void *data, int /* len ATS_UNUS
     int
     HostDBContinuation::backgroundEvent(int /* event ATS_UNUSED */, Event * /* e ATS_UNUSED */)
     {
    -  ++hostdb_current_interval;
    +  // No nothing if hosts file checking is not enabled.
    +  if (hostdb_hostfile_check_interval == 0) {
    +    return EVENT_CONT;
    --- End diff --
    
    Shouldn't this be `EVENT_DONE`? Because it's done, there is no continuing operation.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] trafficserver pull request #704: TS-4531: Clarify time unit confusion in Hos...

Posted by jpeach <gi...@git.apache.org>.
Github user jpeach commented on a diff in the pull request:

    https://github.com/apache/trafficserver/pull/704#discussion_r66990038
  
    --- Diff: iocore/hostdb/HostDB.cc ---
    @@ -2224,13 +2227,14 @@ put_hostinfo_ClusterFunction(ClusterHandler *ch, void *data, int /* len ATS_UNUS
     int
     HostDBContinuation::backgroundEvent(int /* event ATS_UNUSED */, Event * /* e ATS_UNUSED */)
     {
    -  ++hostdb_current_interval;
    +  // No nothing if hosts file checking is not enabled.
    +  if (hostdb_hostfile_check_interval == 0) {
    +    return EVENT_CONT;
    --- End diff --
    
    The previous logic was to return ``EVENT_CONT``. The background event is written to trigger every second but we only check the actual changes after the check interval. I assumed that it was done this way so that you can update the check interval without having to wait for it to expire.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] trafficserver issue #704: TS-4531: Clarify time unit confusion in HostDB syn...

Posted by SolidWallOfCode <gi...@git.apache.org>.
Github user SolidWallOfCode commented on the issue:

    https://github.com/apache/trafficserver/pull/704
  
    Overall it seems fine to get rid of it.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] trafficserver issue #704: TS-4531: Clarify time unit confusion in HostDB syn...

Posted by atsci <gi...@git.apache.org>.
Github user atsci commented on the issue:

    https://github.com/apache/trafficserver/pull/704
  
    Linux build *successful*! See https://ci.trafficserver.apache.org/job/Github-Linux/125/ for details.
     



---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] trafficserver issue #704: TS-4531: Clarify time unit confusion in HostDB syn...

Posted by jpeach <gi...@git.apache.org>.
Github user jpeach commented on the issue:

    https://github.com/apache/trafficserver/pull/704
  
    Ping @jacksontj @SolidWallOfCode 


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] trafficserver pull request #704: TS-4531: Clarify time unit confusion in Hos...

Posted by jpeach <gi...@git.apache.org>.
Github user jpeach closed the pull request at:

    https://github.com/apache/trafficserver/pull/704


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---