mirror of
https://github.com/samba-team/samba.git
synced 2024-12-23 17:34:34 +03:00
vacuum: factor out full vacuum run out of ctdb_vacuum_db() as ctdb_vacuum_db_full()
(This used to be ctdb commit e31594e0c13899e88013ce7eb7e3dc434c2f0723)
This commit is contained in:
parent
dbede3de7e
commit
1a462df86c
@ -568,6 +568,52 @@ static void ctdb_vacuum_db_fast(struct ctdb_db_context *ctdb_db,
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Full vacuum run:
|
||||||
|
* read-only traverse of the database, looking for records that
|
||||||
|
* might be able to be vacuumed.
|
||||||
|
*
|
||||||
|
* This is not done each time but only every tunable
|
||||||
|
* VacuumFastPathCount times.
|
||||||
|
*/
|
||||||
|
static int ctdb_vacuum_db_full(struct ctdb_db_context *ctdb_db,
|
||||||
|
struct vacuum_data *vdata,
|
||||||
|
bool full_vacuum_run)
|
||||||
|
{
|
||||||
|
int ret;
|
||||||
|
|
||||||
|
if (!full_vacuum_run) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
ret = tdb_traverse_read(ctdb_db->ltdb->tdb, vacuum_traverse, vdata);
|
||||||
|
if (ret == -1 || vdata->traverse_error) {
|
||||||
|
DEBUG(DEBUG_ERR, (__location__ " Traverse error in vacuuming "
|
||||||
|
"'%s'\n", ctdb_db->db_name));
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (vdata->full_total > 0) {
|
||||||
|
DEBUG(DEBUG_INFO,
|
||||||
|
(__location__
|
||||||
|
" full vacuuming db traverse statistics: "
|
||||||
|
"db[%s] "
|
||||||
|
"total[%u] "
|
||||||
|
"skp[%u] "
|
||||||
|
"err[%u] "
|
||||||
|
"adl[%u] "
|
||||||
|
"avf[%u]\n",
|
||||||
|
ctdb_db->db_name,
|
||||||
|
(unsigned)vdata->full_total,
|
||||||
|
(unsigned)vdata->full_skipped,
|
||||||
|
(unsigned)vdata->full_error,
|
||||||
|
(unsigned)vdata->full_added_to_delete_list,
|
||||||
|
(unsigned)vdata->full_added_to_vacuum_fetch_list));
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Vacuum a DB:
|
* Vacuum a DB:
|
||||||
* - Always do the fast vacuuming run, which traverses
|
* - Always do the fast vacuuming run, which traverses
|
||||||
@ -666,36 +712,9 @@ static int ctdb_vacuum_db(struct ctdb_db_context *ctdb_db,
|
|||||||
|
|
||||||
ctdb_vacuum_db_fast(ctdb_db, vdata);
|
ctdb_vacuum_db_fast(ctdb_db, vdata);
|
||||||
|
|
||||||
/*
|
ret = ctdb_vacuum_db_full(ctdb_db, vdata, full_vacuum_run);
|
||||||
* read-only traverse of the database, looking for records that
|
if (ret != 0) {
|
||||||
* might be able to be vacuumed.
|
return ret;
|
||||||
*
|
|
||||||
* This is not done each time but only every tunable
|
|
||||||
* VacuumFastPathCount times.
|
|
||||||
*/
|
|
||||||
if (full_vacuum_run) {
|
|
||||||
ret = tdb_traverse_read(ctdb_db->ltdb->tdb, vacuum_traverse, vdata);
|
|
||||||
if (ret == -1 || vdata->traverse_error) {
|
|
||||||
DEBUG(DEBUG_ERR,(__location__ " Traverse error in vacuuming '%s'\n", name));
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
if (vdata->full_total > 0) {
|
|
||||||
DEBUG(DEBUG_INFO,
|
|
||||||
(__location__
|
|
||||||
" full vacuuming db traverse statistics: "
|
|
||||||
"db[%s] "
|
|
||||||
"total[%u] "
|
|
||||||
"skp[%u] "
|
|
||||||
"err[%u] "
|
|
||||||
"adl[%u] "
|
|
||||||
"avf[%u]\n",
|
|
||||||
ctdb_db->db_name,
|
|
||||||
(unsigned)vdata->full_total,
|
|
||||||
(unsigned)vdata->full_skipped,
|
|
||||||
(unsigned)vdata->full_error,
|
|
||||||
(unsigned)vdata->full_added_to_delete_list,
|
|
||||||
(unsigned)vdata->full_added_to_vacuum_fetch_list));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
Loading…
Reference in New Issue
Block a user