[OSM-dev] osm2pgsql-64 and benchmarks

Anthony osm at inbox.org
Tue Jun 28 15:18:13 BST 2011


Need something along the lines of this to avoid a segfault:

Index: middle-pgsql.c
===================================================================
--- middle-pgsql.c      (revision 26198)
+++ middle-pgsql.c      (working copy)
@@ -121,6 +121,7 @@

 static const int num_tables = sizeof(tables)/sizeof(tables[0]);
 static int warn_node_order;
+static int warn_node_mega;
 static struct table_desc *node_table = &tables[t_node];
 static struct table_desc *way_table  = &tables[t_way];
 static struct table_desc *rel_table  = &tables[t_rel];
@@ -232,6 +233,14 @@

     totalNodes++;

+    if (block>=NUM_BLOCKS) {
+        if (!warn_node_mega) {
+            fprintf( stderr, "WARNING: Found megasized %" PRIdOSMID "
(%d,%d) - this will impact the cache efficiency\n", id, block, offset
);
+            warn_node_mega++;
+        }
+        return 1;
+    }
+
     if (!blocks[block].nodes) {
         if( usedBlocks < maxBlocks )
         {
@@ -338,6 +347,14 @@
     int offset = id2offset(id);
     nodesCacheLookups++;

+    if (block>=NUM_BLOCKS) {
+        if (!warn_node_mega) {
+            fprintf( stderr, "WARNING: Found megasized %" PRIdOSMID "
(%d,%d) - this probably did not impact the cache efficiency\n", id,
block, offset );
+            warn_node_mega++;
+        }
+        return 1;
+    }
+
     if (!blocks[block].nodes)
         return 1;



More information about the dev mailing list