On this Gerrit change, @Michael reported that running
php maintenance/run.php WikibaseQualityConstraints:ImportConstraintEntities.php
fails on a Wikibase with default settings, with an EntityContentTooBigException: On Wikidata, the maxSerializedEntitySize is 3000 (kibibytes), but by default it’s $wgMaxArticleSize, which in turn is only 2048 kiB. The serialized entity size is also checked during deserialization, so while ImportConstraintEntities removes statements, they can still cause the error:
$wikidataEntityArray = json_decode( $wikidataEntitiesJson, true )['entities'][$wikidataEntityId]; $wikidataEntity = $this->entityDeserializer->deserialize( $wikidataEntityArray ); // <-- EntityContentTooBigException thrown here $wikidataEntity->setId( null ); if ( $wikidataEntity instanceof StatementListProvider ) { $wikidataEntity->getStatements()->clear(); } // entity would *now* be small enough to fit in the local wiki (probably)
TODO: Check which entity is causing the error, and if it’s still too large without the statements. If not, then a relatively simple solution would be to unset( $wikidataEntityArray['claims'] ) before deserializing the entity.