From 38dc327a378946a7d0177d35f00c7acee69851c4 Mon Sep 17 00:00:00 2001 From: Andy Townsend Date: Fri, 20 Mar 2026 18:14:47 +0000 Subject: [PATCH] Tile dirtying - workaround for "Tiles can get dirtied twice" (94) https://github.com/openstreetmap/mod_tile/issues/494 The code "touchCalendar.tm_year > 105" assumed that tiles after 2005 could not have been marked dirty already. This was true when mod_tile was written but has not been true since 2025. Tiles in this branch and the master branch are dirtied by 20 years. This is relevant if somone uses "time since dirtying" as a metric for deletion, as happens e.g. at https://github.com/SomeoneElseOSM/database_qa_scripts/blob/main/purge_old_tiles.sh#L43 I've changed the test from 105 (== 2005) to 115 (== 2015) which will continue working until 2035 or so. I'd expect the upstream issue to be fixed by then. The oldest non-dirty tile in the "zoom" format (created by one of my branches of the code "zoom", "zoom2022" or "zoom2025" is 2016, which is when the code was first written. The metatile path is incompatible with other branches, so there cannot be older tiles. --- src/store_file.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/store_file.c b/src/store_file.c index b1409aa7..cc672126 100644 --- a/src/store_file.c +++ b/src/store_file.c @@ -278,7 +278,7 @@ static int file_metatile_expire(struct storage_backend * store, const char *xmlc if (!gmtime_r(&(s.st_mtime), &touchCalendar)) { touchTime.modtime = 315558000; } else { - if (touchCalendar.tm_year > 105) { // Tile hasn't already been marked as expired + if (touchCalendar.tm_year > 115) { // Tile hasn't already been marked as expired touchCalendar.tm_year -= 20; //Set back by 20 years, to keep the creation time as reference. touchTime.modtime = mktime(&touchCalendar); } else {