We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 15083
    • 697 Posts
    Hi there,

    I'm running MODx 2.2.14 on a read-only mysql server cluster, where one instance is a master with read/write, and the CMS uses this.
    The site is working however I am getting a recurring error in the logs:

    UPDATE `modx_site_htmlsnippets` SET `source` = 3,`snippet` = '<p>Mychunk</p>' WHERE `id` = 100000
    Array
    (
        [0] => HY000
        [1] => 1290
        [2] => The MySQL server is running with the --read-only option so it cannot execute this statement
    )


    I get lots of the above for almost all chunks, with the error obviously down to the read-only flag.
    Why would UPDATES be occurring when I hit the frontend context?
    I have turned off the modx_session and was under the impression that this is the only thing that might cause MODx to write to the DB?

    Any help much appreciated smiley

    J
      • 28042 ☆ A M B ☆
      • 24,524 Posts
      It looks like it's trying to add it to the cache, and indicate that it should be taken from the cache.

      But that's just a wild guess. I cannot find any documentation on just what that "source" field is, and what a value of 0, 1, or 3, or any other value for that matter, means.

      Looking at cached chunks, it appears that there are references to Media Sources. I don't know exactly how that relates to this situation, though. [ed. note: sottwell last edited this post 12 years, 1 month ago.]
        Studying MODX in the desert - http://sottwell.com
        Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
        Join the Slack Community - http://modx.org
        • 15083
        • 697 Posts
        Quote from: sottwell at Aug 28, 2014, 07:18 AM
        It looks like it's trying to add it to the cache, and indicate that it should be taken from the cache.

        Hi Susan,

        Thanks for the reply smiley
        I'm guessing the source is the Media Source, as I do have one with ID=3 used for my chunks.

        What I am struggling to understand is why MODx is trying to UPDATE the chunk each time in the db?
        I have tried to load MODx and let xPDO know that the connection is read only:
        $modx= new modX('', array(xPDO::OPT_CONN_INIT => array(xPDO::OPT_CONN_MUTABLE => false)));


        This seems to reduce the error log down to lots of these:
        (ERROR in xPDOObject::save @ /core/xpdo/om/xpdoobject.class.php : 1349) Could not get connection for writing data


        I would like to eliminate these UPDATES however, as its obviously not supposed to happen and would slow the site down.

        Cheers,

        J