diff --git a/src/input-handler.cpp b/src/input-handler.cpp index dfd0ea89c..45ed4ed89 100644 --- a/src/input-handler.cpp +++ b/src/input-handler.cpp @@ -10,24 +10,8 @@ input_handler_t::input_handler_t(osmium::Box const &bbox, bool append, : m_data(osmdata), m_bbox(bbox), m_append(append) {} -void input_handler_t::negative_id_warning() -{ - fmt::print( - stderr, - "\nWARNING: The input file contains at least one object with a\n" - " negative id. Negative ids are not properly supported\n" - " in osm2pgsql (and never were). They will not work in\n" - " future versions at all. You can use the osmium tool to\n" - " 'renumber' your file.\n\n"); - m_issued_warning_negative_id = true; -} - void input_handler_t::node(osmium::Node const &node) { - if (node.id() < 0 && !m_issued_warning_negative_id) { - negative_id_warning(); - } - if (m_type != osmium::item_type::node) { m_type = osmium::item_type::node; m_data->flush(); @@ -62,10 +46,6 @@ void input_handler_t::node(osmium::Node const &node) void input_handler_t::way(osmium::Way &way) { - if (way.id() < 0 && !m_issued_warning_negative_id) { - negative_id_warning(); - } - if (m_type != osmium::item_type::way) { m_type = osmium::item_type::way; m_data->flush(); @@ -89,10 +69,6 @@ void input_handler_t::way(osmium::Way &way) void input_handler_t::relation(osmium::Relation const &rel) { - if (rel.id() < 0 && !m_issued_warning_negative_id) { - negative_id_warning(); - } - if (m_type != osmium::item_type::relation) { m_type = osmium::item_type::relation; m_data->flush(); diff --git a/src/input-handler.hpp b/src/input-handler.hpp index dbb791384..4568f7e46 100644 --- a/src/input-handler.hpp +++ b/src/input-handler.hpp @@ -36,8 +36,6 @@ class input_handler_t : public osmium::handler::Handler progress_display_t const &progress() const noexcept { return m_progress; } private: - void negative_id_warning(); - osmdata_t const *m_data; // Bounding box for node import (or invalid Box if everything should be @@ -52,9 +50,6 @@ class input_handler_t : public osmium::handler::Handler // Are we running in append mode? bool m_append; - - // Has a warning about a negative id already been issued? - bool m_issued_warning_negative_id = false; }; #endif // OSM2PGSQL_INPUT_HANDLER_HPP diff --git a/src/middle-pgsql.cpp b/src/middle-pgsql.cpp index 7afbfd7f7..613a8f182 100644 --- a/src/middle-pgsql.cpp +++ b/src/middle-pgsql.cpp @@ -760,7 +760,8 @@ middle_pgsql_t::middle_pgsql_t(options_t const *options) bool const has_bucket_index = check_bucket_index(&m_db_connection, options->prefix); - if (!has_bucket_index && options->append) { + if (!has_bucket_index && options->append && + options->with_forward_dependencies) { log_warn("You don't have a bucket index. See manual for details."); } diff --git a/src/node-ram-cache.cpp b/src/node-ram-cache.cpp index affdc6e10..5fc30fa08 100644 --- a/src/node-ram-cache.cpp +++ b/src/node-ram-cache.cpp @@ -240,14 +240,9 @@ void node_ram_cache::set_dense(osmid_t id, osmium::Location location) } if (queue[expectedpos] != &blocks[block]) { - if (m_warn_node_order) { - log_warn("Found out of order node {}" - " ({},{}) - this will impact the cache efficiency", - id, block, offset); - - // Only warn once - m_warn_node_order = false; - } + // This can only happen if the node is out of order which it + // should never be because of earlier checks for that. + // Ignore the node. return; } } diff --git a/src/node-ram-cache.hpp b/src/node-ram-cache.hpp index 8b4d3af17..f0337105b 100644 --- a/src/node-ram-cache.hpp +++ b/src/node-ram-cache.hpp @@ -124,8 +124,6 @@ class node_ram_cache osmid_t totalNodes = 0; long nodesCacheHits = 0; long nodesCacheLookups = 0; - - bool m_warn_node_order = true; }; #endif // OSM2PGSQL_NODE_RAM_CACHE_HPP diff --git a/src/options.cpp b/src/options.cpp index 96405325c..fa208cf6a 100644 --- a/src/options.cpp +++ b/src/options.cpp @@ -556,6 +556,17 @@ options_t::options_t(int argc, char *argv[]) : options_t() break; case 205: num_procs = atoi(optarg); + if (num_procs < 1) { + log_warn("--number-processes must be at least 1. Using 1."); + num_procs = 1; + } else if (num_procs > 32) { + // The threads will open up database connections which will + // run out at some point. It depends on the number of tables + // how many connections there are. The number 32 is way beyond + // anything that will make sense here. + log_warn("--number-processes too large. Set to 32."); + num_procs = 32; + } break; case 206: droptemp = true; @@ -706,7 +717,8 @@ void options_t::check_options() if (enable_hstore_index && hstore_mode == hstore_column::none && hstore_columns.empty()) { - log_warn("--hstore-add-index only makes sense with hstore enabled."); + log_warn("--hstore-add-index only makes sense with hstore enabled; " + "ignored."); enable_hstore_index = false; } @@ -726,24 +738,14 @@ void options_t::check_options() } } - if (num_procs < 1) { - num_procs = 1; - log_warn("Must use at least 1 process."); - } - - if (sizeof(int *) == 4 && !slim) { - log_warn( - "This is a 32bit system with not a lot of RAM. Try using --slim."); - } - // zoom level 31 is the technical limit because we use 32-bit integers for the x and y index of a tile ID - if (expire_tiles_zoom_min >= 32) { + if (expire_tiles_zoom_min > 31) { expire_tiles_zoom_min = 31; log_warn("Minimum zoom level for tile expiry is too " "large and has been set to 31."); } - if (expire_tiles_zoom >= 32) { + if (expire_tiles_zoom > 31) { expire_tiles_zoom = 31; log_warn("Maximum zoom level for tile expiry is too " "large and has been set to 31."); diff --git a/src/osm2pgsql.cpp b/src/osm2pgsql.cpp index efc1fd788..d146e9671 100644 --- a/src/osm2pgsql.cpp +++ b/src/osm2pgsql.cpp @@ -64,7 +64,8 @@ prepare_input_files(options_t const &options) if (file.format() == osmium::io::file_format::unknown) { if (options.input_format.empty()) { throw std::runtime_error{ - "Cannot detect file format. Try using -r."}; + "Cannot detect file format for '{}'. Try using -r."_format( + filename)}; } throw std::runtime_error{ "Unknown file format '{}'."_format(options.input_format)};