diff --git a/core/lib/Drupal/Core/Database/Driver/mysql/Schema.php b/core/lib/Drupal/Core/Database/Driver/mysql/Schema.php
index c952630..3e31b97 100644
--- a/core/lib/Drupal/Core/Database/Driver/mysql/Schema.php
+++ b/core/lib/Drupal/Core/Database/Driver/mysql/Schema.php
@@ -598,6 +598,17 @@ public function fieldExists($table, $column) {
     }
   }
 
+  /**
+   * Set the autoincrement value on a table.
+   */
+  public function setAutoIncrement($table, $value) {
+    if (!is_numeric($value)) {
+      throw \InvalidArgumentException('AUTO_INCREMENT may only be set to an integer.');
+    }
+    $value = (int) $value;
+    return $this->connection->query('ALTER TABLE {' . $table . '} AUTO_INCREMENT ' . $value);
+  }
+
 }
 
 /**
diff --git a/core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorage.php b/core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorage.php
index 8031830..4aaba4f 100644
--- a/core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorage.php
+++ b/core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorage.php
@@ -1682,6 +1682,22 @@ public function countFieldData($storage_definition, $as_bool = FALSE) {
   }
 
   /**
+   * Set the autoincrement value on the base table.
+   */
+  public function setBaseTableAutoIncrement($value) {
+    $schema_handler = $this->database->schema();
+    $schema_handler->setAutoIncrement($this->baseTable, $value);
+  }
+
+  /**
+   * Set the autoincrement value on the revision table.
+   */
+  public function setRevisionTableAutoIncrement($value) {
+    $schema_handler = $this->database->schema();
+    $schema_handler->setAutoIncrement($this->revisionTable, $value);
+  }
+
+  /**
    * Determines whether the passed field has been already deleted.
    *
    * @param \Drupal\Core\Field\FieldStorageDefinitionInterface $storage_definition
diff --git a/core/modules/migrate/src/Plugin/migrate/destination/EntityContentBase.php b/core/modules/migrate/src/Plugin/migrate/destination/EntityContentBase.php
index 9da3de6..145d14d 100644
--- a/core/modules/migrate/src/Plugin/migrate/destination/EntityContentBase.php
+++ b/core/modules/migrate/src/Plugin/migrate/destination/EntityContentBase.php
@@ -9,6 +9,8 @@
 use Drupal\Core\Field\FieldTypePluginManagerInterface;
 use Drupal\Core\TypedData\TranslatableInterface;
 use Drupal\Core\TypedData\TypedDataInterface;
+use Drupal\migrate\Event\ImportAwareInterface;
+use Drupal\migrate\Event\MigrateImportEvent;
 use Drupal\migrate\Plugin\MigrationInterface;
 use Drupal\migrate\MigrateException;
 use Drupal\migrate\Plugin\MigrateIdMapInterface;
@@ -18,7 +20,7 @@
 /**
  * The destination class for all content entities lacking a specific class.
  */
-class EntityContentBase extends Entity {
+class EntityContentBase extends Entity implements ImportAwareInterface {
 
   /**
    * Entity manager.
@@ -262,6 +264,51 @@ public function rollback(array $destination_identifier) {
   }
 
   /**
+   * {@inheritdoc}
+   */
+  public function preImport(MigrateImportEvent $event) {
+  }
+
+  /**
+   * {@inheritdoc}
+   */
+  public function postImport(MigrateImportEvent $event) {
+    // When importing entities, IDs may be maintained from the source database.
+    // After an initial import, if entities are created on both the source and
+    // destination sites, it becomes impossible to correctly maintain IDs since
+    // they will conflict. To work around this problem, force a higher
+    // autoincrement each time the entity migration finishes, this should allow
+    // some headroom for entities to be created on the source site.
+    $definition = $this->storage->getEntityType();
+    $id_key = $definition->getKey('id');
+    $result =  $this->storage->getQuery()
+      ->sort($id_key, 'DESC')
+      ->range(0, 1)
+      ->execute();
+    if ($result) {
+      $last_id = reset($result);
+      $min = $last_id / 10;
+      $auto_increment = max($min, 100);
+      $this->storage->setBaseTableAutoIncrement($auto_increment);
+    }
+
+    if ($definition->isRevisionable() && $definition->getRevisionTable()) {
+      $revision_key = $definition->getKey('revision');
+      $result = $this->storage->getQuery()
+        ->allRevisions()
+        ->sort($revision_key, 'DESC')
+        ->range(0, 1)
+        ->execute();
+      if ($result) {
+        $last_id = key($result);
+        $min = $last_id / 10;
+        $auto_increment = max($min, 100);
+        $this->storage->setRevisionTableAutoIncrement($auto_increment);
+      }
+    }
+  }
+
+  /**
    * Gets the field definition from a specific entity base field.
    *
    * The method takes the field ID as an argument and returns the field storage
