Fmstrat / ownnote

Notes app for ownCloud
GNU Affero General Public License v3.0
168 stars 42 forks source link

too big notes dissappear -> chop notes into smaller chunks #325

Open ikke-t opened 8 years ago

ikke-t commented 8 years ago

Hi,

I have been doing restores from filesystem snapshots some times now, as I noticed ownnote looses a note occationally. It seems the "max_allowed_packet" limit is hit in mariadb. Should the notes be perhaps be chopped into smaller chunks while saving? Or saving the images as files instead?

I started collecting a note with pointers to internet, and uploaded some pictures into the note. All the sudden I lost the note :( Checking from database, the "note" entry was empty. I had to recover the database from snapshot, just to get the note back.

I'm running the latest nextcloud with ownnote activated. It's been good for long, but now it won't work any longer. Also the logic of saving the images within the note into the database bloats the DB size quickly. It would be nice if the attached pics would be files e.g. within the notes dir (once the dir + db option activated).

Here's the error log:

SQLSTATE[08S01]: Communication link failure: 1153 Got a packet bigger than 'max_allowed_packet' bytes","Code":0,"Trace":"#0 \/usr\/local\/www\/nextcloud\/3rdparty\/doctrine\/dbal\/lib\/Doctrine\/DBAL\/DBALException.php(116): Doctrine\DBAL\Driver\AbstractMySQLDriver->convertException('An exception oc...', Object(Doctrine\DBAL\Driver\PDOException))
#1 \/usr\/local\/www\/nextcloud\/3rdparty\/doctrine\/dbal\/lib\/Doctrine\/DBAL\/Statement.php(175): Doctrine\DBAL\DBALException::driverExceptionDuringQuery(Object(Doctrine\DBAL\Driver\PDOMySql\Driver), Object(Doctrine\DBAL\Driver\PDOException), 'INSERT INTO oc_...', Array)
#2 \/usr\/local\/www\/nextcloud\/lib\/private\/legacy\/db\/statementwrapper.php(74): Doctrine\DBAL\Statement->execute(Array)
#3 \/usr\/local\/www\/nextcloud\/apps\/ownnote\/lib\/backend.php(401): OC_DB_StatementWrapper->execute(Array)
#4 \/usr\/local\/www\/nextcloud\/apps\/ownnote\/lib\/backend.php(220): OCA\OwnNote\Lib\Backend->saveNote('', 'Arduino', '', '<h1>Linkkej&aum...', 1475004681)
#5 \/usr\/local\/www\/nextcloud\/apps\/ownnote\/controller\/ownnoteajaxcontroller.php(44): OCA\OwnNote\Lib\Backend->getListing('ownNote', false)
#6 [internal function]: OCA\OwnNote\Controller\OwnnoteAjaxController->ajaxindex()
#7 \/usr\/local\/www\/nextcloud\/lib\/private\/AppFramework\/Http\/Dispatcher.php(160): call_user_func_array(Array, Array)
#8 \/usr\/local\/www\/nextcloud\/lib\/private\/AppFramework\/Http\/Dispatcher.php(90): OC\AppFramework\Http\Dispatcher->executeController(Object(OCA\OwnNote\Controller\OwnnoteAjaxController), 'ajaxindex')
#9 \/usr\/local\/www\/nextcloud\/lib\/private\/AppFramework\/App.php(111): OC\AppFramework\Http\Dispatcher->dispatch(Object(OCA\OwnNote\Controller\OwnnoteAjaxController), 'ajaxindex')
#10 \/usr\/local\/www\/nextcloud\/lib\/private\/AppFramework\/Routing\/RouteActionHandler.php(47): OC\AppFramework\App::main('OwnnoteAjaxCont...', 'ajaxindex', Object(OC\AppFramework\DependencyInjection\DIContainer), Array)
#11 [internal function]: OC\AppFramework\Routing\RouteActionHandler->__invoke(Array)
#12 \/usr\/local\/www\/nextcloud\/lib\/private\/Route\/Router.php(293): call_user_func(Object(OC\AppFramework\Routing\RouteActionHandler), Array)
#13 \/usr\/local\/www\/nextcloud\/lib\/base.php(967): OC\Route\Router->match('\/apps\/ownnote\/a...')
#14 \/usr\/local\/www\/nextcloud\/index.php(48): OC::handleRequest()
#15 {main}","File":"\/usr\/local\/www\/nextcloud\/3rdparty\/doctrine\/dbal\/lib\/Doctrine\/DBAL\/Driver\/AbstractMySQLDriver.php","Line":116}
Fmstrat commented 6 years ago

Not sure why that would occur unless max_allowed_packet is set to lower than normal. Notes are already cut into chunks and no longer saved in the note entry of the main table.