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

Skip optimize #895

Closed
wants to merge 7 commits into from
Closed
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
84 changes: 49 additions & 35 deletions options.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,40 +31,39 @@ extern "C" {
namespace
{
const char * short_options = "ab:cd:KhlmMp:suvU:WH:P:i:IE:C:S:e:o:O:xkjGz:r:VF:";
const struct option long_options[] =
{
{"append", 0, 0, 'a'},
{"bbox", 1, 0, 'b'},
{"create", 0, 0, 'c'},
const struct option long_options[] = {
{"append", 0, 0, 'a'},
{"bbox", 1, 0, 'b'},
{"create", 0, 0, 'c'},
{"database", 1, 0, 'd'},
{"latlong", 0, 0, 'l'},
{"verbose", 0, 0, 'v'},
{"slim", 0, 0, 's'},
{"prefix", 1, 0, 'p'},
{"proj", 1, 0, 'E'},
{"merc", 0, 0, 'm'},
{"cache", 1, 0, 'C'},
{"latlong", 0, 0, 'l'},
{"verbose", 0, 0, 'v'},
{"slim", 0, 0, 's'},
{"prefix", 1, 0, 'p'},
{"proj", 1, 0, 'E'},
{"merc", 0, 0, 'm'},
{"cache", 1, 0, 'C'},
{"username", 1, 0, 'U'},
{"password", 0, 0, 'W'},
{"host", 1, 0, 'H'},
{"port", 1, 0, 'P'},
{"host", 1, 0, 'H'},
{"port", 1, 0, 'P'},
{"tablespace-index", 1, 0, 'i'},
{"tablespace-slim-data", 1, 0, 200},
{"tablespace-slim-index", 1, 0, 201},
{"tablespace-main-data", 1, 0, 202},
{"tablespace-main-index", 1, 0, 203},
{"help", 0, 0, 'h'},
{"style", 1, 0, 'S'},
{"help", 0, 0, 'h'},
{"style", 1, 0, 'S'},
{"expire-tiles", 1, 0, 'e'},
{"expire-output", 1, 0, 'o'},
{"expire-bbox-size", 1, 0, 214},
{"output", 1, 0, 'O'},
{"output", 1, 0, 'O'},
{"extra-attributes", 0, 0, 'x'},
{"hstore", 0, 0, 'k'},
{"hstore-all", 0, 0, 'j'},
{"hstore-column", 1, 0, 'z'},
{"hstore-match-only", 0, 0, 208},
{"hstore-add-index",0,0,211},
{"hstore-add-index", 0, 0, 211},
{"multi-geometry", 0, 0, 'G'},
{"keep-coastlines", 0, 0, 'K'},
{"input-reader", 1, 0, 'r'},
Expand All @@ -74,11 +73,12 @@ namespace
{"number-processes", 1, 0, 205},
{"drop", 0, 0, 206},
{"unlogged", 0, 0, 207},
{"flat-nodes",1,0, 'F'},
{"tag-transform-script",1,0,212},
{"reproject-area",0,0,213},
{0, 0, 0, 0}
};
{"flat-nodes", 1, 0, 'F'},
{"tag-transform-script", 1, 0, 212},
{"reproject-area", 0, 0, 213},
{"skip-optimizing", 0, 0, 215},
{"skip-indexing", 0, 0, 216},
{0, 0, 0, 0}};

void short_usage(char *arg0)
{
Expand Down Expand Up @@ -219,6 +219,8 @@ namespace
-K|--keep-coastlines Keep coastline data rather than filtering it out.\n\
By default natural=coastline tagged data will be discarded\n\
because renderers usually have shape files for them.\n\
--skip-optimizing Do not optimize DB after fresh import. \n\
--skip-indexing Do not build any indexes after import.\n\
--reproject-area compute area column using spherical mercator coordinates.\n\
-h|--help Help information.\n\
-v|--verbose Verbose output.\n");
Expand Down Expand Up @@ -283,24 +285,25 @@ options_t::options_t()
projection(reprojection::create_projection(PROJ_SPHERE_MERC)), append(false),
slim(false), cache(800), tblsmain_index(boost::none),
tblsslim_index(boost::none), tblsmain_data(boost::none),
tblsslim_data(boost::none), style(DEFAULT_STYLE),
expire_tiles_zoom(0), expire_tiles_zoom_min(0),
expire_tiles_max_bbox(20000.0), expire_tiles_filename("dirty_tiles"),
hstore_mode(HSTORE_NONE), enable_hstore_index(false), enable_multi(false),
hstore_columns(), keep_coastlines(false), parallel_indexing(true),
tblsslim_data(boost::none), style(DEFAULT_STYLE), expire_tiles_zoom(0),
expire_tiles_zoom_min(0), expire_tiles_max_bbox(20000.0),
expire_tiles_filename("dirty_tiles"), hstore_mode(HSTORE_NONE),
enable_hstore_index(false), enable_multi(false), hstore_columns(),
keep_coastlines(false), parallel_indexing(true),
#ifdef __amd64__
alloc_chunkwise(ALLOC_SPARSE | ALLOC_DENSE),
#else
alloc_chunkwise(ALLOC_SPARSE),
#endif
droptemp(false), unlogged(false), hstore_match_only(false),
flat_node_cache_enabled(false), reproject_area(false),
flat_node_file(boost::none), tag_transform_script(boost::none),
tag_transform_node_func(boost::none), tag_transform_way_func(boost::none),
tag_transform_rel_func(boost::none), tag_transform_rel_mem_func(boost::none),
create(false), long_usage_bool(false), pass_prompt(false),
output_backend("pgsql"), input_reader("auto"), bbox(boost::none),
extra_attributes(false), verbose(false)
flat_node_cache_enabled(false), reproject_area(false), skip_optimizing(false),
skip_indexing(false), flat_node_file(boost::none),
tag_transform_script(boost::none), tag_transform_node_func(boost::none),
tag_transform_way_func(boost::none), tag_transform_rel_func(boost::none),
tag_transform_rel_mem_func(boost::none), create(false),
long_usage_bool(false), pass_prompt(false), output_backend("pgsql"),
input_reader("auto"), bbox(boost::none), extra_attributes(false),
verbose(false)
{
num_procs = std::thread::hardware_concurrency();
if (num_procs < 1) {
Expand Down Expand Up @@ -507,6 +510,12 @@ options_t::options_t(int argc, char *argv[]): options_t()
case 213:
reproject_area = true;
break;
case 215:
skip_optimizing = true;
break;
case 216:
skip_indexing = true;
break;
case 'V':
fprintf(stderr, "Compiled using the following library versions:\n");
fprintf(stderr, "Libosmium %s\n", LIBOSMIUM_VERSION_STRING);
Expand Down Expand Up @@ -576,6 +585,11 @@ void options_t::check_options()
unlogged = false;
}

if (enable_hstore_index && skip_indexing) {
throw std::runtime_error("Error: --hstore-add-index and "
"--skip-indexing are mutually exclusive.\n");
}

if (hstore_mode == HSTORE_NONE && hstore_columns.size() == 0 && hstore_match_only) {
fprintf(stderr, "Warning: --hstore-match-only only makes sense with --hstore, --hstore-all, or --hstore-column; ignored.\n");
hstore_match_only = false;
Expand Down
2 changes: 2 additions & 0 deletions options.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,8 @@ struct options_t {
bool hstore_match_only; ///< only copy rows that match an explicitly listed key
bool flat_node_cache_enabled;
bool reproject_area;
bool skip_optimizing;
bool skip_indexing;
boost::optional<std::string> flat_node_file;
/**
* these options allow you to control the name of the
Expand Down
3 changes: 2 additions & 1 deletion output-multi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@ output_multi_t::output_multi_t(const std::string &name,
m_table(new table_t(
m_options.database_options.conninfo(), name, m_processor->column_type(),
m_export_list->normal_columns(m_osm_type), m_options.hstore_columns,
m_processor->srid(), m_options.append, m_options.slim, m_options.droptemp,
m_processor->srid(), m_options.append, m_options.skip_optimizing,
m_options.skip_indexing, m_options.slim, m_options.droptemp,
m_options.hstore_mode, m_options.enable_hstore_index,
m_options.tblsmain_data, m_options.tblsmain_index)),
ways_done_tracker(new id_tracker()),
Expand Down
3 changes: 2 additions & 1 deletion output-pgsql.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -570,7 +570,8 @@ output_pgsql_t::output_pgsql_t(const middle_query_t *mid, const options_t &o)
m_tables.push_back(std::shared_ptr<table_t>(new table_t(
m_options.database_options.conninfo(), name, type, columns,
m_options.hstore_columns, m_options.projection->target_srs(),
m_options.append, m_options.slim, m_options.droptemp,
m_options.append, m_options.skip_optimizing,
m_options.skip_indexing, m_options.slim, m_options.droptemp,
m_options.hstore_mode, m_options.enable_hstore_index,
m_options.tblsmain_data, m_options.tblsmain_index)));
}
Expand Down
Loading