Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve the human readility of the osm2pgsql-replication #1975

Merged
merged 1 commit into from
Jun 28, 2023

Conversation

amandasaurus
Copy link
Contributor

A handful of minor improvements to the osm2pgsql-replication output in this PR.

Here's what the (new) output looks like. changed lines in bold:

2023-06-15 11:48:39 [INFO]: Using replication service 'https://planet.openstreetmap.org/replication/minute/'.
2023-06-15 11:48:39 [INFO]: Local database is at sequence 5619810, which is data up until 5 minute(s) ago (354 seconds ago, 2023-06-15T09:42Z).
2023-06-15 11:48:39 [INFO]: Remote server is at sequence 5619815, which is data up until <1 minute ago (54 seconds ago, 2023-06-15T09:47Z).
2023-06-15 11:48:39 [INFO]: There are 5 sequence(s) on the remote server which will be applied locally. This represents 5 minute(s) (300 sec) of changes.
2023-06-15 11:48:40 osm2pgsql version 1.4.1
2023-06-15 11:48:40 Database version: 12.9 (Ubuntu 12.9-0ubuntu0.20.04.1)
2023-06-15 11:48:40 PostGIS version: 3.0
2023-06-15 11:48:40 Node-cache: cache=800MB, maxblocks=12800*65536, allocation method=11
2023-06-15 11:48:40 Setting up table 'planet_osm_point'
2023-06-15 11:48:40 Setting up table 'planet_osm_line'
2023-06-15 11:48:40 Setting up table 'planet_osm_polygon'
2023-06-15 11:48:40 Setting up table 'planet_osm_roads'
[324B blob data]
2023-06-15 11:48:57 Processed 14086 nodes in 3s - 5k/s
2023-06-15 11:48:57 Processed 1526 ways in 5s - 305/s
2023-06-15 11:48:57 Processed 78 relations in 9s - 9/s
2023-06-15 11:48:58 Going over 725 pending ways (using 4 threads)
[66B blob data]
2023-06-15 11:49:00 Processing 725 pending ways took 2s at a rate of 362.50/s
2023-06-15 11:49:00 Going over 146 pending relations (using 4 threads)
[66B blob data]
2023-06-15 11:49:02 Processing 146 pending relations took 2s at a rate of 73.00/s
2023-06-15 11:49:02 node cache: stored: 13297(100.00%), storage efficiency: 45.84% (dense blocks: 1, sparse nodes: 10408), hit rate: 1.61%
2023-06-15 11:49:02 osm2pgsql took 22s overall.
2023-06-15 11:49:03 [INFO]: Data imported until 2023-06-15T09:47Z. Backlog remaining: 1 minute(s)
2023-06-15 11:49:03 [INFO]: It took <1 minute (23 sec) to apply 5 minute(s) (300 sec) of changes. this is a speed of ×12.9.

Copy link
Collaborator

@lonvia lonvia left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is starting to become a bit too verbose for my taste but will let me be convinced by good arguments to the contrary.

I would say that I'm firmly against are approximate times but it looks like I let this pass already in a previous commit. :(

_base_url, _seq, current_local_timestamp = cur.fetchone()

