Skip to content

Commit

Permalink
Patched some remaining bugs.
Browse files Browse the repository at this point in the history
  • Loading branch information
Roland Olbricht committed Jul 8, 2011
1 parent f2a00ca commit 07b9df2
Show file tree
Hide file tree
Showing 4 changed files with 49 additions and 34 deletions.
4 changes: 2 additions & 2 deletions CHANGELOG
Original file line number Diff line number Diff line change
@@ -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==
Expand Down
2 changes: 1 addition & 1 deletion rules/areas.osm3s
Original file line number Diff line number Diff line change
@@ -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">
Expand Down
6 changes: 3 additions & 3 deletions src/bin/rules_loop.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
71 changes: 43 additions & 28 deletions src/template_db/dispatcher.cc
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
#include <cstdlib>
#include <cstring>
#include <fstream>
#include <iostream>

using namespace std;

Expand All @@ -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)
Expand Down Expand Up @@ -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.
Expand Down

0 comments on commit 07b9df2

Please sign in to comment.