From: Smart W. G. F. W. <f.w...@sm...> - 2007-08-29 14:27:47
|
Hello, i have some problem mounting mysqlfs: ./mysqlfs -ouser=roottest -opassword=xxxxxx-ohostname=localhost -odatabase=mysqlfs /mnt 2007-08-29 15:56:45 5194 Error: mysql_query() 2007-08-29 15:56:45 5194 mysql_error: Commands out of sync; you can't run this command now 2007-08-29 15:56:45 5194 Error: pool_init() failed what am i doing wrong. - i also have written the fsck for mysqlfs, where can i submit my code? -- Mit freundlichen Grüßen, Smart Weblications GmbH Martinsberger Str. 1 D-95119 Naila fon.: +49 700 762 789 32 - 0,12 EUR/Min* fax.: +49 700 762 789 32 - 0,12 EUR/Min* 24/7: +49 900 311 886 00 - 1,99 EUR/Min* http://www.smart-weblications.de -- Sitz der Gesellschaft: Naila Geschäftsführer: Florian Wiessner HRB-Nr.: HRB 3840 Amtsgericht Hof *aus dem dt. Festnetz, ggf. abweichende Preise aus dem Mobilfunknetz |
From: Andrew R. <ros...@gm...> - 2007-08-29 14:42:30
|
It could be a problem with your fsck code? I've used mysqlfs quite extensively and not come across this in the production code, but have in my own additions. Andrew On 29/08/2007, Smart Weblications GmbH, Florian Wiessner <f.w...@sm...> wrote: > Hello, > > > i have some problem mounting mysqlfs: > > ./mysqlfs -ouser=3Droottest -opassword=3Dxxxxxx-ohostname=3Dlocalhost > -odatabase=3Dmysqlfs /mnt > 2007-08-29 15:56:45 5194 Error: mysql_query() > 2007-08-29 15:56:45 5194 mysql_error: Commands out of sync; you can't > run this command now > 2007-08-29 15:56:45 5194 Error: pool_init() failed > > what am i doing wrong. > > > - i also have written the fsck for mysqlfs, where can i submit my code? > > > -- > > Mit freundlichen Gr=FC=DFen, > > > Smart Weblications GmbH > Martinsberger Str. 1 > D-95119 Naila > > fon.: +49 700 762 789 32 - 0,12 EUR/Min* > fax.: +49 700 762 789 32 - 0,12 EUR/Min* > 24/7: +49 900 311 886 00 - 1,99 EUR/Min* > http://www.smart-weblications.de > > -- > Sitz der Gesellschaft: Naila > Gesch=E4ftsf=FChrer: Florian Wiessner > HRB-Nr.: HRB 3840 Amtsgericht Hof > *aus dem dt. Festnetz, ggf. abweichende Preise aus dem Mobilfunknetz > > ------------------------------------------------------------------------- > This SF.net email is sponsored by: Splunk Inc. > Still grepping through log files to find problems? Stop. > Now Search log events and configuration files using AJAX and a browser. > Download your FREE copy of Splunk now >> http://get.splunk.com/ > _______________________________________________ > Mysqlfs-general mailing list > Mys...@li... > https://lists.sourceforge.net/lists/listinfo/mysqlfs-general > |
From: Smart W. G. F. W. <f.w...@sm...> - 2007-08-29 14:56:24
|
Andrew Rose schrieb: > It could be a problem with your fsck code? I've used mysqlfs quite > extensively and not come across this in the production code, but have > in my own additions. > I don't think it is a problem with my code, i have patched like this: diff -Naur query.c.orig query.c --- query.c.orig 2007-08-29 04:53:00.000000000 +0200 +++ query.c 2007-08-29 16:28:43.000000000 +0200 @@ -920,5 +920,124 @@ int query_fsck(MYSQL *mysql) { // See TODO file for what should be here... + printf("Starting fsck\n"); + + // 1. delete inodes with deleted==1 + int ret; + int ret2; + int result; + char sql[SQL_MAX]; + printf("Stage 1...\n"); + snprintf(sql, SQL_MAX, + "DELETE from inodes WHERE inodes.deleted = 1"); + + log_printf(LOG_D_SQL, "sql=%s\n", sql); + + ret = mysql_query(mysql, sql); + if(ret){ + log_printf(LOG_ERROR, "Error: mysql_query()\n"); + log_printf(LOG_ERROR, "mysql_error: %s\n", mysql_error(mysql)); + return -EIO; + } + snprintf(sql, SQL_MAX, + "OPTIMIZE TABLE inodes;"); + + log_printf(LOG_D_SQL, "sql=%s\n", sql); + + ret = mysql_query(mysql, sql); + if(ret){ + log_printf(LOG_ERROR, "Error: mysql_query()\n"); + log_printf(LOG_ERROR, "mysql_error: %s\n", mysql_error(mysql)); + return -EIO; + } + + // 2. - delete direntries without corresponding inode + printf("Stage 2...\n"); + // not sure if delete from tree where not inode in (select inode from inodes) will work! + // + snprintf(sql, SQL_MAX, "delete from tree where not inode in (select inode from inodes);"); + + log_printf(LOG_D_SQL, "sql=%s\n", sql); + + ret = mysql_query(mysql, sql); + if(ret){ + log_printf(LOG_ERROR, "Error: mysql_query()\n"); + log_printf(LOG_ERROR, "mysql_error: %s\n", mysql_error(mysql)); + return -EIO; + } + + + + // 3. set inuse=0 for all inodes + printf("Stage 3...\n"); + snprintf(sql, SQL_MAX, "UPDATE inodes SET inuse=0;"); + + log_printf(LOG_D_SQL, "sql=%s\n", sql); + + ret = mysql_query(mysql, sql); + if(ret){ + log_printf(LOG_ERROR, "Error: mysql_query()\n"); + log_printf(LOG_ERROR, "mysql_error: %s\n", mysql_error(mysql)); + return -EIO; + } + + + // 4. delete data without existing inode + printf("Stage 4...\n"); + snprintf(sql, SQL_MAX, "delete from data_blocks where inode not inodes.inode;"); + + log_printf(LOG_D_SQL, "sql=%s\n", sql); + + ret = mysql_query(mysql, sql); + if(ret){ + log_printf(LOG_ERROR, "Error: mysql_query()\n"); + log_printf(LOG_ERROR, "mysql_error: %s\n", mysql_error(mysql)); + return -EIO; + } + + + // 5. synchronize inodes.size=data.LENGTH(data) + printf("Stage 5...\n"); + long inode; + long size; + + snprintf(sql, SQL_MAX, "select inode, sum(OCTET_LENGTH(data)) as size from data_blocks group by inode"); + + log_printf(LOG_D_SQL, "sql=%s\n", sql); + + ret = mysql_query(mysql, sql); + + MYSQL_RES* myresult; + MYSQL_ROW row; + + myresult = mysql_store_result(mysql); + + while ((row = mysql_fetch_row(myresult)) != NULL) { + inode = *(row[0]); + size = *(row[1]); + snprintf(sql, SQL_MAX, "update inodes set size=%ld where inode=%ld;", size, inode); + log_printf(LOG_D_SQL, "sql=%s\n", sql); + result = mysql_query(mysql, sql); + +/* if (myresult) { // something has gone wrong.. delete datablocks... + + snprintf(sql, SQL_MAX, "delete from inodes where inode=%ld;", inode); + log_printf(LOG_D_SQL, "sql=%s\n", sql); + ret2 = mysql_query(mysql, sql); + + } +*/ // skip this for now! + + } + + if(ret){ + log_printf(LOG_ERROR, "Error: mysql_query()\n"); + log_printf(LOG_ERROR, "mysql_error: %s\n", mysql_error(mysql)); + return -EIO; + } + mysql_free_result(myresult); + printf("fsck done!\n"); return 0; + + } so normaly this shouldn't affect mounting mysqlfs. -- Mit freundlichen Grüßen, Smart Weblications GmbH Martinsberger Str. 1 D-95119 Naila fon.: +49 700 762 789 32 - 0,12 EUR/Min* fax.: +49 700 762 789 32 - 0,12 EUR/Min* 24/7: +49 900 311 886 00 - 1,99 EUR/Min* http://www.smart-weblications.de -- Sitz der Gesellschaft: Naila Geschäftsführer: Florian Wiessner HRB-Nr.: HRB 3840 Amtsgericht Hof *aus dem dt. Festnetz, ggf. abweichende Preise aus dem Mobilfunknetz |