Permalink
Browse files

Patched some remaining bugs.

  • Loading branch information...
1 parent f2a00ca commit 07b9df237f4604a006a887054c119b1a1dffaa46 Roland Olbricht committed Jul 8, 2011
Showing with 49 additions and 34 deletions.
  1. +2 −2 CHANGELOG
  2. +1 −1 rules/areas.osm3s
  3. +3 −3 src/bin/rules_loop.sh
  4. +43 −28 src/template_db/dispatcher.cc
View
@@ -1,11 +1,11 @@
=[http://www.overpass-api.de/misc/osm-3s_v0.6.91.tar.gz OSM3S v0.6.91]=
-Released: 2011-07-04
+Released: 2011-07-05
==Database changes==
-This version is binary compatible to [[#OSM3S v0.6.91|OSM3S v0.6.90]].
+This version is binary compatible to [[#OSM3S v0.6.90|OSM3S v0.6.90]].
==Interface changes==
View
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
-<osm-script timeout="86400" element-limit="1073741824">
+<osm-script timeout="604800" element-limit="1073741824">
<union>
<query type="relation">
@@ -11,10 +11,10 @@ DB_DIR=$1
while [[ true ]]; do
{
- echo "`date '+%F %T'`: updating started" >>$DB_DIR/rules_loop.log
+ echo "`date '+%F %T'`: update started" >>$DB_DIR/rules_loop.log
- ./osm3s_query --concise --rules <$DB_DIR/rules/areas.osm3s
+ ./osm3s_query --progress --rules <$DB_DIR/rules/areas.osm3s
- echo "`date '+%F %T'`: updating finished" >>$DB_DIR/rules_loop.log
+ echo "`date '+%F %T'`: update finished" >>$DB_DIR/rules_loop.log
}; done
@@ -13,6 +13,7 @@
#include <cstdlib>
#include <cstring>
#include <fstream>
+#include <iostream>
using namespace std;
@@ -30,7 +31,7 @@ void copy_file(const string& source, const string& dest)
uint64 size = lseek64(source_file.fd(), 0, SEEK_END);
lseek64(source_file.fd(), 0, SEEK_SET);
Raw_File dest_file(dest, O_RDWR|O_CREAT, S_666, "Dispatcher:2");
- ftruncate64(dest_file.fd(), size);
+ int foo = ftruncate64(dest_file.fd(), size); foo = 0;
Void_Pointer< uint8 > buf(64*1024);
while (size > 0)
@@ -327,37 +328,51 @@ void Dispatcher::standby_loop(uint64 milliseconds)
continue;
}
- uint32 command = *(uint32*)dispatcher_shm_ptr;
- uint32 client_pid = *(uint32*)(dispatcher_shm_ptr + sizeof(uint32));
- if (command == TERMINATE)
+ try
{
- // Set command state to zero.
- *(uint32*)dispatcher_shm_ptr = 0;
- *(uint32*)(dispatcher_shm_ptr + 2*sizeof(uint32)) =
- *(uint32*)(dispatcher_shm_ptr + sizeof(uint32));
+ uint32 command = *(uint32*)dispatcher_shm_ptr;
+ uint32 client_pid = *(uint32*)(dispatcher_shm_ptr + sizeof(uint32));
+ if (command == TERMINATE)
+ {
+ // Set command state to zero.
+ *(uint32*)dispatcher_shm_ptr = 0;
+ *(uint32*)(dispatcher_shm_ptr + 2*sizeof(uint32)) =
+ *(uint32*)(dispatcher_shm_ptr + sizeof(uint32));
- break;
- }
- else if (command == WRITE_START)
- write_start(client_pid);
- else if (command == WRITE_ROLLBACK)
- write_rollback();
- else if (command == WRITE_COMMIT)
- write_commit();
- else if (command == REQUEST_READ_AND_IDX)
- {
- request_read_and_idx(client_pid);
- *(uint32*)(dispatcher_shm_ptr + 2*sizeof(uint32)) = client_pid;
- }
- else if (command == READ_IDX_FINISHED)
- {
- read_idx_finished(client_pid);
- *(uint32*)(dispatcher_shm_ptr + 2*sizeof(uint32)) = client_pid;
+ break;
+ }
+ else if (command == WRITE_START)
+ write_start(client_pid);
+ else if (command == WRITE_ROLLBACK)
+ write_rollback();
+ else if (command == WRITE_COMMIT)
+ write_commit();
+ else if (command == REQUEST_READ_AND_IDX)
+ {
+ request_read_and_idx(client_pid);
+ *(uint32*)(dispatcher_shm_ptr + 2*sizeof(uint32)) = client_pid;
+ }
+ else if (command == READ_IDX_FINISHED)
+ {
+ read_idx_finished(client_pid);
+ *(uint32*)(dispatcher_shm_ptr + 2*sizeof(uint32)) = client_pid;
+ }
+ else if (command == READ_FINISHED)
+ {
+ read_finished(client_pid);
+ *(uint32*)(dispatcher_shm_ptr + 2*sizeof(uint32)) = client_pid;
+ }
}
- else if (command == READ_FINISHED)
+ catch (File_Error e)
{
- read_finished(client_pid);
- *(uint32*)(dispatcher_shm_ptr + 2*sizeof(uint32)) = client_pid;
+ cerr<<"File_Error "<<e.error_number<<' '<<e.filename<<' '<<e.origin<<'\n';
+
+ counter += 30;
+ //sleep for three seconds
+ struct timeval timeout_;
+ timeout_.tv_sec = 3;
+ timeout_.tv_usec = 0;
+ select(FD_SETSIZE, NULL, NULL, NULL, &timeout_);
}
// Set command state to zero.

0 comments on commit 07b9df2

Please sign in to comment.