Hello,

First, thank you for the deploy ecosystem for D8.

I am currently testing the deploy ecosystem and I found the video about the content hub (https://www.youtube.com/watch?v=CTqAyYcLZB0) and couchDB and I wanted to test it.

I am on Drupal 8.1.10 and the dev version for each deploy ecosystem modules.

I installed a couchDB 2.0.0 and when I try to push to it I got the following errors

Symfony\Component\HttpKernel\Exception\BadRequestHttpException: history.0.recorded_seq: This value should be of the correct primitive type.. history.0.start_last_seq: This value should be of the correct primitive type. in Drupal\relaxed\Plugin\rest\resource\ResourceBase->validate() (line 115 of /modules/contrib/relaxed/src/Plugin/rest/resource/ResourceBase.php).

Doctrine\CouchDB\HTTP\HTTPException: HTTP Error with status 400 occurred while requesting /couchdb/_local/2b45f3c66e06e911e87f6e6db49c11bb. Error: bad_request history.0.recorded_seq: This value should be of the correct primitive type.. history.0.start_last_seq: This value should be of the correct primitive type. in Doctrine\CouchDB\HTTP\HTTPException::fromResponse() (line 68 of /vendor/doctrine/couchdb/lib/Doctrine/CouchDB/HTTP/HTTPException.php).

And I tested with a couchDB in a Docker container and it worked. https://hub.docker.com/_/couchdb/. 1.6.1

I don't know if it is a known bug. Currently I don't have any couchDB version imposed and that does not block my tests.

Comments

Grimreaper created an issue. See original summary.

Grimreaper’s picture

Hello,

I saw that couchdb 2.0.0 responded with strings for the sequence so I changed the DataDefinition for the ReplicationHistoryItem.

Here is a quick fix I don't know the implication of this change.

By the way, I am on Drupal 8.2.*

Thanks for the review.

Status: Needs review » Needs work

The last submitted patch, 2: replication-compatible_couchdb_2-2832467-2.patch, failed testing.

dixon_’s picture

Awesome, very simple patch. However, we will need a hook_update_N() to handle the upgrade for existing sites and fix the tests for this.

Grimreaper’s picture

Thanks for the reply.

I will see next week if I can provide the hook_update_n.

About the tests, I don't exactly see the link between the errors and the patch.

jeqq’s picture

@Grimreaper These errors are not related to your patch. We test CouchDB integration with Travis CI (see tests classes in tests/src/Integration/ folder, we run them in tests/bin/replication.sh): https://travis-ci.org/relaxedws/drupal-relaxed.

Grimreaper’s picture

Assigned: Unassigned » Grimreaper

@jeqq: ok thanks for the answer.

I will not have time for a patch this week sorry.

I will try when I will get time.

Grimreaper’s picture

Assigned: Grimreaper » Unassigned
FileSize
6.23 KB

Hello,

Here is a new patch with an attempt of hook_update_n.

It is inspired of system_update_8007(), unfortunately it does not work, I have the following error:

deploy:/project/www# drush updb --entity-updates
The following updates are pending:

replication_log entity type : 
  The Replication log history field needs to be updated.
replication module : 
  8100 -   Update ReplicationHistoryItem property definitions.   For compatibility with CouchDB 2.0.0. 

Do you wish to run all pending updates? (y/n): y
The SQL storage cannot change the schema for an existing field (history in replication_log entity) with data.                              [error]
Performing replication_update_8100                                                                                                         [ok]
Drupal\Core\Entity\Exception\FieldStorageDefinitionUpdateForbiddenException: The SQL storage cannot change the schema for an existing field[error]
(history in replication_log entity) with data. in Drupal\Core\Entity\Sql\SqlContentEntityStorageSchema->updateDedicatedTableSchema() (line
1285 of /project/www/core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorageSchema.php).
Failed: The SQL storage cannot change the schema for an existing field (history in replication_log entity) with data.                      [error]
Failed: Drupal\Core\Entity\Exception\FieldStorageDefinitionUpdateForbiddenException: !message in                                           [error]
Drupal\Core\Entity\Sql\SqlContentEntityStorageSchema->updateDedicatedTableSchema() (line 1285 of
/project/www/core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorageSchema.php).
Cache rebuild complete.                                                                                                                    [ok]
Finished performing updates.                                                                                                               [ok]

I found examples in core or in the paragraph module how to update base field definitions on content entities but not how to update property definitions on field types.

I also found that I forgot to change the schema for the properties.

Thanks for the review or any help.

jeqq’s picture

Status: Needs work » Needs review
FileSize
8.8 KB

Here is a patch based on #8, it fixes the problem with the existing data error (it migrates data to the modified tables). Other fixes. After applying the update I was able to replicate data between Drupal and CouchDB 2.

jeqq’s picture

Refactored the update function.

  • jeqq committed 4cc40dc on 8.x-1.x authored by Grimreaper
    Issue #2832467 by Grimreaper, jeqq: Not compatible with couchdb 2.0.0
    
jeqq’s picture

Status: Needs review » Fixed
Grimreaper’s picture

Thanks @jeqq for the commit. Sorry for not answering before.

damiankloip’s picture

I second that - thanks @jeqq!!

Status: Fixed » Closed (fixed)

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