Hello Phil,
Well, the problem is that your backup level is
set to zero. This is probably because you did not
specify a level in the Job resource (and I always
did and never thought of checking for a zero).
This bug only occurs when you start from the Console
program (I've noted to fix it).
There are two solutions:
1. In your Job resource, add "level=Incremental",
which will then be the default if nothing else
is specified. This is my recommended solution.
2. Reply "mod" to the "OK to run? (yes/mod/no):"
and select level, then choose a level.
Thanks for finding and reporting this.
Best regards,
Kern
On Fri, 2002-04-19 at 07:30, Phil Stracchino wrote:
> *run job=NightlySave
> babylon5-dir: ua_run.c:82 Doing arg 1 = job
> babylon5-dir: ua_run.c:89 Got keyword=job
> Run Backup job
> JobName: NightlySave
> FileSet: Full Set
> Level: 0 <========== this is the problem !!!!!!!!!
> Client: babylon5-fd
> Storage: VXA1
> OK to run? (yes/mod/no): yes
> 18-Apr-2002 21:59 babylon5-dir: Fatal Error at sql_create.c:94 because:
> sql_create.c:94 insert INSERT INTO Job (JobId, Job, Name, Type, Level,
> SchedTime, StartDay) VALUES (NULL, "NightlySave.2002-04-18.21:59:45",
> "NightlySave", "B", " failed:
> You have an error in your SQL syntax near '"' at line 1
> 18-Apr-2002 21:59 babylon5-dir: Job NightlySave.2002-04-18.21:59:45
> Cancelled because: sql_create.c:95 Create DB Job record INSERT INTO Job
> (JobId, Job, Name, Type, Level, SchedTime, StartDay) VALUES (NULL,
> "NightlySave.2002-04-18.21:59:45", "NightlySave", "B", " failed. ERR=You
> have an error in your SQL syntax near '"' at line 1
>
>
> The source code here is:
>
> Mmsg(&mdb->cmd,
> "INSERT INTO Job (JobId, Job, Name, Type, Level, SchedTime, StartDay) VALUES \
> (%s, \"%s\", \"%s\", \"%c\", \"%c\", \"%s\", %d)",
> JobId, jr->Job, jr->Name, (char)(jr->Type), (char)(jr->Level), dt,
> StartDay);
>
> if (!INSERT_DB(mdb, mdb->cmd)) {
> Mmsg2(&mdb->errmsg, _("Create DB Job record %s failed. ERR=%s\n"),
> mdb->cmd, sql_strerror(mdb));
> jr->JobId = 0;
> stat = 0;
> } else {
> jr->JobId = sql_insert_id(mdb);
> stat = 1;
> }
>
>
> Now, here's the question: Are you really sure you want to put jr->Level
> into that query string as a char, not as an int? If you put it in as a
> char, then every time you do a level 0 backup you zero-terminate the
> string in the middle, just the way it's happened here.
>
> I'd say that %c format needs to be a %d. The same problem also occurs in
> sql_update.c and sql_find.c. Now, in theory, Level 0 is apparently an
> unimplemented backup level. But I couldn't get to that message and find
> that out until I'd fixed the problem above. (I note that level 0 is
> listed as "unimplemented" rather than "unsupported", leading me to believe
> that it's meant to be supported in the future, at which point the SQL
> command issue above would bite you.)
>
> This leads to a logic error: if level 0 is unimplemented, why does "run
> job=<foo>" offer level 0 as the default level?
>
>
> Patch is attached for the SQL command null-termination problem. The logic
> issue of an unimplemented backup level being offered as a default by the
> run command is up to you to solve. I'm posting these patches on
> sourceforge as well.
>
>
> --
> ********* Fight Back! It may not be just YOUR life at risk. *********
> phil stracchino :: alaric@... :: halmayne@...
> unix ronin :::: renaissance man :::: mystic zen biker geek
> 2000 CBR929RR, 1991 VFR750F3 (foully murdered), 1986 VF500F (sold)
> Linux Now! ...because friends don't let friends use Microsoft.
> ----
>
> --- sql_create.c.orig Thu Mar 21 07:16:11 2002
> +++ sql_create.c Thu Apr 18 22:10:18 2002
> @@ -87,8 +87,8 @@
> /* Must create it */
> Mmsg(&mdb->cmd,
> "INSERT INTO Job (JobId, Job, Name, Type, Level, SchedTime, StartDay) VALUES \
> -(%s, \"%s\", \"%s\", \"%c\", \"%c\", \"%s\", %d)",
> - JobId, jr->Job, jr->Name, (char)(jr->Type), (char)(jr->Level), dt,
> +(%s, \"%s\", \"%s\", \"%c\", \"%d\", \"%s\", %d)",
> + JobId, jr->Job, jr->Name, (char)(jr->Type), jr->Level, dt,
> StartDay);
>
> if (!INSERT_DB(mdb, mdb->cmd)) {
> --- sql_update.c.orig Tue Mar 12 03:59:56 2002
> +++ sql_update.c Thu Apr 18 22:17:26 2002
> @@ -110,9 +110,9 @@
> date_encode(2000, 1, 1));
>
> P(mdb->mutex);
> - Mmsg(&mdb->cmd, "UPDATE Job SET Level='%c', StartTime=\"%s\", \
> + Mmsg(&mdb->cmd, "UPDATE Job SET Level='%d', StartTime=\"%s\", \
> ClientId=%d, StartDay=%d WHERE JobId=%d",
> - (char)(jr->Level), dt, jr->ClientId, StartDay, jr->JobId);
> + jr->Level, dt, jr->ClientId, StartDay, jr->JobId);
> stat = UPDATE_DB(mdb, mdb->cmd);
> V(mdb->mutex);
> return stat;
> --- sql_find.c.orig Thu Mar 21 07:10:59 2002
> +++ sql_find.c Thu Apr 18 22:18:41 2002
> @@ -72,14 +72,14 @@
> if (jr->Level == L_DIFFERENTIAL) {
> Mmsg(&mdb->cmd,
> "SELECT JobId from Job WHERE JobStatus='T' and Type='%c' and \
> -Level='%c' and Name=\"%s\" and ClientId=%d and FileSetId=%d \
> +Level='%d' and Name=\"%s\" and ClientId=%d and FileSetId=%d \
> ORDER by StartTime DESC LIMIT 1",
> jr->Type, L_FULL, jr->Name, jr->ClientId, jr->FileSetId);
> /* Incremental is since last Full, Incremental, or Differential */
> } else if (jr->Level == L_INCREMENTAL) {
> Mmsg(&mdb->cmd,
> "SELECT JobId from Job WHERE JobStatus='T' and Type='%c' and \
> -(Level='%c' or Level='%c' or Level='%c') and Name=\"%s\" and ClientId=%d \
> +(Level='%d' or Level='%d' or Level='%d') and Name=\"%s\" and ClientId=%d \
> ORDER by StartTime DESC LIMIT 1",
> jr->Type, L_INCREMENTAL, L_DIFFERENTIAL, L_FULL, jr->Name,
> jr->ClientId);
> @@ -144,11 +144,11 @@
> /* Find last full */
> P(mdb->mutex);
> if (jr->Level != L_VERIFY_CATALOG) {
> - Emsg2(M_FATAL, 0, _("Expecting Level=%c, got %c\n"), L_VERIFY_CATALOG, jr->Level);
> + Emsg2(M_FATAL, 0, _("Expecting Level=%d, got %d\n"), L_VERIFY_CATALOG, jr->Level);
> return 0;
> }
> Mmsg(&mdb->cmd,
> -"SELECT JobId from Job WHERE Type='%c' and Level='%c' and Name=\"%s\" and \
> +"SELECT JobId from Job WHERE Type='%c' and Level='%d' and Name=\"%s\" and \
> ClientId=%d ORDER by StartTime DESC LIMIT 1",
> JT_VERIFY, L_VERIFY_INIT, jr->Name, jr->ClientId);
>
|