Skip to content
This repository was archived by the owner on Nov 24, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/).
- [#7641](https://github.com/apache/trafficcontrol/pull/7641) *Traffic Router* Added further optimization to TR's algorithm of figuring out the zone for an incoming request.
- [#7646](https://github.com/apache/trafficcontrol/pull/7646) *Traffic Portal* Add the ability to delete a cert.
- [#7652](https://github.com/apache/trafficcontrol/pull/7652) *t3c* added rpmdb checks and use package data from t3c-apply-metadata.json if rpmdb is corrupt.
- [#7674](https://github.com/apache/trafficcontrol/issues/7674) *Traffic Ops* Add the ability to indicate if a server failed its revalidate/config update.

### Changed
- [#7732](https://github.com/apache/trafficcontrol/pull/7732) *Traffic Router* Increased negative TTL value to 900 seconds.
Expand Down
20 changes: 14 additions & 6 deletions docs/source/api/v5/servers.rst
Original file line number Diff line number Diff line change
Expand Up @@ -108,8 +108,9 @@ Response Structure
.. versionchanged:: 5.0
In earlier versions of the API, this field was known by the name ``cdnName``. It has been changed for consistency with others e.g. ``type``, ``status``, etc.

:configUpdateTime: The last time an update was requested for this server. This field defaults to standard epoch
:configApplyTime: The last time an update was applied for this server. This field defaults to standard epoch
:configUpdateTime: The last time an update was requested for this server. This field defaults to standard epoch
:configApplyTime: The last time an update was applied for this server. This field defaults to standard epoch
:configUpdateFailed: If the last update applied for this server was applied successfully. Defaults to false.
:domainName: The domain part of the server's :abbr:`FQDN (Fully Qualified Domain Name)`
:guid: An identifier used to uniquely identify the server

Expand Down Expand Up @@ -177,10 +178,11 @@ Response Structure
.. versionchanged:: 5.0
In earlier versions of the API, this field was known by the name ``profileNames`` - it has been changed because now that this is the only identifying information for a :term:Profile that exists on a server, there is no need to distinguish it from, say, an ID.

:revalUpdateTime: The last time a content invalidation/revalidation request was submitted for this server. This field defaults to standard epoch
:revalApplyTime: The last time a content invalidation/revalidation request was applied by this server. This field defaults to standard epoch
:rack: A string indicating "server rack" location
:status: The :term:`Status` of the server
:revalUpdateTime: The last time a content invalidation/revalidation request was submitted for this server. This field defaults to standard epoch
:revalApplyTime: The last time a content invalidation/revalidation request was applied by this server. This field defaults to standard epoch
:revalUpdateFailed: If the last content invalidation/revalidation applied for this server was applied successfully. Defaults to false.
:rack: A string indicating "server rack" location
:status: The :term:`Status` of the server

.. seealso:: :ref:`health-proto`

Expand Down Expand Up @@ -223,6 +225,7 @@ Response Structure
"cdn": "CDN-in-a-Box",
"configUpdateTime": "1969-12-31T17:00:00-07:00",
"configApplyTime": "1969-12-31T17:00:00-07:00",
"configUpdateFailed": false,
"domainName": "infra.ciab.test",
"guid": null,
"hostName": "mid",
Expand All @@ -244,6 +247,7 @@ Response Structure
"rack": "",
"revalUpdateTime": "1969-12-31T17:00:00-07:00",
"revalApplyTime": "1969-12-31T17:00:00-07:00",
"revalUpdateFailed": false,
"status": "REPORTED",
"statusID": 3,
"tcpPort": 80,
Expand Down Expand Up @@ -444,6 +448,7 @@ Response Structure

:configUpdateTime: The last time an update was requested for this server. This field defaults to standard epoch
:configApplyTime: The last time an update was applied for this server. This field defaults to standard epoch
:configUpdateFailed: If the last update applied for this server was applied successfully. Defaults to false.
:domainName: The domain part of the server's :abbr:`FQDN (Fully Qualified Domain Name)`
:guid: An identifier used to uniquely identify the server

Expand Down Expand Up @@ -513,6 +518,7 @@ Response Structure

:revalUpdateTime: The last time a content invalidation/revalidation request was submitted for this server. This field defaults to standard epoch
:revalApplyTime: The last time a content invalidation/revalidation request was applied by this server. This field defaults to standard epoch
:revalUpdateFailed: If the last content invalidation/revalidation applied for this server was applied successfully. Defaults to false.
:rack: A string indicating "server rack" location
:status: The status of the server

Expand Down Expand Up @@ -563,6 +569,7 @@ Response Structure
"cdn": "CDN-in-a-Box",
"configUpdateTime": "1969-12-31T17:00:00-07:00",
"configApplyTime": "1969-12-31T17:00:00-07:00",
"configUpdateFailed": false,
"domainName": "infra.ciab.test",
"guid": null,
"hostName": "test",
Expand All @@ -584,6 +591,7 @@ Response Structure
"rack": null,
"revalUpdateTime": "1969-12-31T17:00:00-07:00",
"revalApplyTime": "1969-12-31T17:00:00-07:00",
"revalUpdateFailed": false,
"status": "REPORTED",
"statusID": 3,
"tcpPort": 80,
Expand Down
6 changes: 5 additions & 1 deletion docs/source/api/v5/servers_hostname_update.rst
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,12 @@ Request Structure
+----------------------------+----------+--------------------------------------------------------------------------------------------------------------+
| config_apply_time | no | The value to set for when a queue update is applied for this server. Must be a valid RFC333Nano timestamp. |
+----------------------------+----------+--------------------------------------------------------------------------------------------------------------+
| config_update_failed | no | The value to set for when a queue update is applied for this server. May be 'true' or 'false'. |
+----------------------------+----------+--------------------------------------------------------------------------------------------------------------+
| revalidate_apply_time | no | The value to set for when a reval update is applied for this server. Must be a valid RFC333Nano timestamp. |
+----------------------------+----------+--------------------------------------------------------------------------------------------------------------+
| revalidate_update_failed | no | The value to set for when a reval update is applied for this server. May be 'true' or 'false'. |
+----------------------------+----------+--------------------------------------------------------------------------------------------------------------+

.. note:: While none of the timestamps is required individually, at least one must be sent to the API.

Expand Down Expand Up @@ -87,7 +91,7 @@ Response Structure
"alerts" :
[
{
"text" : "successfully set server 'my-edge' config_apply_time=2022-01-31T12:00:00.123456-07:00 revalidate_apply_time=2022-01-31T12:00:00.123456-07:00",
"text" : "successfully set server 'my-edge' config_apply_time=2022-01-31T12:00:00.123456-07:00 revalidate_apply_time=2022-01-31T12:00:00.123456-07:00 config_update_failed false revalidate_update_failed false",
"level" : "success"
}
]
Expand Down
2 changes: 2 additions & 0 deletions docs/source/api/v5/servers_hostname_update_status.rst
Original file line number Diff line number Diff line change
Expand Up @@ -55,13 +55,15 @@ Each object in the returned array\ [#uniqueness]_ will contain the following fie

:configUpdateTime: The last time an update was requested for this server. This field defaults to standard epoch
:configApplyTime: The last time an update was applied for this server. This field defaults to standard epoch
:configUpdateFailed: The status of the last time an update was applied by this server. Defaults to ``false``
:host_id: The integral, unique identifier for the server for which the other fields in this object represent the pending updates and revalidation status
:host_name: The (short) hostname of the server for which the other fields in this object represent the pending updates and revalidation status
:parent_pending: A boolean telling whether or not any :term:`Topology` ancestor or :term:`parent` of this server has pending updates
:parent_reval_pending: A boolean telling whether or not any :term:`Topology` ancestor or :term:`parent` of this server has pending :term:`Content Invalidation Jobs`
:reval_pending: ``true`` if the server has pending :term:`Content Invalidation Jobs`, ``false`` otherwise
:revalUpdateTime: The last time a content invalidation/revalidation request was submitted for this server. This field defaults to standard epoch
:revalApplyTime: The last time a content invalidation/revalidation request was applied by this server. This field defaults to standard epoch
:revalUpdateFailed: The status of the last time a content invalidation/revalidation request was applied by this server. Defaults to ``false``
:status: The name of the status of this server

.. seealso:: :ref:`health-proto` gives more information on how these statuses are used, and the ``GET`` method of the :ref:`to-api-statuses` endpoint can be used to retrieve information about all server statuses configured in Traffic Ops.
Expand Down
70 changes: 68 additions & 2 deletions lib/go-tc/servers.go
Original file line number Diff line number Diff line change
Expand Up @@ -1320,7 +1320,9 @@ type ServerV50 struct {
ConfigApplyTime *time.Time `json:"configApplyTime" db:"config_apply_time"`
// The time at which configuration updates were last queued for this server.
ConfigUpdateTime *time.Time `json:"configUpdateTime" db:"config_update_time"`
DomainName string `json:"domainName" db:"domain_name"`
// If the last config apply failed for this server
ConfigUpdateFailed bool `json:"configUpdateFailed" db:"config_update_failed"`
DomainName string `json:"domainName" db:"domain_name"`
// Deprecated: This property has unknown purpose and should not be used so
// that we can get rid of it.
GUID *string `json:"guid" db:"guid"`
Expand Down Expand Up @@ -1356,7 +1358,9 @@ type ServerV50 struct {
// The time at which revalidations for this server were last updated by t3c.
RevalApplyTime *time.Time `json:"revalApplyTime" db:"revalidate_apply_time"`
// The time at which revalidations were last queued for this server.
RevalUpdateTime *time.Time `json:"revalUpdateTime" db:"revalidate_update_time"`
RevalUpdateTime *time.Time `json:"revalUpdateTime" db:"revalidate_update_time"`
// If the last reval apply failed for this server
RevalUpdateFailed bool `json:"revalUpdateFailed" db:"revalidate_update_failed"`
Status string `json:"status" db:"status"`
StatusID int `json:"statusID" db:"status_id"`
StatusLastUpdated *time.Time `json:"statusLastUpdated" db:"status_last_updated"`
Expand Down Expand Up @@ -1437,6 +1441,55 @@ func (s ServerV50) RevalidationPending() bool {
// version 5 of the Traffic Ops API.
type ServerV5 = ServerV50

// ServerUpdateStatusV5 is the type of each entry in the `response` property of
// the response from Traffic Ops to GET requests made to its
// /servers/{{host name}}/update_status in the latest minor API
// v5.0 endpoint.
type ServerUpdateStatusV5 ServerUpdateStatusV50

// ServerUpdateStatusV50 is the type of each entry in the `response` property of
// the response from Traffic Ops to GET requests made to its
// /servers/{{host name}}/update_status in API v5.0 endpoint.
type ServerUpdateStatusV50 struct {
HostName string `json:"host_name"`
// Deprecated: In APIv5 and later, this extraneous field is not calculated
// by Traffic Ops; the information is available by comparing ConfigUpdateTime
// to ConfigApplyTime.
UpdatePending bool `json:"upd_pending"`
// Deprecated: In APIv5 and later, this extraneous field is not calculated
// by Traffic Ops; the information is available by comparing RevalUpdateTime
// to RevalApplyTime.
RevalPending bool `json:"reval_pending"`
UseRevalPending bool `json:"use_reval_pending"`
HostId int `json:"host_id"`
Status string `json:"status"`
ParentPending bool `json:"parent_pending"`
ParentRevalPending bool `json:"parent_reval_pending"`
ConfigUpdateTime *time.Time `json:"config_update_time"`
ConfigApplyTime *time.Time `json:"config_apply_time"`
ConfigUpdateFailed *bool `json:"config_update_failed"`
RevalidateUpdateTime *time.Time `json:"revalidate_update_time"`
RevalidateApplyTime *time.Time `json:"revalidate_apply_time"`
RevalidateUpdateFailed *bool `json:"revalidate_update_failed"`
}

func (sus ServerUpdateStatusV5) Downgrade() ServerUpdateStatusV40 {
return ServerUpdateStatusV40{
sus.HostName,
sus.UpdatePending,
sus.RevalPending,
sus.UseRevalPending,
sus.HostId,
sus.Status,
sus.ParentPending,
sus.ParentRevalPending,
sus.ConfigUpdateTime,
sus.ConfigApplyTime,
sus.RevalidateUpdateTime,
sus.RevalidateApplyTime,
}
}

// ServerUpdateStatusV4 is the type of each entry in the `response` property of
// the response from Traffic Ops to GET requests made to its
// /servers/{{host name}}/update_status in the latest minor API
Expand Down Expand Up @@ -1517,6 +1570,19 @@ func (sus ServerUpdateStatus) Upgrade() ServerUpdateStatusV4 {
}
}

// ServerUpdateStatusResponseV50 is the type of a response from the Traffic
// Ops API to a request to its /servers/{{host name}}/update_status endpoint
// in API version 5.0.
type ServerUpdateStatusResponseV50 struct {
Response []ServerUpdateStatusV50 `json:"response"`
Alerts
}

// ServerUpdateStatusResponseV5 is the type of a response from the Traffic
// Ops API to a request to its /servers/{{host name}}/update_status endpoint
// in the latest minor version of API version 5.
type ServerUpdateStatusResponseV5 = ServerUpdateStatusResponseV50

// ServerUpdateStatusResponseV40 is the type of a response from the Traffic
// Ops API to a request to its /servers/{{host name}}/update_status endpoint
// in API version 4.0.
Expand Down
12 changes: 7 additions & 5 deletions lib/go-tc/servers_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -183,11 +183,13 @@ func TestServerV5DowngradeUpgrade(t *testing.T) {
RouterPortName: "router port",
},
},
StatusLastUpdated: nil,
ConfigUpdateTime: nil,
ConfigApplyTime: nil,
RevalUpdateTime: nil,
RevalApplyTime: nil,
StatusLastUpdated: nil,
ConfigUpdateTime: nil,
ConfigApplyTime: nil,
ConfigUpdateFailed: false,
RevalUpdateTime: nil,
RevalApplyTime: nil,
RevalUpdateFailed: false,
}

serverV4 := serverV5.Downgrade()
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with this
* work for additional information regarding copyright ownership. The ASF
* licenses this file to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations under
* the License.
*/

ALTER TABLE public.server
DROP COLUMN IF EXISTS config_update_failed,
DROP COLUMN IF EXISTS revalidate_update_failed;
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with this
* work for additional information regarding copyright ownership. The ASF
* licenses this file to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations under
* the License.
*/

ALTER TABLE public.server
ADD COLUMN IF NOT EXISTS config_update_failed boolean NOT NULL DEFAULT false,
ADD COLUMN IF NOT EXISTS revalidate_update_failed boolean NOT NULL DEFAULT false;
20 changes: 15 additions & 5 deletions traffic_ops/testing/api/v5/cdn_locks_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -123,19 +123,21 @@ func TestCDNLocks(t *testing.T) {
ClientSession: opsUserWithLockSession,
RequestOpts: client.RequestOptions{QueryParameters: url.Values{"hostName": {"cdn2-test-edge"}}},
RequestBody: map[string]interface{}{
"config_apply_time": util.TimePtr(now),
"config_apply_time": util.Ptr(now),
"config_update_failed": util.Ptr(true),
},
Expectations: utils.CkRequest(utils.NoError(), utils.HasStatus(http.StatusOK),
validateServerApplyTimes("cdn2-test-edge", map[string]interface{}{"ConfigApplyTime": now})),
validateServerApplyTimes("cdn2-test-edge", map[string]interface{}{"ConfigApplyTime": now, "ConfigUpdateFailed": true})),
},
"REVALIDATE_APPLY_TIME is SET EVEN when CDN LOCKED": {
ClientSession: opsUserWithLockSession,
RequestOpts: client.RequestOptions{QueryParameters: url.Values{"hostName": {"cdn2-test-edge"}}},
RequestBody: map[string]interface{}{
"revalidate_apply_time": util.TimePtr(now),
"revalidate_apply_time": util.Ptr(now),
"revalidate_update_failed": util.Ptr(true),
},
Expectations: utils.CkRequest(utils.NoError(), utils.HasStatus(http.StatusOK),
validateServerApplyTimes("cdn2-test-edge", map[string]interface{}{"RevalApplyTime": now})),
validateServerApplyTimes("cdn2-test-edge", map[string]interface{}{"RevalApplyTime": now, "RevalUpdateFailed": true})),
},
},
"TOPOLOGY QUEUE UPDATES": {
Expand Down Expand Up @@ -544,6 +546,8 @@ func TestCDNLocks(t *testing.T) {
var hostName string
var configApplyTime *time.Time
var revalApplyTime *time.Time
var revalUpdateFailed *bool
var configUpdateFailed *bool

if hostNameParam, ok := testCase.RequestOpts.QueryParameters["hostName"]; ok {
hostName = hostNameParam[0]
Expand All @@ -554,7 +558,13 @@ func TestCDNLocks(t *testing.T) {
if revalApplyTimeVal, ok := testCase.RequestBody["revalidate_apply_time"]; ok {
revalApplyTime = revalApplyTimeVal.(*time.Time)
}
alerts, reqInf, err := testCase.ClientSession.SetUpdateServerStatusTimes(hostName, configApplyTime, revalApplyTime, testCase.RequestOpts)
if val, ok := testCase.RequestBody["config_update_failed"]; ok {
configUpdateFailed = val.(*bool)
}
if val, ok := testCase.RequestBody["revalidate_update_failed"]; ok {
revalUpdateFailed = val.(*bool)
}
alerts, reqInf, err := testCase.ClientSession.SetUpdateServerStatusTimes(hostName, configApplyTime, revalApplyTime, configUpdateFailed, revalUpdateFailed, testCase.RequestOpts)
for _, check := range testCase.Expectations {
check(t, reqInf, nil, alerts, err)
}
Expand Down
Loading