ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/Deliantra-Client/DC/DB.pm
(Generate patch)

Comparing deliantra/Deliantra-Client/DC/DB.pm (file contents):
Revision 1.38 by root, Fri Jul 18 22:40:51 2008 UTC vs.
Revision 1.40 by root, Wed Nov 26 23:08:34 2008 UTC

26use DC; 26use DC;
27 27
28our $ODBDIR = "cfplus-" . BDB::VERSION_MAJOR . "." . BDB::VERSION_MINOR . "-$Config{archname}"; 28our $ODBDIR = "cfplus-" . BDB::VERSION_MAJOR . "." . BDB::VERSION_MINOR . "-$Config{archname}";
29our $DBDIR = "client-" . BDB::VERSION_MAJOR . "." . BDB::VERSION_MINOR . "-$Config{archname}"; 29our $DBDIR = "client-" . BDB::VERSION_MAJOR . "." . BDB::VERSION_MINOR . "-$Config{archname}";
30our $DB_HOME = "$Deliantra::VARDIR/$DBDIR"; 30our $DB_HOME = "$Deliantra::VARDIR/$DBDIR";
31
32sub FIRST_TILE_ID () { 64 }
31 33
32unless (-d $DB_HOME) { 34unless (-d $DB_HOME) {
33 if (-d "$Deliantra::VARDIR/$ODBDIR") { 35 if (-d "$Deliantra::VARDIR/$ODBDIR") {
34 rename "$Deliantra::VARDIR/$ODBDIR", $DB_HOME; 36 rename "$Deliantra::VARDIR/$ODBDIR", $DB_HOME;
35 print STDERR "INFO: moved old database from $Deliantra::VARDIR/$ODBDIR to $DB_HOME\n"; 37 print STDERR "INFO: moved old database from $Deliantra::VARDIR/$ODBDIR to $DB_HOME\n";
57 59
58 $env->set_errfile (\*STDERR); 60 $env->set_errfile (\*STDERR);
59 $env->set_msgfile (\*STDERR); 61 $env->set_msgfile (\*STDERR);
60 $env->set_verbose (-1, 1); 62 $env->set_verbose (-1, 1);
61 63
62 $env->set_flags (BDB::AUTO_COMMIT | BDB::LOG_AUTOREMOVE | BDB::TXN_WRITE_NOSYNC); 64 $env->set_flags (BDB::AUTO_COMMIT | BDB::REGION_INIT);
65 $env->set_flags (&BDB::LOG_AUTOREMOVE ) if BDB::VERSION v0, v4.7;
66 $env->log_set_config (&BDB::LOG_AUTO_REMOVE) if BDB::VERSION v4.7;
67
68 $env->set_timeout (3, BDB::SET_TXN_TIMEOUT);
69 $env->set_timeout (3, BDB::SET_LOCK_TIMEOUT);
70
63 $env->set_cachesize (0, 2048 * 1024, 0); 71 $env->set_cachesize (0, 2048 * 1024, 0);
64 72
65 db_env_open $env, $DB_HOME, 73 db_env_open $env, $DB_HOME,
66 BDB::CREATE | BDB::REGISTER | BDB::RECOVER | BDB::INIT_MPOOL | BDB::INIT_LOCK | BDB::INIT_TXN, 74 BDB::CREATE | BDB::REGISTER | BDB::RECOVER | BDB::INIT_MPOOL | BDB::INIT_LOCK | BDB::INIT_TXN,
67 0666; 75 0666;
150 db_get $table, undef, $name => $id, 0; 158 db_get $table, undef, $name => $id, 0;
151 $! or return $cb->($id); 159 $! or return $cb->($id);
152 160
153 unless ($TILE_SEQ) { 161 unless ($TILE_SEQ) {
154 $TILE_SEQ = $table->sequence; 162 $TILE_SEQ = $table->sequence;
155 $TILE_SEQ->initial_value (64); 163 $TILE_SEQ->initial_value (FIRST_TILE_ID);
156 $TILE_SEQ->set_cachesize (0); 164 $TILE_SEQ->set_cachesize (0);
157 db_sequence_open $TILE_SEQ, undef, "id", BDB::CREATE; 165 db_sequence_open $TILE_SEQ, undef, "id", BDB::CREATE;
158 } 166 }
159 167
160 db_sequence_get $TILE_SEQ, undef, 1, my $id; 168 db_sequence_get $TILE_SEQ, undef, 1, my $id;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines