Jul
31
2010
--

Why you can’t rely on a replica for disaster recovery

A couple of weeks ago one of my colleagues and I worked on a data corruption case that reminded me that sometimes people make unsafe assumptions without knowing it. This one involved SAN snapshotting that was unsafe.

In a nutshell, the client used SAN block-level replication to maintain a standby/failover MySQL system, and there was a failover that didn’t work; both the primary and fallback machine had identically corrupted data files. After running fsck on the replica, the InnoDB data files were entirely deleted.

When we arrived on the scene, there was a data directory with an 800+ GB data file, which we determined had been restored from a SAN snapshot. Accessing this file caused a number of errors, including warnings about accessing data outside of the partition boundaries. We were eventually able to coax the filesystem into truncating the data file back to a size that didn’t contain invalid pointers and could be read without errors on the filesystem level. From InnoDB’s point of view, though, it was still completely corrupted. The “InnoDB file” contained blocks of data that were obviously from other files, such as Python exception logs. The SAN snapshot was useless for practical purposes. (The client decided not to try to extract the data from the corrupted file, which we have specialized tools for doing. It’s an intensive process that costs a little money.)

The problem was that the filesystem was ext2, with no journaling and no consistency guarantees. A snapshot on the SAN is just the same as cutting the power to the machine — the block device is in an inconsistent state. A filesystem that can survive that has to ensure that it writes the data to the block device such that it can bring into a consistent state later. The techniques for doing this include things like ordered writes and meta-data journaling. But ext2 does not know how to do that. The data that’s seen by the SAN is some jumble of blocks that represents the most efficient way to transfer the changed blocks over the interconnect, without regard to logical consistency on the filesystem level.

Two things can help avoid such a disaster: 1) get qualified advice and 2) don’t trust the advice; backups and disaster recovery plans must be tested periodically.

This case illustrates an important point that I repeat often. The danger of using a replica as a backup is that data loss on the primary can affect the replica, too. This is true no matter what type of replication is being used. In this case it’s block-level SAN replication. DRBD would behave just the same way. At a higher level, MySQL replication has the same weakness. If you rely on a MySQL slave for a “backup,” you’ll be out of luck when someone accidentally runs DROP TABLE on your master. That statement will promptly replicate over and drop the table off your “backup.”

I still see people using a replica as a backup, and I know it’s just a matter of time before they lose data. In my experience, the types of errors that will propagate through replication are much more common than those that’ll be isolated to just one machine, such as hardware failures.


Entry posted by Baron Schwartz |
24 comments

Add to: delicious | digg | reddit | netscape | Google Bookmarks

Jul
31
2010
--

Letzte offene Symfony Schulung in 2010

Hallo,

vom 29.09. bis 01.10. werde ich meine für dieses Jahr letzte offene Symfony-Schulung halten. Der Schulungsort wird voraussichtlich Heilbronn sein (Baden-Würtemberg). Die Schulung kostet 990.- Euro pro Person und dauert 3 Tage.  Mehr Informationen auch zu den Schulungsinhalten gibt es hier.

Jul
30
2010
--

Storing MySQL Binary logs on NFS Volume

There is a lot of discussions whenever running MySQL storing data on NFS is a good idea. There is a lot of things for and against this and this post is not about them.
The fact is number of people run their databases on NetApp and other forms of NFS storage and this post is about one of discoveries in such setup.

There are good reasons to have binary logs on NFS volume – binary logs is exactly the thing you want to survive the server crash – using them you can do point in time recovery from backup.

I was testing high volume replication today using Sysbench:

SQL:

  1. sysbench –test=oltp –oltp-table-size=10000000 –db-driver=mysql –mysql-user=root –mysql-db=sbsmall –init-rng=1 –max-requests=100000000 –max-time=600 –oltp-test-mode=nontrx –oltp-nontrx-mode=update_nokey –num-threads=8 run

On this box I got around 12.000 of updates/sec which is not the perfect number, though it mainly was because of contention issues in MySQL 5.0 rather than any NAS issues.
This number was reachable even with binary log stored on NFS volume. This number is for sync_binlog=0 and innodb_flush_log_at_trx_commit=2

