Page MenuHomePhabricator

wb_id_counters table is being incremented even for failed property creations
Closed, DuplicatePublicBUG REPORT

Description

Hi. I am installing a custom Wikibase on my Local PC. And I have noticed that there are gaps between the property counters. For example, P1, P5, P7, ...etc

Where actually it should be serialized without any gaps: P1, P2, P3, P4...etc

Even though I did not delete any property so it could cause these gaps, I was only creating new properties.

After tracing this, I found out that the failed property creation is counted in this table.

Explanation

To create any property, there are two options:

  1. Create it through a special page (special:NewProperty).
  2. Create it through API (action=wbeditentity). And in this option, there is a chance that the user will parse a wrong JSON for example, so this will lead to failed creation of property.

If we check the counter of property in this table wb_id_counters after the failed property creation, we will notice that it has been incremented.

What should have happened instead?:
I think it should not increament the counter if the property creation failed. In my case, for example, it was very important to me to make the counter serialized without any gaps.

Also, having these gaps can give misleading info about the Wikibase installation.

Software version (skip for WMF-hosted wikis like Wikipedia):
MW 1.39
PHP 8
Ubuntu 20