total_applied_changes_duration_sec = (current_local_timestamp - initial_local_timestamp).total_seconds()
LOG.info("It took %s (%d sec) to apply %s (%d sec) of changes. this is a speed of ×%.1f.",
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this -> This

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe the first three lines can be rolled into one: Applying sequence number 5619810 to 5619815 (2023-06-15T09:42Z to 2023-06-15T09:47Z)

@amandasaurus
Copy link
Contributor Author

amandasaurus commented Jun 20, 2023 via email

@amandasaurus
Copy link
Contributor Author

I would say that I'm firmly against are approximate times but it looks like I let this pass already in a previous commit. :(

If you want to have non-approximate times, I've made a PR #1977 to show that. Apply that or not, it's your call.

@lonvia
Copy link
Collaborator

lonvia commented Jun 26, 2023

If we move it to a higher log level only accessible with '-v' then it would be fine. However, this makes pyosmium more verbose as well which may or may not be an issue.

• No OSM server does subminutely data updates, so don't include seconds
  in outputted timestamps.
• Pretty format the interval, rather than just numbers.
• Show the local & remote status of replication
• Show how long it took to apply the changed & the rate
@amandasaurus
Copy link
Contributor Author

I've made the changes as requested (& merged all into one commit). Most of the new output is only at DEBUG level, and uses fewer lines.

w/o -v the output looks like this:

2023-06-27 16:59:04 [INFO]: Using replication service 'http://download.geofabrik.de/europe/malta-updates'.
2023-06-27 16:59:05  osm2pgsql version 1.8.0
2023-06-27 16:59:05  Database version: 15.3 (Debian 15.3-1.pgdg120+1)
2023-06-27 16:59:05  PostGIS version: 3.3
2023-06-27 16:59:05  Setting up table 'planet_osm_point'
2023-06-27 16:59:05  Setting up table 'planet_osm_line'
2023-06-27 16:59:05  Setting up table 'planet_osm_polygon'
2023-06-27 16:59:05  Setting up table 'planet_osm_roads'
2023-06-27 16:59:05  Reading input files done in 0s.                                      
2023-06-27 16:59:05    Processed 2050 nodes in 0s - 2k/s
2023-06-27 16:59:05    Processed 482 ways in 0s - 482/s
2023-06-27 16:59:05    Processed 14 relations in 0s - 14/s
2023-06-27 16:59:05  Going over 263 pending ways (using 4 threads)
Left to process: 0.....
2023-06-27 16:59:07  Processing 263 pending ways took 2s at a rate of 131.50/s
2023-06-27 16:59:07  Going over 130 pending relations (using 4 threads)
Left to process: 0.....
2023-06-27 16:59:09  Processing 130 pending relations took 2s at a rate of 65.00/s
2023-06-27 16:59:09  Done postprocessing on table 'planet_osm_nodes' in 0s
2023-06-27 16:59:09  Done postprocessing on table 'planet_osm_ways' in 0s
2023-06-27 16:59:09  Done postprocessing on table 'planet_osm_rels' in 0s
2023-06-27 16:59:09  All postprocessing on table 'planet_osm_point' done in 0s.
2023-06-27 16:59:09  All postprocessing on table 'planet_osm_line' done in 0s.
2023-06-27 16:59:09  All postprocessing on table 'planet_osm_polygon' done in 0s.
2023-06-27 16:59:09  All postprocessing on table 'planet_osm_roads' done in 0s.
2023-06-27 16:59:09  osm2pgsql took 4s overall.
2023-06-27 16:59:10 [INFO]: Data imported until 2023-06-26T20:21Z. Backlog remaining: 18 hour(s) 37 minute(s)

w/ -v:

2023-06-27 17:01:44 [INFO]: Using replication service 'http://download.geofabrik.de/europe/malta-updates'.
2023-06-27 17:01:44 [DEBUG]: Starting new HTTP connection (1): download.geofabrik.de:80
2023-06-27 17:01:44 [DEBUG]: http://download.geofabrik.de:80 "GET /europe/malta-updates/state.txt HTTP/1.1" 200 124
2023-06-27 17:01:44 [DEBUG]: Applying 4 sequence(s) (3737 → 3733), covering 4 day(s) 0 hour(s) 0 minute(s) (345623 sec) of changes (2023-06-22T20:21Z → 2023-06-26T20:21Z)
2023-06-27 17:01:44 [DEBUG]: Calling osm2pgsql with: osm2pgsql --append --slim --prefix planet_osm /tmp/tmpgg77v9dm/osm2pgsql_diff.osc.gz
2023-06-27 17:01:44 [DEBUG]: Importing from sequence 3733
2023-06-27 17:01:44 [DEBUG]: Starting new HTTP connection (1): download.geofabrik.de:80
2023-06-27 17:01:44 [DEBUG]: http://download.geofabrik.de:80 "GET /europe/malta-updates/state.txt HTTP/1.1" 200 124
2023-06-27 17:01:44 [DEBUG]: Starting new HTTP connection (1): download.geofabrik.de:80
2023-06-27 17:01:44 [DEBUG]: http://download.geofabrik.de:80 "GET /europe/malta-updates/000/003/734.osc.gz HTTP/1.1" 200 17009
2023-06-27 17:01:44 [DEBUG]: Downloaded change 3734. (511937 kB available in download buffer)
2023-06-27 17:01:44 [DEBUG]: Starting new HTTP connection (1): download.geofabrik.de:80
2023-06-27 17:01:44 [DEBUG]: http://download.geofabrik.de:80 "GET /europe/malta-updates/000/003/735.osc.gz HTTP/1.1" 200 28481
2023-06-27 17:01:44 [DEBUG]: Downloaded change 3735. (511830 kB available in download buffer)
2023-06-27 17:01:44 [DEBUG]: Starting new HTTP connection (1): download.geofabrik.de:80
2023-06-27 17:01:44 [DEBUG]: http://download.geofabrik.de:80 "GET /europe/malta-updates/000/003/736.osc.gz HTTP/1.1" 200 16914
2023-06-27 17:01:44 [DEBUG]: Downloaded change 3736. (511766 kB available in download buffer)
2023-06-27 17:01:44 [DEBUG]: Starting new HTTP connection (1): download.geofabrik.de:80
2023-06-27 17:01:44 [DEBUG]: http://download.geofabrik.de:80 "GET /europe/malta-updates/000/003/737.osc.gz HTTP/1.1" 200 13382
2023-06-27 17:01:44 [DEBUG]: Downloaded change 3737. (511722 kB available in download buffer)
2023-06-27 17:01:44  osm2pgsql version 1.8.0
2023-06-27 17:01:44  Database version: 15.3 (Debian 15.3-1.pgdg120+1)
2023-06-27 17:01:44  PostGIS version: 3.3
2023-06-27 17:01:44  Setting up table 'planet_osm_point'
2023-06-27 17:01:44  Setting up table 'planet_osm_line'
2023-06-27 17:01:44  Setting up table 'planet_osm_polygon'
2023-06-27 17:01:44  Setting up table 'planet_osm_roads'
2023-06-27 17:01:45  Reading input files done in 1s.                                      
2023-06-27 17:01:45    Processed 2050 nodes in 1s - 2k/s
2023-06-27 17:01:45    Processed 482 ways in 0s - 482/s
2023-06-27 17:01:45    Processed 14 relations in 0s - 14/s
2023-06-27 17:01:45  Going over 263 pending ways (using 4 threads)
Left to process: 0.....
2023-06-27 17:01:47  Processing 263 pending ways took 2s at a rate of 131.50/s
2023-06-27 17:01:47  Going over 130 pending relations (using 4 threads)
Left to process: 0.....
2023-06-27 17:01:49  Processing 130 pending relations took 2s at a rate of 65.00/s
2023-06-27 17:01:49  Done postprocessing on table 'planet_osm_nodes' in 0s
2023-06-27 17:01:49  Done postprocessing on table 'planet_osm_ways' in 0s
2023-06-27 17:01:49  Done postprocessing on table 'planet_osm_rels' in 0s
2023-06-27 17:01:49  All postprocessing on table 'planet_osm_point' done in 0s.
2023-06-27 17:01:49  All postprocessing on table 'planet_osm_line' done in 0s.
2023-06-27 17:01:49  All postprocessing on table 'planet_osm_polygon' done in 0s.
2023-06-27 17:01:49  All postprocessing on table 'planet_osm_roads' done in 0s.
2023-06-27 17:01:49  osm2pgsql took 4s overall.
2023-06-27 17:01:49 [DEBUG]: Starting new HTTP connection (1): download.geofabrik.de:80
2023-06-27 17:01:49 [DEBUG]: http://download.geofabrik.de:80 "GET /europe/malta-updates/000/003/737.state.txt HTTP/1.1" 200 124
2023-06-27 17:01:49 [INFO]: Data imported until 2023-06-26T20:21Z. Backlog remaining: 18 hour(s) 39 minute(s)
2023-06-27 17:01:49 [DEBUG]: It took <1 minute (5 sec) to apply 4 day(s) 0 hour(s) 0 minute(s) (345623 sec) of changes. This is a speed of ×65566.7.

@lonvia lonvia merged commit ea1feb2 into osm2pgsql-dev:master Jun 28, 2023
@amandasaurus amandasaurus deleted the repl-output-more-human branch July 3, 2023 08:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants