Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"Failed update storage in database" [MySQL] #3746

Closed
4 tasks done
DarremMolko opened this issue Mar 6, 2023 · 6 comments
Closed
4 tasks done

"Failed update storage in database" [MySQL] #3746

DarremMolko opened this issue Mar 6, 2023 · 6 comments
Labels
bug Something isn't working question Further information is requested

Comments

@DarremMolko
Copy link

Please make sure of the following things

  • I have read the documentation.
  • I'm sure there are no duplicate issues or discussions.
  • I'm sure it's due to alist and not something else(such as Dependencies or Operational).
  • I'm sure I'm using the latest version

Alist Version / Alist 版本

v3.13.1

Driver used / 使用的存储驱动

Describe the bug / 问题描述

After updating to v3.13.1 I started to see this error in the logs.

Reproduction / 复现链接

Update Alist to v3.13.1.

Logs / 日志

�[33mWARN�[0m[2023-03-06 17:11:40] not enable search
�[36mINFO�[0m[2023-03-06 17:11:40] using aria2 version: 1.36.0
�[31mERRO�[0m[2023-03-06 17:11:41] failed save driver storage: failed update storage in database: Error 1062 (23000): Duplicate entry '2' for key 'x_storages.PRIMARY'
�[31mERRO�[0m[2023-03-06 17:11:41] failed save driver storage: failed update storage in database: Error 1062 (23000): Duplicate entry '3' for key 'x_storages.PRIMARY'
�[31mERRO�[0m[2023-03-06 17:11:42] failed save driver storage: failed update storage in database: Error 1062 (23000): Duplicate entry '4' for key 'x_storages.PRIMARY'
�[31mERRO�[0m[2023-03-06 17:11:42] failed save driver storage: failed update storage in database: Error 1062 (23000): Duplicate entry '5' for key 'x_storages.PRIMARY'
�[31mERRO�[0m[2023-03-06 17:11:43] failed save driver storage: failed update storage in database: Error 1062 (23000): Duplicate entry '6' for key 'x_storages.PRIMARY'

@DarremMolko DarremMolko added the bug Something isn't working label Mar 6, 2023
@github-actions
Copy link

github-actions bot commented Mar 6, 2023

@DarremMolko DarremMolko changed the title "Failed update storage in database" "Failed update storage in database" [MySQL] Mar 6, 2023
@xhofe
Copy link
Collaborator

xhofe commented Mar 7, 2023

use --debug param retry then paste the log

@xhofe xhofe added the question Further information is requested label Mar 7, 2023
@github-actions
Copy link

github-actions bot commented Mar 7, 2023

Hello @DarremMolko, please input issue by template and add detail. Issues labeled by question will be closed if no activities in 7 days.
你好 @DarremMolko,请按照issue模板填写, 并详细说明问题/复现步骤/复现链接/实现思路或提供更多信息等, 7天内未回复issue自动关闭。

@DarremMolko
Copy link
Author

use --debug param retry then paste the log

I'm using Koyeb, how can I do that?

@DarremMolko
Copy link
Author

DarremMolko commented Mar 7, 2023

This is what I could get from a fresh install (v3.13.1) in a different server and using MySQL database:

2023/03/07 14:46:34 �[32m/app/internal/db/storage.go:22
�[0m�[33m[25.823ms] �[34;1m[rows:0]�[0m UPDATE `x_storages` SET `mount_path`='/local',`order`=0,`driver`='Local',`cache_expiration`=0,`status`='work',`addition`='{"root_folder_path":"/","thumbnail":true,"show_hidden":true,"mkdir_perm":"777"}',`remark`='',`modified`='2023-03-07 14:05:05.09',`disabled`=false,`order_by`='',`order_direction`='',`extract_folder`='',`web_proxy`=false,`webdav_policy`='native_proxy',`down_proxy_url`='' WHERE `id` = 1

2023/03/07 14:46:34 �[31;1m/app/internal/db/storage.go:22 �[35;1mError 1062 (23000): Duplicate entry '1' for key 'PRIMARY'
�[0m�[33m[6.867ms] �[34;1m[rows:0]�[0m INSERT INTO `x_storages` (`mount_path`,`order`,`driver`,`cache_expiration`,`status`,`addition`,`remark`,`modified`,`disabled`,`order_by`,`order_direction`,`extract_folder`,`web_proxy`,`webdav_policy`,`down_proxy_url`,`id`) VALUES ('/local',0,'Local',0,'work','{"root_folder_path":"/","thumbnail":true,"show_hidden":true,"mkdir_perm":"777"}','','2023-03-07 14:05:05.09',false,'','','',false,'native_proxy','',1)
�[31mERRO�[0m[2023-03-07 14:46:34]/app/internal/op/storage.go:222 github.com/alist-org/alist/v3/internal/op.MustSaveDriverStorage() failed save driver storage: failed update storage in database: Error 1062 (23000): Duplicate entry '1' for key 'PRIMARY' 
�[37mDEBU�[0m[2023-03-07 14:46:34]/app/internal/op/storage.go:82 github.com/alist-org/alist/v3/internal/op.LoadStorage() storage &{Storage:{ID:1 MountPath:/local Order:0 Driver:Local CacheExpiration:0 Status:work Addition:{"root_folder_path":"/","thumbnail":true,"show_hidden":true,"mkdir_perm":"777"} Remark: Modified:2023-03-07 14:05:05.09 -0300 -03 Disabled:false Sort:{OrderBy: OrderDirection: ExtractFolder:} Proxy:{WebProxy:false WebdavPolicy:native_proxy DownProxyUrl:}} Addition:{RootPath:{RootFolderPath:/} Thumbnail:true ShowHidden:true MkdirPerm:777} mkdirPerm:511} is created 

This seems to affect the settings too
Screenshot_20230307-151430

@anwen-anyi
Copy link
Contributor

version 3.13.1 使用 MySQL数据库会出现 sqlite3不会

日志为 携带 --debug 启动从进入全局设置后到点击保存中间的日志

[GIN] 2023/03/08 - 18:42:56 | 200 |       1.808ms |    101.27.54.74 | GET      "/@manage/settings/global"
�[37mDEBU�[0m[2023-03-08 18:42:56]C:xxxxxx/git/Alist-3.1.0/alist/server/middlewares/auth.go:66 github.com/alist-org/alist/v3/server/middlewares.Auth() use login token: &{ID:1 Username:admin Password:xxSJ279605@ BasePath:/ Role:2 Disabled:false Permission:0 OtpSecret: SsoID:OTavnQ4pJNgZJLO43z5T8QiEiE} 

2023/03/08 18:42:56 �[32mC:xxxxxx/git/Alist-3.1.0/alist/internal/db/settingitem.go:52
�[0m�[33m[0.700ms] �[34;1m[rows:10]�[0m SELECT * FROM `x_setting_items` WHERE `group` in (4)
[GIN] 2023/03/08 - 18:42:56 | 200 |      3.2916ms |    101.27.54.74 | GET      "/api/admin/setting/list?group=4"
�[37mDEBU�[0m[2023-03-08 18:42:58]C:xxxxxx/git/Alist-3.1.0/alist/server/middlewares/auth.go:66 github.com/alist-org/alist/v3/server/middlewares.Auth() use login token: &{ID:1 Username:admin Password:xxSJ279605@ BasePath:/ Role:2 Disabled:false Permission:0 OtpSecret: SsoID:OTavnQ4pJNgZJLO43z5T8QiEiE} 
�[37mDEBU�[0m[2023-03-08 18:42:58]C:xxxxxx/git/Alist-3.1.0/alist/internal/op/hook.go:78 github.com/alist-org/alist/v3/internal/op.glob..func8() filename char mapping: map[/:|]              

2023/03/08 18:42:58 �[32mC:xxxxxx/git/Alist-3.1.0/alist/internal/db/settingitem.go:63
�[0m�[33m[2.895ms] �[34;1m[rows:0]�[0m UPDATE `x_setting_items` SET `value`='{"/": "|"}',`help`='',`type`='text',`options`='',`group`=4,`flag`=0 WHERE `key` = 'filename_char_mapping'

2023/03/08 18:42:58 �[31;1mC:xxxxxx/git/Alist-3.1.0/alist/internal/db/settingitem.go:63 �[35;1mError 1062 (23000): Duplicate entry 'filename_char_mapping' for key 'PRIMARY'
�[0m�[33m[0.373ms] �[34;1m[rows:0]�[0m INSERT INTO `x_setting_items` (`key`,`value`,`help`,`type`,`options`,`group`,`flag`) VALUES ('filename_char_mapping','{"/": "|"}','','text','',4,0)

2023/03/08 18:42:58 �[32mC:xxxxxx/git/Alist-3.1.0/alist/internal/db/settingitem.go:63
�[0m�[33m[0.682ms] �[34;1m[rows:0]�[0m UPDATE `x_setting_items` SET `value`='(?:(?:\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.){3}(?:\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])
([[:xdigit:]]{1,4}(?::[[:xdigit:]]{1,4}){7}|::|:(?::[[:xdigit:]]{1,4}){1,6}|[[:xdigit:]]{1,4}:(?::[[:xdigit:]]{1,4}){1,5}|(?:[[:xdigit:]]{1,4}:){2}(?::[[:xdigit:]]{1,4}){1,4}|(?:[[:xdigit:]]{1,4}:){3}(?::[[:xdigit:]]{1,4}){1,3}|(?:[[:xdigit:]]{1,4}:){4}(?::[[:xdigit:]]{1,4}){1,2}|(?:[[:xdigit:]]{1,4}:){5}:[[:xdigit:]]{1,4}|(?:[[:xdigit:]]{1,4}:){1,6}:)
(?U)access_token=(.*)&',`help`='',`type`='text',`options`='',`group`=4,`flag`=1 WHERE `key` = 'privacy_regs'

2023/03/08 18:42:58 �[31;1mC:xxxxxx/git/Alist-3.1.0/alist/internal/db/settingitem.go:63 �[35;1mError 1062 (23000): Duplicate entry 'privacy_regs' for key 'PRIMARY'
�[0m�[33m[0.497ms] �[34;1m[rows:0]�[0m INSERT INTO `x_setting_items` (`key`,`value`,`help`,`type`,`options`,`group`,`flag`) VALUES ('privacy_regs','(?:(?:\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.){3}(?:\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])
([[:xdigit:]]{1,4}(?::[[:xdigit:]]{1,4}){7}|::|:(?::[[:xdigit:]]{1,4}){1,6}|[[:xdigit:]]{1,4}:(?::[[:xdigit:]]{1,4}){1,5}|(?:[[:xdigit:]]{1,4}:){2}(?::[[:xdigit:]]{1,4}){1,4}|(?:[[:xdigit:]]{1,4}:){3}(?::[[:xdigit:]]{1,4}){1,3}|(?:[[:xdigit:]]{1,4}:){4}(?::[[:xdigit:]]{1,4}){1,2}|(?:[[:xdigit:]]{1,4}:){5}:[[:xdigit:]]{1,4}|(?:[[:xdigit:]]{1,4}:){1,6}:)
(?U)access_token=(.*)&','','text','',4,1)

2023/03/08 18:42:58 �[32mC:xxxxxx/git/Alist-3.1.0/alist/internal/db/settingitem.go:59
�[0m�[33m[3.061ms] �[34;1m[rows:0]�[0m INSERT INTO `x_setting_items` (`key`,`value`,`help`,`type`,`options`,`group`,`flag`) VALUES ('customize_body','再往下就是自定义内容的参数了','','text','',4,1),('forward_direct_link_params','false','','bool','',4,0),('hide_files','/\/README.md/i
/\/空/i','','text','',4,0),('link_expiration','0','','number','',4,1),('ocr_api','https://api.nn.ci/ocr/file/json','','string','',4,0),('package_download','false','','bool','',4,0),('sign_all','false','','bool','',4,1) ON DUPLICATE KEY UPDATE `value`=VALUES(`value`),`help`=VALUES(`help`),`type`=VALUES(`type`),`options`=VALUES(`options`),`group`=VALUES(`group`),`flag`=VALUES(`flag`)
[GIN] 2023/03/08 - 18:42:58 | 200 |     17.9533ms |    101.27.54.74 | POST     "/api/admin/setting/save"
[GIN] 2023/03/08 - 18:43:08 | 200 |            0s |  208.115.199.27 | HEAD     "/"
[GIN] 2023/03/08 - 18:43:32 | 200 |            0s |  104.197.80.222 | GET      "/"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working question Further information is requested
Projects
None yet
Development

No branches or pull requests

3 participants