Lines 397-403
int cache_get_master_entry(CacheMasterEntry *master_entry) {
|
Link Here
|
---|
|
397 |
return MDB_SUCCESS; |
397 |
return MDB_SUCCESS; |
398 |
} |
398 |
} |
399 |
|
399 |
|
400 |
int cache_update_master_entry(CacheMasterEntry *master_entry) { |
400 |
int cache_update_master_entry(CacheMasterEntry *master_entry, int retry) { |
401 |
int rv; |
401 |
int rv; |
402 |
MDB_txn *write_txn; |
402 |
MDB_txn *write_txn; |
403 |
MDB_val key, data; |
403 |
MDB_val key, data; |
Lines 426-432
int cache_update_master_entry(CacheMasterEntry *master_entry) {
|
Link Here
|
---|
|
426 |
univention_debug(UV_DEBUG_LISTENER, UV_DEBUG_ALL, "cache_update_master_entry: Transaction commit"); |
426 |
univention_debug(UV_DEBUG_LISTENER, UV_DEBUG_ALL, "cache_update_master_entry: Transaction commit"); |
427 |
if ((rv = mdb_txn_commit(write_txn)) != MDB_SUCCESS) { |
427 |
if ((rv = mdb_txn_commit(write_txn)) != MDB_SUCCESS) { |
428 |
univention_debug(UV_DEBUG_LISTENER, UV_DEBUG_ERROR, "cache_update_master_entry: storing master entry in database failed"); |
428 |
univention_debug(UV_DEBUG_LISTENER, UV_DEBUG_ERROR, "cache_update_master_entry: storing master entry in database failed"); |
429 |
ERROR_MDB_ABORT(rv, "mdb_txn_commit"); |
429 |
if (rv == MDB_PAGE_NOTFOUND && retry == 1) { |
|
|
430 |
univention_debug(UV_DEBUG_LISTENER, UV_DEBUG_ERROR, "cache_update_master_entry: retrying"); |
431 |
cache_mdb_close(); |
432 |
|
433 |
/* TODO: pass these paths properly !! */ |
434 |
char cache_dir[PATH_MAX] = "/var/lib/univention-directory-listener"; |
435 |
char cache_mdb_dir[PATH_MAX]; |
436 |
|
437 |
rv = snprintf(cache_mdb_dir, PATH_MAX, "%s/cache", cache_dir); |
438 |
if (rv < 0 || rv >= PATH_MAX) |
439 |
abort(); |
440 |
|
441 |
if (cache_init(cache_mdb_dir, 0) != 0) |
442 |
exit(1); |
443 |
cache_update_master_entry(master_entry, 0); |
444 |
} else { |
445 |
ERROR_MDB_ABORT(rv, "mdb_txn_commit"); |
446 |
} |
430 |
return rv; |
447 |
return rv; |
431 |
} |
448 |
} |
432 |
|
449 |
|