Bandwidth SQLite errors moving from cPanel to cPanel

brt

Well-Known Member
Jul 9, 2015
103
9
68
US
cPanel Access Level
Root Administrator
I've been getting random warnings about the bandwidth sqlite database when moving accounts. Both servers are current RELEASE, 58.0.24.

Warnings are as follows:

RESTORE: 16 completed, 2 had warnings, and 0 failed.

RESTORE: Account “xxxxxxxxxx”: Warnings
The system failed to import data from the RRDTool files into the user’s bandwidth database because of an error: (XID 9t5bkh) Database /var/cpanel/bandwidth/xxxxxxxxxx.sqlite Error: UNIQUE constraint failed: metadata.key

RESTORE: Account “yyyyyyyyyy”: Warnings
The system failed to import data from the RRDTool files into the user’s bandwidth database because of an error: (XID rfu4s7) Database /var/cpanel/bandwidth/yyyyyyyyyy.sqlite Error: UNIQUE constraint failed: metadata.key


As far as I know it doesn't actually cause any problem, but it seems like something that would be trivial to fix. Just making sure it's on someone's radar...
 

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,909
2,216
463
Hello,

Here's the section of the 11.52 release notes regarding bandwidth graphs that explains how it works:

Prior to cPanel & WHM version 11.50, cPanel tracked bandwidth usage with RRDtool for bandwidth graphs and flat files for bandwidth tables. The flat files acted as a backup for the RRDtool files. Because the tables only included daily data, however, account archives did not include the hourly or 5-minute flat files.

In cPanel & WHM version 11.50, the system migrated the data from the flat files into a new SQLite database for each user. However, the account transfer process did not include hourly data, so the system could not import hourly data to the new SQLite databases for transferred accounts.

Because cPanel & WHM version 11.52 now uses those SQLite databases to construct bandwidth graphs when the system first loads the bandwidth database, it imports any available hourly data from RRDtool. The system then scales that data to accommodate any discrepancies between RRDtool’s storage format and cPanel & WHM’s. For days on which no RRDtool data available exists, the system distributes the bandwidth evenly across the day.
Thus, new bandwidth calculation should function normally for those transferred accounts. However, we should still investigate why those error messages occurred. Do those accounts still exist on the source server? If so, could you open a support ticket using the link in my signature so we can take a closer look? You can post the ticket number here so we can update this thread with the outcome.

Thank you.
 

hayridumanli

Member
Jan 11, 2014
23
2
3
cPanel Access Level
Root Administrator
Did you find a solution about this. I made WHM to WHM transfer "cPanel & WHM 64.0 (build 29)" from a VDS to other, it gave these errors. Then I made the transfer from the VDS to a dedicated server after a couple of months, it gave almost the same errors again;

Code:
RESTORE: Account “diveandwalk”: Warnings
The system failed to import data from the RRDTool files into the user’s bandwidth database because of an error: (XID zcpb6m) The system received an error from the “SQLite” database “/var/cpanel/bandwidth/diveandwalk.sqlite”: SQLITE_CONSTRAINT (UNIQUE constraint failed: metadata.key)
RESTORE: Account “metintopa”: Warnings
The system failed to import data from the RRDTool files into the user’s bandwidth database because of an error: (XID z3xxra) The system received an error from the “SQLite” database “/var/cpanel/bandwidth/metintopa.sqlite”: SQLITE_CONSTRAINT (UNIQUE constraint failed: metadata.key)
RESTORE: Account “fahirozer”: Warnings
The system failed to import data from the RRDTool files into the user’s bandwidth database because of an error: (XID 8bc5yg) The system received an error from the “SQLite” database “/var/cpanel/bandwidth/fahirozer.sqlite”: SQLITE_CONSTRAINT (UNIQUE constraint failed: metadata.key)
RESTORE: Account “rumelcng”: Warnings
The system failed to import data from the RRDTool files into the user’s bandwidth database because of an error: (XID arf65e) The system received an error from the “SQLite” database “/var/cpanel/bandwidth/rumelcng.sqlite”: SQLITE_CONSTRAINT (UNIQUE constraint failed: metadata.key)
Is there a solution for this?
 
Last edited by a moderator:

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,909
2,216
463
Hello,

Those warning messages should not prevent the transfer from completing. It's a warning that indicates the transfer tool was unable to import the previous RRDTool bandwidth data into the user’s new bandwidth database. This can happen if the source server uses a different architecture (e.g. 32-bit) or if the SQLite files on the source server are corrupt. This will not prevent the calculation of new bandwidth data on the destination server.

Thank you.
 

hayridumanli

Member
Jan 11, 2014
23
2
3
cPanel Access Level
Root Administrator
Thank you for your reply.
1) Is there a way to repair these SQLite files?
2) Or is there a way to delete all old bandwidth datas for corrupted accounts, so the bandwidth database starts from the zero
 

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,909
2,216
463
Hello,

You should not have to take any additional actions once the accounts are transferred. The warning message shouldn't prevent the transfer of the account from completing, and a new bandwidth file should automatically generate for the new account on the destination server.

Thank you.
 

hayridumanli

Member
Jan 11, 2014
23
2
3
cPanel Access Level
Root Administrator
All the accounts are already transferred. And all of them (websites, mail accounts, etc.) are working without any problem as you said. But as I said before, those errors happened twice, from first VDS to second VDS, then from second VDS to a dedicated server. I had noted at the end of first transfer to write this forum, but I had to make second transfer in a short time, same accounts gave same errors. So, it means that a new bandwidth file hasn't been generated automatically.
Maybe it's not a big deal as you try to say, but small errors can cause bigger ones in the future, so I wanted to learn about it.
 

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,909
2,216
463
Hello,

Could you open a support ticket using the link in my signature so we can take a closer look and see what's possibly corrupting the SQLite bandwidth files?

Thank you.