Uploadnewdatabasegeneration errors

uploadnewdatabasegeneration gives me an error every time it runs within a procedure, but manages to complete. Any remain actions in the procedure fail to run though.

startnewdatabasegeneration initializedictionary("COMPONENTS","data","NOTES","Monthly Archive to "+datepattern(today(),”mm/dd/yy"))
uploadnewdatabasegeneration ""

Pasted Graphic 2

If I extract the New Generation lines and run them exclusively, the same error occurs but a second or third run of these same two lines succeeds.

The Datasheet display makes it appear that the process is underway, but it doesn’t ever update.

Pasted Graphic 1

Checking in Server Administration, the database is shown as being online.
Pasted Graphic 2

And the New Generation pane indicates all is well.
Pasted Graphic 3

The History confirms that the update was successful too.
Pasted Graphic 4

So the issue is how to get around the erroneous error and get the procedure to finish its full task.

You’re using this feature for something it wasn’t intended for (you are not actually stopping and modifying the database, just “archiving” it). I think the only thing this accomplishes is resequencing the server record ids, and cleaning out the list of deleted records on the server. Is that your purpose of doing this? This is certainly not a use case that I would have tested during development.

As part of it’s operation, the startnewdatabasegeneration synchronizes the local copy of the database with the server. From your description, I’d say that the error only happens if the database actually needs to be synchronized. The code is supposed to pause and wait for the synchronization to complete - I think for some reason that isn’t happening. But I don’t know why - the code is there to make it pause and wait.

You might be able to get it to work by adding this code:

startnewdatabasegeneration ...
    wait 1
until dbinfo("PENDINGNEWGENERATION","")<>""
uploadnewdatabasegneration ""

This proposed code is definitely a hack - after coming up with it I seriously considered deleting it from the post. I’ll leave it in, but consider it as an experiment. If this doesn’t work, this is simply a capability that is not currently available.

The database (one of two actually) has been taken offline via Database Options to start a Critical New Generation. In that state a number of processes are run and thousands of records are moved to an unshared archive file, then deleted from the original database with summarized information (not summary records) about the archived records being added.

So yes, I am stopping and modifying the database with a significant change in its content.

Aside from taking it offline, the rest is all automated, or intended to be. For now, I have a message coming up at the end saying it’s ready for a New Generation, but I’ll try the loop to see if that helps.

Whoa whoa whoa - hold the presses. What does this mean? Are you saying that you manually used the Database Sharing Option window to start a Critical New Generation? If so, I think we just found the problem. I’m pretty sure we have because this would perfectly explain the symptoms you are encountering.

Starting a critical new generation is what the startnewdatabasegeneration statement does. If you’ve already started a new generation manually, this is going to try to start it again. Guess what - that doesn’t work - you can only start a new database generation once, then you need to upload it before you can do it again. It didn’t occur to me that anyone would ever do this, but I’ve just now added an error check so that it will immediately stop with an error if you try to start a new database generation when you’ve already started one. With this modification your code still won’t work (see below for the fix) but it will give a more helpful error message.

This code needs to be in between, like this:

startnewdatabasegeneration ...
... run processes
... move thousands of records to unshared archive file
... delete from original database with summarized information added
uploadnewdatabasegeneration ""

The good news is that this process will be entirely automated, with no need to manually open the Database Options dialog to start the critical new generation.

This is quite a relief, I thought I had a long debugging session ahead of me.

That makes sense, and I can see where a ways back my code mutated a bit due to some other issues and I ran off the tracks. It does seem to be working now with limited ability to test it on the full, live system.

Of course, I can’t leave it there… Although I’ve gone to lengths to be sure the stage is all properly set, IF there is some error midstream and the procedure needs to abort the task, is there a way to handle that? Is there an Abort or Revert New Generation available?

In my experience, when I leave the New Generation dialog, click on another window and come back, I get a resume dialog error. Then I have to force quit.

I’m sure we’ve all seen our share of those and the “logic” error, etc. My question is on the assumption that all goes as it should but for some reason the process needs to terminate after being pulled off for the New Generation.

Now that I have a better understanding of the automated generations, it’s absolutely marvelous to see it check for connected users, start the new generation if the coast is clear, run some lengthy processes and move data, then upload the new generation, all in one fell swoop.

It works as advertised.

1 Like

That’s great, but you did ask if there was an abort or revert. My point is, it shouldn’t hang if you try to abort. Even clicking cancel wouldn’t exit the dialog.

These operations are included in the Database Options dialog in case you change your mind. Presumably a program isn’t going to change it’s mind, so these operations shouldn’t be necessary.

However, I looked at the code in the Database Options dialog and the code used to perform these operations is super simple – in fact, only one line each. To abort, use:


To revert new generation, use:

downloadpartialdatabase "data,fieldconfig,forms,procedures"

It is never necessary to force quit to exit a dialog. If a dialog gets stuck, you can always close it by pressing Escape or Command-W. This works for any Panorama dialog.

Sorry Jim, Command-W did not work. Option-Command-Escape didn’t work but I forgot about Escape by itself. I guess my point is, why did it throw a resume error in the first place.

I’m not sure what sort of answer you are looking for here. Obviously it is not designed to do that, that is not intentional behavior. If you are saying that you can make this happen repeatedly then I would be interested in knowing the exact sequence needed to reproduce this.