commit 4925418922a266d5a888cae774f4e2137ebb6959
Author: Damien Tournoud <damien@commerceguys.com>
Date:   Tue Mar 6 18:44:39 2012 +0100

    Issue #1470670: don't try to save a DrupalCacheArray we know is invalid.

diff --git a/core/includes/bootstrap.inc b/core/includes/bootstrap.inc
index 39bc55c..868ecb4 100644
--- a/core/includes/bootstrap.inc
+++ b/core/includes/bootstrap.inc
@@ -427,6 +427,13 @@ abstract class DrupalCacheArray implements ArrayAccess {
   }
 
   /**
+   * Invalidate this cache object so that it will not be persisted.
+   */
+  public function invalidate() {
+    $this->keysToPersist = array();
+  }
+
+  /**
    * Destructs the DrupalCacheArray object.
    */
   public function __destruct() {
@@ -2933,9 +2940,14 @@ function ip_address() {
  *   If true, the schema will be rebuilt instead of retrieved from the cache.
  */
 function drupal_get_schema($table = NULL, $rebuild = FALSE) {
-  static $schema;
+  $schema = &drupal_static(__FUNCTION__);
 
   if ($rebuild || !isset($table)) {
+    if ($schema instanceof SchemaCache) {
+      // Invalidate the previous cache so that it will not be persisted.
+      $schema->invalidate();
+    }
+
     $schema = drupal_get_complete_schema($rebuild);
   }
   elseif (!isset($schema)) {
@@ -2954,6 +2966,19 @@ function drupal_get_schema($table = NULL, $rebuild = FALSE) {
 }
 
 /**
+ * Reset the schema cache.
+ */
+function drupal_get_schema_reset() {
+  cache_clear_all('schema:', 'cache', TRUE);
+  $schema = drupal_static('drupal_get_schema');
+  if ($schema instanceof SchemaCache) {
+    // Invalidate the previous cache so that it will not be persisted.
+    $schema->invalidate();
+  }
+  drupal_static_reset('drupal_get_schema');
+}
+
+/**
  * Extends DrupalCacheArray to allow for dynamic building of the schema cache.
  */
 class SchemaCache extends DrupalCacheArray {
diff --git a/core/modules/field/modules/field_sql_storage/field_sql_storage.module b/core/modules/field/modules/field_sql_storage/field_sql_storage.module
index adc50bd..fbc2f88 100644
--- a/core/modules/field/modules/field_sql_storage/field_sql_storage.module
+++ b/core/modules/field/modules/field_sql_storage/field_sql_storage.module
@@ -218,7 +218,7 @@ function field_sql_storage_field_storage_create_field($field) {
   foreach ($schema as $name => $table) {
     db_create_table($name, $table);
   }
-  drupal_get_schema(NULL, TRUE);
+  drupal_get_schema_reset();
 }
 
 /**
@@ -299,7 +299,7 @@ function field_sql_storage_field_storage_update_field($field, $prior_field, $has
       }
     }
   }
-  drupal_get_schema(NULL, TRUE);
+  drupal_get_schema_reset();
 }
 
 /**
