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

SQLITE error: unknown database disk --- PRAGMA disk.synchronous=0 #1842

Closed
Mount565 opened this issue Jan 2, 2019 · 3 comments
Closed

SQLITE error: unknown database disk --- PRAGMA disk.synchronous=0 #1842

Mount565 opened this issue Jan 2, 2019 · 3 comments

Comments

@Mount565
Copy link
Contributor

Mount565 commented Jan 2, 2019

ProxySQL version 1.4.12

Replicating proxysql.db between proxysql servers.
executing proxysql flush configdb;

2019-01-02 14:07:52 [INFO] Received PROXYSQL FLUSH CONFIGDB command
2019-01-02 14:07:52 ProxySQL_Admin.cpp:673:admin_handler_command_proxysql(): [WARNING] A misconfigured configdb will cause undefined behaviors
2019-01-02 14:07:52 sqlite3db.cpp:61:execute(): [ERROR] SQLITE error: unknown database disk --- PRAGMA disk.synchronous=0
2019-01-02 14:07:52 [INFO] Received LOAD MYSQL USERS TO MEM command
2019-01-02 14:07:52 [INFO] Received LOAD MYSQL USERS TO RUN command

But the following LOAD MYSQL USERS TO MEM works fine. And new configurations also works!

@Mount565
Copy link
Contributor Author

Mount565 commented Jan 3, 2019

Using sqlite3 to connect to proxysql.db and find that the database name is main, not disk

sqlite> .databases
seq  name             file                                                      
---  ---------------  ----------------------------------------------------------
0    main             /dbfiles/proxysql/backup/proxysql.db                      
1    temp    

Running pragma main.synchronous=0; works

sqlite> pragma main.synchronous=0;
sqlite> pragma main.synchronous;
synchronous
0

So I guess the code at ProxySQL_Admin.cpp L1909 is spelled wrongly

void ProxySQL_Admin::flush_configdb() { // see #923                                                                        
    wrlock();                                                                                                              
    admindb->execute((char *)"DETACH DATABASE disk");                                                                      
    delete configdb;                                                                                                       
    configdb=new SQLite3DB();                                                                                              
    configdb->open((char *)GloVars.admindb, SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE | SQLITE_OPEN_FULLMUTEX);           
    __attach_db(admindb, configdb, (char *)"disk");                                                                        
    // Fully synchronous is not required. See to #1055                                                                     
    // https://sqlite.org/pragma.html#pragma_synchronous                                                                   
    configdb->execute("PRAGMA disk.synchronous=0");                                                                        
    wrunlock();                                                                                                            
}  

@renecannao
Copy link
Contributor

Hi @Mount565 , thank for the report.
For the naming convention in schemas in SQLite, please see SQLite doc.
There is indeed a typo, either remove disk. , or replace configdb with admindb.
Commit 78eca24 fixes this.

@Mount565
Copy link
Contributor Author

Mount565 commented Jan 4, 2019

Get it. Thanks Rene.
Closed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants