You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@trafficcontrol.apache.org by GitBox <gi...@apache.org> on 2022/02/21 21:40:20 UTC

[GitHub] [trafficcontrol] zrhoffman commented on a change in pull request #6578: Add support for File URLs to database loader

zrhoffman commented on a change in pull request #6578:
URL: https://github.com/apache/trafficcontrol/pull/6578#discussion_r811441229



##########
File path: traffic_router/core/src/main/java/org/apache/traffic_control/traffic_router/core/loc/AbstractServiceUpdater.java
##########
@@ -366,13 +369,15 @@ protected File downloadDatabase(final String url, final File existingDb) throws
 		try (InputStream in = conn.getInputStream();
 			 OutputStream out = new FileOutputStream(outputFile)
 		) {
-			eTag = conn.getHeaderField("ETag");
-
-			if (conn.getResponseCode() == HttpURLConnection.HTTP_NOT_MODIFIED) {
-				LOGGER.info("[" + getClass().getSimpleName() + "] " + url + " not modified since our existing database's last update time of " + new Date(existingDb.lastModified()));
-				return existingDb;
+			if (conn instanceof HttpURLConnection) {
+				eTag = conn.getHeaderField("ETag");
+				if (((HttpURLConnection) conn).getResponseCode() == HttpURLConnection.HTTP_NOT_MODIFIED) {

Review comment:
       If `conn` is a `FileURLConnection`, it should check `conn.getLastModified()` against `existingDb.lastModified()` and return the existing DB if they are the same.

##########
File path: CHANGELOG.md
##########
@@ -8,6 +8,7 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/).
 - Added a new Traffic Ops endpoint to `GET` capacity and telemetry data for CDNi integration.
 - Added a Traffic Ops endpoints to `PUT` a requested configuration change for a full configuration or per host and an endpoint to approve or deny the request.
 - Traffic Monitor config option `distributed_polling` which enables the ability for Traffic Monitor to poll a subset of the CDN and divide into "local peer groups" and "distributed peer groups". Traffic Monitors in the same group are local peers, while Traffic Monitors in other groups are distibuted peers. Each TM group polls the same set of cachegroups and gets availability data for the other cachegroups from other TM groups. This allows each TM to be responsible for polling a subset of the CDN while still having a full view of CDN availability. In order to use this, `stat_polling` must be disabled.
+- Traffic Router: Add support for `file://`-protocol URLs for the `geolocation.polling.url` for the Geolocation database.

Review comment:
       In Java, the `//` is just interpreted as redundant path components for absolute paths. `file:` can be used with a relative paths, so the `//` should be removed.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@trafficcontrol.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org