Deploy module uses two types of replication: Internal replication - the replicator is provided by Workspace + Replication modules and External replication - the replicator is provided by Relaxed module + relaxedws/replicator library.

Important: When the Relaxed module is enabled the External replicator will take over the Internal replicator because the external one has an higher priority (this is how it works and should work by design).

After introducing replication filters in #2710947: Support replication filters and #2749167: Support ReplicationTask the external replication doesn't work because of the incompatibility between Drupal\replication\ReplicationTask\ReplicationTask provided by Replication module and the Relaxed\Replicator\ReplicationTask provided by relaxedws/replicator library.

The error:

TypeError: Argument 3 passed to Relaxed\Replicator\Replicator::__construct() must be an instance of Relaxed\Replicator\ReplicationTask, instance of Drupal\replication\ReplicationTask\ReplicationTask given, called in /var/www/drupal8dev/modules/relaxed/src/CouchdbReplicator.php on line 47 in Relaxed\Replicator\Replicator->__construct() (line 31 of /var/www/drupal8dev/vendor/relaxedws/replicator/src/Replicator.php) 
#0 /var/www/drupal8dev/modules/relaxed/src/CouchdbReplicator.php(47): Relaxed\Replicator\Replicator->__construct(Object(Doctrine\CouchDB\CouchDBClient), Object(Doctrine\CouchDB\CouchDBClient), Object(Drupal\replication\ReplicationTask\ReplicationTask)) 
#1 /var/www/drupal8dev/modules/workspace/src/ReplicatorManager.php(159): Drupal\relaxed\CouchdbReplicator->replicate(Object(Drupal\workspace\Entity\WorkspacePointer), Object(Drupal\workspace\Entity\WorkspacePointer), Object(Drupal\replication\ReplicationTask\ReplicationTask)) 
#2 /var/www/drupal8dev/modules/workspace/src/ReplicatorManager.php(140): Drupal\workspace\ReplicatorManager->doReplication(Object(Drupal\workspace\Entity\WorkspacePointer), Object(Drupal\workspace\Entity\WorkspacePointer), Object(Drupal\replication\ReplicationTask\ReplicationTask)) 
#3 /var/www/drupal8dev/modules/workspace/src/ReplicatorManager.php(70): Drupal\workspace\ReplicatorManager->update(Object(Drupal\workspace\Entity\WorkspacePointer), Object(Drupal\workspace\Entity\WorkspacePointer), Object(Drupal\replication\ReplicationTask\ReplicationTask)) 

Steps to reproduce the bug:
1) Enable Relaxed and Deploy modules (do all configuration, download composer dependences).
2) Create a node on Live workspace.
3) Replicate the content to the Stage workspace. Replication will fail with the error mentioned above.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

jeqq created an issue. See original summary.

radubutco’s picture

Project: RELAXed Web Services » Replication

I've moved this into Replication because the problem is in the Replication module.

radubutco’s picture

The patch fix the ReplicationTask class to extend the Relaxed\Replicator\ReplicationTask.

  • jeqq committed 70c2df7 on 8.x-1.x authored by radubutco
    Issue #2796947 by radubutco, jeqq: ReplicationTask object for internal...
jeqq’s picture

Status: Needs review » Fixed

Thank you Radu!

josephdpurcell’s picture

Status: Fixed » Needs work

I'm setting this back to Needs Work. Here's why:

  1. Install Workspace and Workbench Moderation modules
  2. Create a workspace with upstream set to "Live"
  3. Switch to this new workspace and click "Update"

You will see this error triggered:

PHP Fatal error:  Class 'Relaxed\\Replicator\\ReplicationTask' not found in /var/www/sites.local/d8/docroot/modules/contrib/replication/src/ReplicationTask/ReplicationTask.php on line 10

Recommended Resolution

The order of dependencies is Relaxed depends on Workspace depends on Replication. The interface, then, that should be complied with is ReplicationTask, not RelaxedReplicationTask. The RelaxedReplicationTask is for the PHP CouchDB implementation, which has a different use case than ReplicationTask, particularly the fact Replication is not a CouchDB implementation, it only mimicks it.

Given that, I suggest:

  1. Remove the ReplicationTask extending RelaxedReplicationTask
  2. Create a ticket on relaxed to modify relaxed/src/CouchdbReplicator.php::replicate to map from ReplicationTask to the RelaxedReplicationTask
josephdpurcell’s picture

Status: Needs work » Needs review

This patch removes the dependency on Relaxed in ReplicationTask.

It also adds a @todo for the drush.inc to either be moved to Relaxed or revised to not be dependent upon Relaxed.

josephdpurcell’s picture

Priority: Major » Critical

Setting to critical bug since the module is unusable until this is resolved.

josephdpurcell’s picture

Hmm, the patch didn't submit. Adding it again.

  • jeqq committed f34637f on 8.x-1.x authored by josephdpurcell
    Issue #2796947 by josephdpurcell, radubutco, jeqq: ReplicationTask...
jeqq’s picture

Status: Needs review » Fixed

Thank you Joseph! I've missed the fact that Relaxed is not a dependence for Replication.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.