I noted however if I enable replication – connect the slave to this box the throughput on the Master drops to about 2800 updates sec…. which is very close to the magic number how many network roundtrips per second I can get over 1Gb link. It was even more interesting when that. If I would pause replication for prolonged period of time and let few GB of binary logs to accumulate the performance on Master will be high even with replication running, but it will slow down as soon as IO thread on the slave is caught up with master.

When I moved the Binary logs to the local storage I got very similar performance but there have been no degradation when replication is enabled.

I have not checked in details why this could be the case but I guess there is something which requires a network roundtrip when the binary log is written at the same time as slave-feeding thread is reading it.

I’d be curious to know if someone else can observe such behavior and if there is an NFS tuning which can be done to avoid it or if we need to fix MySQL


Entry posted by peter |
15 comments

Add to: delicious | digg | reddit | netscape | Google Bookmarks

Jul
30
2010
--

Zend Framework 1.10.7 Released

The Zend Framework team announces the immediate availability of Zend
Framework 1.10.7, our seventh maintenance release in the 1.10 series. This
release includes around 60 bug fixes.

For those uses of Zend_Service_Twitter , please ensure you
upgrade to 1.10.6 or 1.10.7 ASAP. These releases introduce a change in the
Zend_Service_TWitter API that enforces the use of OAuth by
default when using methods that require authentication. The change was
introduced to help prepare Zend Framework users for the Twitter
OAuthcalypse in mid-August. (If you cannot upgrade, there
are other ways to integrate Zend_Oauth with
Zend_Service_Twitter .)

Jul
29
2010
--

symfony 2 documentation team looking for translators

As tweeted by Fabien Potencier, symfony2 now has a “translations” page on their site. If you read and write English and another language, they want you!

Jul
28
2010
--

Gonzalo Ayuso’s Blog: Clustering PHP applications. Tips and hints

In a new post to his blog today Gonzalo Ayuso offers some tips for those out there wanting to cluster their PHP applications effectively.

Jul
27
2010
--

MongoDB ODM: MongoDB for eCommerce

A few days ago Bulat S. posted a very interesting post titled “MongoDB ODM : MongoDB for eCommerce”. If you missed it, click on through…I’ve got the link around here somewhere.

Jul
26
2010
--

Nick Belhomme on PHP 5.3.3 namespaces

Nick Belhomme has written a great namespaces primer over on his blog. Click on in and I’ll show you why it is important to you.

Jul
25
2010
--

A week of symfony #186 (19->25 July 2010)

Symfony2 routing management was completely revamped this week with new loaders, methods, and configuration. These new loaders were also added to the Dependency Injection component. In addition, Doctrine bundle fixed several bugs and the internationalization component was added.

Development mailing list

Development highlights

Symfony 2.X branch:

  • b828617: [DoctrineBundle] fixed multiple connections via XML
  • 1bc973e: [DoctrineBundle] added missing driver options (memory, used by sqlite; charset, used by oci) to the supported configuration options supported by DoctrineBundle
  • 7287913: [DoctrineBundle] fixed defect in doctrine:generate:entity where xml extension was added to all mapping types
  • e33894a: [DoctrineBundle] fixed issue with doctrine:generate:entity command when no –fields are specified
  • 216dc0f: [DoctrineBundle, DoctrineMongoDBBundle] made sure proxy directory is created when DI container is being built
  • 93f2d6e: [FrameworkBundle] removed pdo.xml
  • e6cbfd7: [Console] changed CommandTester to allow testing Command classes without the need for an Application
  • 14cecd5: [Routing] refactored loaders: added supports() and setResolver() methods to LoaderInterface, added a LoaderResolver interface, added a Loader base class, DelegatingLoader, ClosureLoader, and PhpFileLoader, refactored the import mechanism for better flexibility
  • 4e3e86c: refactored routing management: now it’s possible to disable the default routing, removed the Kernel::registerRoutes() method, added a router entry in (replaces the registerRoutes() method), refactored routing configuration in its own routing.xml file
  • 60c6827, dcaf436: [DependencyInjection] refactored loaders: added supports() and setResolver() methods to LoaderInterface, added a LoaderResolver interface, added a Loader base class, DelegatingLoader, ClosureLoader, and PhpFileLoader, refactored the import mechanism for better flexibility
  • 3f270f5, ef40118: [FrameworkBundle] added a skeleton for configuration in plain PHP
  • bfb081f: [ZendBundle] added Zend\\Translator component

