DB backup does not work

backup

#1

Log entry during startup:

Oct 1 15:36:49 pi2 phantombot[18931]: [10-01-2017 @ 15:36:49.458 GMT] Backed up SQLite3 DB to ./dbbackup/phantombot.auto.backup.01102017.033649.db

But, no files are created in the dbbackup directory.

This is running on a Raspberry Pi 3
PRETTY_NAME="Raspbian GNU/Linux 9 (stretch)"
NAME="Raspbian GNU/Linux"
VERSION_ID="9"
VERSION="9 (stretch)"
ID=raspbian
ID_LIKE=debian
HOME_URL="http://www.raspbian.org/"
SUPPORT_URL="http://www.raspbian.org/RaspbianForums"
BUG_REPORT_URL=“http://www.raspbian.org/RaspbianBugs

Detected Java 1.8.0_141 running on Linux 4.9.41-v7+ (arm)
PhantomBot Version: 2.3.9
Build Revision: 37009b50

I had the same issue on OSX as well.


#2

It’s working fine on Windows here, make sure the bot user has the permission to create new files in the folder.


#3

It does.

Also, if it had any error writing the file, I would assume those error would be logged.


#4

Can you try using backupdb in your console to see if it creates a manual backup. Also, are you using SQLite 3 for your datastore or did you change it to something else?


#5

Not necessarily, we use the built in mechanism from SQLite3 to perform a backup and we do trap an exception, but, if it is not throwing an exception on an inability to create a file, we won’t catch it.


#6

Using the default SQLite 3.

The manual backup works. But, the one at startup does not.

Also, I have also have the backupsqlite settings in the botlogin.txt file to backup every 6 hours. Those are not working either.


#7

So, the timer is set to fire at startup with 0-wait time. You do have:

backupsqliteauto=true

I just tested it again in the 2.3.9 release.

[10-01-2017 @ 12:29:40.171 MDT] Backed up SQLite3 DB to ./dbbackup/phantombot.auto.backup.01102017.122940.db
[Nyx] /opt/iobot
% ls dbbackup/
phantombot.auto.backup.01102017.122940.db

Both the manual and auto call the same method to backup, so, one really shouldn’t fail and one work.


#8

I agree with your logic.

But, that is not what I am seeing.


#9

Sadly, without more information or logs, there isn’t much more I can do to troubleshoot. It is functioning on this side, and I assume you verified the configuration.

Can you please show me the backupsqlite settings from your botlogin.txt and the contents of your dbbackup directory in screenshots.

Also, please check core-errors for any logs that might be helpful.


#10
backupsqliteauto=true
backupsqlitehourfrequency=1
backupsqlitekeepdays=30

phantombot.manual.backup.01102017.061909.db

The only thing in the core-errors log are some entries for an unrelated Discord issue.


#11

While I create a debug version of PhantomBot.jar for you, for laughs, lower backupsqlitekeepdays=5. Or just comment out the line and let the bot go with the default value.

I have a hunch, probably wrong, but I wonder.


#12

Commenting out keepdays seems to have solved it.


#13

This is my guess, but I’d have to hand you a debug version.

Pi is a 32-bit ARM architecture. The calculation we use might be overloading the value on the Pi. So, if you can live with a few less days of backups, I think that will get ya going. I will debug on my Pi 3+ in the next week or so.

What was happening (I think) is the value calculated for millseconds in a month was “rolling-over” and telling the job to delete the file as soon as it was created. If this is the case, I’ll see about changing the math over to not comparing to the milliseconds on the system to seconds or minutes up front and using smaller numbers for compare points.

Sorry for the troubles, and thanks for sharing the config, that helped me out a ton in taking a [reasonable?] guess.


#14

I can work with fewer backups.

Thanks for the help.


#15

Sorry, it took me a while to get back to this.

The backup on startup is working now. However, I’m not seeing the hourly backups.

backupsqliteauto=true
backupsqlitehourfrequency=1
backupsqlitekeepdays=1

#16

Also, if this 32bit issue could cause other parts of the bot to break (ranks come to mind), is there anything that could be done to make the bot more 32bit compatible?

Thanks


#17

It’s not a “32 bit issue” it’s ARM, Pi software lacks support for a decent bit of things (getting better). Either way it would do nothing to ranks, there’s nothing that’s the slightest bit OS specific in the base scripts for PhantomBot.


#18

Are you saying ARM can’t math? :slight_smile:

The description IllusionaryOne provided lead me to believe it is a 32bit issue.

Can you help me understand exactly what the issue is?

Thank oyu


#19

The reason I say it’s an ARM issue not really a 32Bit issue is because it’s highly likely there are zero issues on a 32 bit x86 system, where as with the Pi (32 Bit ARM) there are.

If you re-read IO’s message he says that he believes the math is a tad too complicated for the Pi and that’s causing issues. Assuming you got a debug jar from IO he/we will likely need logs to dig any further when we get time (probably won’t be soon, we all have life stuff that’s popped up in the past week).

Also I wasn’t saying ARM can’t math, it’s designed to be efficient and compact instead of a power house :wink: .


#20

Thanks for the details.

Just to clarify, this is a RP 3 running Raspbian 9. So, 64bit ARM with a 32bit OS.

FileUtils.isFileOlder(backupFile, System.currentTimeMillis() - (86400000 * backupSQLiteKeepDays))

Seems fairly simple to me. But, I’m not a Java dev.