POOL_MEM query(PM_MESSAGE);
UAContext *ua;
bool ok = false;
- char ed1[50], ed2[100];
+ char ed1[50], ed2[100], ed3[50];
POOL_DBR spr;
Dmsg1(050, "Prune volumes PoolId=%d\n", jcr->jr.PoolId);
* RecyclePoolId is the current pool or the scratch pool
*/
const char *select = "SELECT DISTINCT MediaId,LastWritten FROM Media WHERE "
- "(PoolId=%s OR RecyclePoolId IN (%s)) AND MediaType='%s' "
+ "(PoolId=%s OR RecyclePoolId IN (%s)) AND MediaType='%s' %s"
"ORDER BY LastWritten ASC,MediaId";
- Mmsg(query, select, ed1, ed2, mr->MediaType);
+ if (InChanger) {
+ char changer[100];
+ /* Ensure it is in this autochanger */
+ bsnprintf(changer, sizeof(changer), "AND InChanger=1 AND StorageId=%s ",
+ edit_int64(mr->StorageId, ed3));
+ Mmsg(query, select, ed1, ed2, mr->MediaType, changer);
+ } else {
+ Mmsg(query, select, ed1, ed2, mr->MediaType, "");
+ }
Dmsg1(050, "query=%s\n", query.c_str());
if (!db_get_query_dbids(ua->jcr, ua->db, query, ids)) {
const char *select =
"SELECT MediaId,LastWritten FROM Media "
"WHERE PoolId=%s AND Recycle=1 AND VolStatus='Purged' "
- "AND Enabled=1 AND MediaType='%s' "
+ "AND Enabled=1 AND MediaType='%s' %s"
"ORDER BY LastWritten ASC,MediaId LIMIT 1";
Dmsg0(100, "Enter recycle_oldest_purged_volume\n");
oldest.MediaId = 0;
- Mmsg(query, select, edit_int64(mr->PoolId, ed1), mr->MediaType);
+ if (InChanger) {
+ char changer[100];
+ bsnprintf(changer, sizeof(changer), "AND InChanger=1 AND StorageId=%s ",
+ edit_int64(mr->StorageId, ed1));
+ Mmsg(query, select, edit_int64(mr->PoolId, ed1), mr->MediaType, changer);
+ } else {
+ Mmsg(query, select, edit_int64(mr->PoolId, ed1), mr->MediaType, "");
+ }
if (!db_sql_query(jcr->db, query, oldest_handler, (void *)&oldest)) {
Jmsg(jcr, M_ERROR, 0, "%s", db_strerror(jcr->db));
}
Dmsg2(150, "Ask=%d autochanger=%d\n", ask, autochanger);
- if (ask && !dir_ask_sysop_to_mount_volume(dcr, ST_APPEND)) {
- Dmsg0(150, "Error return ask_sysop ...\n");
- goto bail_out; /* error return */
+ if (ask) {
+ unlock_volumes();
+ if (!dir_ask_sysop_to_mount_volume(dcr, ST_APPEND)) {
+ Dmsg0(150, "Error return ask_sysop ...\n");
+ goto no_lock_bail_out; /* error return */
+ }
+ lock_volumes();
}
if (job_canceled(jcr)) {
goto bail_out;
#undef VERSION
#define VERSION "2.4.1"
-#define BDATE "22 June 2008"
-#define LSMDATE "22Jun08"
+#define BDATE "26 June 2008"
+#define LSMDATE "26Jun08"
#define PROG_COPYRIGHT "Copyright (C) %d-2008 Free Software Foundation Europe e.V.\n"
#define BYEAR "2008" /* year for copyright messages in progs */
Technical notes on version 2.2
General:
+26Jun08
+kes Fix a recycling problem with two autochangers reported in bug
+ #1106. This may also (unlikely) fix a second recycling bug as
+ reported in #1103.
+kes Fix a SD lock volumes deadlock problem reported in bug #1100.
25Jun08
kes Fix format problem in bscan output reported in bug #1105.
22Jun08