…and many other changes

Development digest: 115 changesets, 12 bugs reported, 1 bug fixed, 1 enhancement suggested, 2 documentation defects reported, and 4 documentation edits.

Documentation

New developers for hire

  • Adam Tombleson (rekarnar@gmail.com): Wellington, New Zealand based freelance PHP developer. I’ve been working with symfony since 1.0.

Plugins

  • New plugins
    • sfPostgresDoctrinePlugin: extends the sfDoctrinePlugin for Postgres database.
    • magmaPlugin: (no description)
    • pxWymeditorPlugin: provides a new widget to use WYMeditor (http://www.wymeditor.org/) for textareas in your forms.
    • sfGoogleDidYouMeanPlugin: implements easily Google’s “did you mean” feature.
    • sfRssCalCreatorPlugin: a modified version of rsscalCreator. That is a PHP class that implements the rsscal (RDF) specification of iCal, RFC2445. Only the calendar event component is implemented.
  • Updated plugins
    • sfDependentSelectPlugin: change value of ‘key_method’ option to ‘getId’ for propel compatibility, updated README, bugfixes in sfDependentSelectPropelSource and sfWidgetFormPropelDependentSelect, added multiples selects
    • sfProjectAnalyserPlugin: analysis of lib class of project, added analysis of symfony extended classes
    • sfPhpunitPlugin: base class for doctrine fixtures, add file fixture level to manage just files without defining the database type, fixed _collect_coverage config option
    • fpBuildPlugin: fixed total timer issue, fixed bug with quiet option
    • sfTrafficCMSPlugin: added autoconfig for setting options on datetime widgets as well as date widgets, improved the navigation menu
    • sfDoctrineGuardPlugin: fixed random generator for RememberMe keys
    • ExtjsGeneratorPlugin: added missing il8n helper in bottomToolbarSuccess.js.php, added autoLoadStore config option for gridpanel, added addslashes for handler function definition for toolbar buttons, re-enabled formpanel cleaning onSubmitSuccess, updated fieldhelp to work with checkboxes and radio buttons, added a check to not show the help if the plugin is added to an element but no helpText is present
    • csDoctrineActAsGeolocatablePlugin: revamped of Geolocatable plugin
    • sfErrorNotifierPlugin: refactored version, changed message format, removed test fatal error on init step
    • sfImageTransformExtraPlugin: added release notes and version number for 1.0.6 release, fixed fill and style options from off to ~, fixed boolean parameters for resize options, fixed spare brackets, fixed channel url for sfImageTransformPlugin
    • sfDoctrineActAsRattablePlugin: fixed strict warning for buildLocalRelation
    • sfRedisPlugin: upgraded to latest Predis script, try a mix between sfPager / redis / Doctrine
    • sfSphinxPlugin: fixed sort in Doctrine pager
    • dsExtDirectPlugin: fixed issue where zero-length tree requests might generate an error
    • gbI18nRoutePlugin: code clean up
    • sfJqueryReloadedPlugin: updated sfJqueryReloadedPlugin to have the last version of jquery ui that was released for 1.3.2
    • sfDbDesignerAlternativePlugin: fixed xsl issues with decimal type and scal
    • diemProject:
      • fixed issue when dropping medias in admin record page
      • added Bulgarian translation
      • dmMailTemplate now works with dm_i18n_form = ‘embed’ parameter
      • generator.yml changed thru a symfony dmAdmin:generate –clear=dmMailTemplate
    • apostrophePlugin:
      • cropping is usable now, at least when constraints are in place
      • fixing duplicated slideshow media item selection
      • fixed bug with button slot outputting empty markup
      • fixed accessibility bug with search partial
      • fixed the navigation page titles were not encoding html entities properly when outputting a page title with an ampersand in it
      • new aDate::mysql() method takes a PHP timestamp, MySQL datetime or MySQL date (defaulting to now) and returns a MySQL datetime format string suitable for calling setCreatedAt() or similar
      • removed remember me button from the signin form because it does not work
      • changed the default fck toolbar for sidebar
      • aArray::isFlat checks whether an array is a flat array
      • fixed a bug with aString.class.php where the ellipses encoded character getting appended to truncated strings was missing the ending semicolon
      • updated the aHtml::limitWords to accept the append_ellipses option that aString::limitWord already accepts
      • fixed a bug with aMultipleSelect, the javascript was using method that is not available in all browsers
      • email obfuscator was generating random GUIDs for the email mailto links
      • updated jquery UI to be the last version released to work with jquery 1.3.2
    • apostropheBlogPlugin:
      • upcoming events query is added unless filtering by date
      • permalink displayed in post and event editor now displays the date in the url
      • made it easier to override engine settings forms
      • updated blog plugin to use jquery ui 1.7.3 by default if it is not set in settings.yml
      • published_at now has a default value
      • altered formating of dates in event admin
      • fixed event admin was using a blog route for removing filters

New symfony powered websites

  • RestInBook: (English, and Spanish) Post a remembers or photos to a late’s by twitter or via web

They talked about us


Be trained by symfony experts
Aug 10 Online – Aug 25 Paris – Sep 07 Online – Sep 22 Paris – Oct 05 Online

Written by in: Zend Developer |
Jul
25
2010
--

A week of symfony #186 (19->25 July 2010)

Symfony2 routing management was completely revamped this week with new loaders, methods, and configuration. These new loaders were also added to the Dependency Injection component. In addition, Doctrine bundle fixed several bugs and the internationalization component was added.

Development mailing list

Development highlights

Symfony 2.X branch:

  • b828617: [DoctrineBundle] fixed multiple connections via XML
  • 1bc973e: [DoctrineBundle] added missing driver options (memory, used by sqlite; charset, used by oci) to the supported configuration options supported by DoctrineBundle
  • 7287913: [DoctrineBundle] fixed defect in doctrine:generate:entity where xml extension was added to all mapping types
  • e33894a: [DoctrineBundle] fixed issue with doctrine:generate:entity command when no –fields are specified
  • 216dc0f: [DoctrineBundle, DoctrineMongoDBBundle] made sure proxy directory is created when DI container is being built
  • 93f2d6e: [FrameworkBundle] removed pdo.xml
  • e6cbfd7: [Console] changed CommandTester to allow testing Command classes without the need for an Application
  • 14cecd5: [Routing] refactored loaders: added supports() and setResolver() methods to LoaderInterface, added a LoaderResolver interface, added a Loader base class, DelegatingLoader, ClosureLoader, and PhpFileLoader, refactored the import mechanism for better flexibility
  • 4e3e86c: refactored routing management: now it’s possible to disable the default routing, removed the Kernel::registerRoutes() method, added a router entry in (replaces the registerRoutes() method), refactored routing configuration in its own routing.xml file
  • 60c6827, dcaf436: [DependencyInjection] refactored loaders: added supports() and setResolver() methods to LoaderInterface, added a LoaderResolver interface, added a Loader base class, DelegatingLoader, ClosureLoader, and PhpFileLoader, refactored the import mechanism for better flexibility
  • 3f270f5, ef40118: [FrameworkBundle] added a skeleton for configuration in plain PHP
  • bfb081f: [ZendBundle] added Zend\\Translator component

…and many other changes

Development digest: 115 changesets, 12 bugs reported, 1 bug fixed, 1 enhancement suggested, 2 documentation defects reported, and 4 documentation edits.

Documentation

New developers for hire

  • Adam Tombleson (rekarnar@gmail.com): Wellington, New Zealand based freelance PHP developer. I’ve been working with symfony since 1.0.

Plugins

  • New plugins
    • sfPostgresDoctrinePlugin: extends the sfDoctrinePlugin for Postgres database.
    • magmaPlugin: (no description)
    • pxWymeditorPlugin: provides a new widget to use WYMeditor (http://www.wymeditor.org/) for textareas in your forms.
    • sfGoogleDidYouMeanPlugin: implements easily Google’s “did you mean” feature.
    • sfRssCalCreatorPlugin: a modified version of rsscalCreator. That is a PHP class that implements the rsscal (RDF) specification of iCal, RFC2445. Only the calendar event component is implemented.
  • Updated plugins
    • sfDependentSelectPlugin: change value of ‘key_method’ option to ‘getId’ for propel compatibility, updated README, bugfixes in sfDependentSelectPropelSource and sfWidgetFormPropelDependentSelect, added multiples selects
    • sfProjectAnalyserPlugin: analysis of lib class of project, added analysis of symfony extended classes
    • sfPhpunitPlugin: base class for doctrine fixtures, add file fixture level to manage just files without defining the database type, fixed _collect_coverage config option
    • fpBuildPlugin: fixed total timer issue, fixed bug with quiet option
    • sfTrafficCMSPlugin: added autoconfig for setting options on datetime widgets as well as date widgets, improved the navigation menu
    • sfDoctrineGuardPlugin: fixed random generator for RememberMe keys
    • ExtjsGeneratorPlugin: added missing il8n helper in bottomToolbarSuccess.js.php, added autoLoadStore config option for gridpanel, added addslashes for handler function definition for toolbar buttons, re-enabled formpanel cleaning onSubmitSuccess, updated fieldhelp to work with checkboxes and radio buttons, added a check to not show the help if the plugin is added to an element but no helpText is present
    • csDoctrineActAsGeolocatablePlugin: revamped of Geolocatable plugin
    • sfErrorNotifierPlugin: refactored version, changed message format, removed test fatal error on init step
    • sfImageTransformExtraPlugin: added release notes and version number for 1.0.6 release, fixed fill and style options from off to ~, fixed boolean parameters for resize options, fixed spare brackets, fixed channel url for sfImageTransformPlugin
    • sfDoctrineActAsRattablePlugin: fixed strict warning for buildLocalRelation
    • sfRedisPlugin: upgraded to latest Predis script, try a mix between sfPager / redis / Doctrine
    • sfSphinxPlugin: fixed sort in Doctrine pager
    • dsExtDirectPlugin: fixed issue where zero-length tree requests might generate an error
    • gbI18nRoutePlugin: code clean up
    • sfJqueryReloadedPlugin: updated sfJqueryReloadedPlugin to have the last version of jquery ui that was released for 1.3.2
    • sfDbDesignerAlternativePlugin: fixed xsl issues with decimal type and scal
    • diemProject:
      • fixed issue when dropping medias in admin record page
      • added Bulgarian translation
      • dmMailTemplate now works with dm_i18n_form = ‘embed’ parameter
      • generator.yml changed thru a symfony dmAdmin:generate –clear=dmMailTemplate
    • apostrophePlugin:
      • cropping is usable now, at least when constraints are in place
      • fixing duplicated slideshow media item selection
      • fixed bug with button slot outputting empty markup
      • fixed accessibility bug with search partial
      • fixed the navigation page titles were not encoding html entities properly when outputting a page title with an ampersand in it
      • new aDate::mysql() method takes a PHP timestamp, MySQL datetime or MySQL date (defaulting to now) and returns a MySQL datetime format string suitable for calling setCreatedAt() or similar
      • removed remember me button from the signin form because it does not work
      • changed the default fck toolbar for sidebar
      • aArray::isFlat checks whether an array is a flat array
      • fixed a bug with aString.class.php where the ellipses encoded character getting appended to truncated strings was missing the ending semicolon
      • updated the aHtml::limitWords to accept the append_ellipses option that aString::limitWord already accepts
      • fixed a bug with aMultipleSelect, the javascript was using method that is not available in all browsers
      • email obfuscator was generating random GUIDs for the email mailto links
      • updated jquery UI to be the last version released to work with jquery 1.3.2
    • apostropheBlogPlugin:
      • upcoming events query is added unless filtering by date
      • permalink displayed in post and event editor now displays the date in the url
      • made it easier to override engine settings forms
      • updated blog plugin to use jquery ui 1.7.3 by default if it is not set in settings.yml
      • published_at now has a default value
      • altered formating of dates in event admin
      • fixed event admin was using a blog route for removing filters

New symfony powered websites

  • RestInBook: (English, and Spanish) Post a remembers or photos to a late’s by twitter or via web

They talked about us


Be trained by symfony experts
Sep 22 Paris – Oct 05 Online – Oct 20 Paris – Nov 24 Paris – Dec 15 Paris

Written by in: Zend Developer |

Powered by WordPress | Theme: Aeros 2.0 by TheBuckmaker.com