Problem/Motivation

On #2665216: Deprecate Drupal\Core\Database\Connection::nextId() and the {sequences} table and schema, We made quite a few changes to deprecate Drupal\Core\Database\Connection::nextId() and the {sequences} table and schema, but in doing that ran into a race condition issue pertaining batch processes. I think it would be smart to separate the issue into two, to keep the changes per issue relatively small.

Proposed resolution

Fix batch process race conditions by making ‘bid (batch id)’ auto-increment

User interface changes

TBD

API changes

Change the {batch} table [bid] field to serial.
Created a new getId() function (replacing deprecated function nextId())

Drush impact

Drush has an impact for this change, that is currently fixed for Drush 12 only:
https://github.com/drush-ops/drush/pull/5509

Issue fork drupal-3337513

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

gidarai created an issue. See original summary.

gidarai’s picture

Status: Active » Needs review
StatusFileSize
new5.53 KB

The patch is by @Mondrake from https://www.drupal.org/project/drupal/issues/2665216 and seems like a good patch to start working from.

catch’s picture

I am trying to work out if the ID for non-progressive batches is completely redundant, or if it's 'used' and doesn't matter what it is, or if it matters somehow.

This logic in batch_set() does seem to rely on the ID regardless of if the batch is progressive or not.

    // Add the set to the batch.
    if (empty($batch['id'])) {
      // The batch is not running yet. Simply add the new set.
      $batch['sets'][] = $batch_set;
    }
    else {
      // The set is being added while the batch is running.
      _batch_append_set($batch, $batch_set);
    }

However, the ID is completely ignored in batch_progress() for non-progressive batches, so perhaps this is fine?

But... if it's fine for non-progressive batches to not have an ID at all, then can we get rid of this from the patch?

+++ b/core/includes/form.inc
@@ -897,9 +898,29 @@ function batch_process($redirect = NULL, Url $url = NULL, $redirect_callback = N
+    }
+    else {
+      $batch['id'] = rand();
+    }
gidarai’s picture

Issue summary: View changes
daffie’s picture

Issue summary: View changes
gidarai’s picture

StatusFileSize
new5.49 KB
new330 bytes

@catch I agree, it might however be a fallback, so i made a new patch without the:

+++ b/core/includes/form.inc
@@ -897,9 +898,29 @@ function batch_process($redirect = NULL, Url $url = NULL, $redirect_callback = N
+    }
+    else {
+      $batch['id'] = rand();
+    }

to test wether it will fail or not.

smustgrave’s picture

Status: Needs review » Needs work
Issue tags: +Needs Review Queue Initiative

Failures in #6

gidarai’s picture

The builds with the latest patch from comment #6 have finished, however it looks like the fallback option will be necessary as the builds resulted in approximately 3k errors.

gidarai’s picture

Assigned: Unassigned » gidarai
Status: Needs work » Needs review
StatusFileSize
new6.01 KB
new1.07 KB

Added a new patch which contains an auto increment fix for pgsql from #838992: Change the uid field from integer to serial by leveraging NO_AUTO_VALUE_ON_ZERO on MySQL

I also re-added the following lines of code, because of the builds at comment #6 failing:

+++ b/core/includes/form.inc
@@ -897,9 +898,29 @@ function batch_process($redirect = NULL, Url $url = NULL, $redirect_callback = N
+    else {
+      $batch['id'] = rand();
+    }
mondrake’s picture

I think the failures in #6 are due to this code in form.inc

function _batch_populate_queue(&$batch, $set_id) {
  $batch_set = &$batch['sets'][$set_id];

  if (isset($batch_set['operations'])) {
    $batch_set += [
      'queue' => [
        'name' => 'drupal_batch:' . $batch['id'] . ':' . $set_id,
        'class' => $batch['progressive'] ? 'Drupal\Core\Queue\Batch' : 'Drupal\Core\Queue\BatchMemory',
      ],
    ];

i.e. the $batch['id'] is non existing at that point for non-progressive batches. Maybe 'drupal_batch:' . $batch['id'] ?? '' . ':' . $set_id, could just fix that?

gidarai’s picture

StatusFileSize
new6.37 KB
new700 bytes

Added new patch using @mondrake 's suggestion to fix errors on comment #6

alexpott’s picture

Great idea splitting this out from the other issue.

  1. +++ b/core/includes/form.inc
    @@ -897,9 +898,26 @@ function batch_process($redirect = NULL, Url $url = NULL, $redirect_callback = N
    +    if ($batch['progressive']) {
    +      try {
    +        $batch['id'] = \Drupal::service('batch.storage')->getId();
    +      }
    

    Are we concerned about the impact of not assigning an ID to non-progressive batches and whether or not code in custom or contrib might depending on this being set. Maybe it should be:
    $batch['id'] = $batch['progressive'] ? \Drupal::service('batch.storage')->getId() : '';

  2. +++ b/core/lib/Drupal/Core/Batch/BatchStorage.php
    @@ -123,10 +123,36 @@ public function cleanup() {
    +  /**
    +   * Saves a batch.
    +   *
    +   * @param array $batch
    +   *   The array representing the batch to create.
    +   */
    +  protected function doCreate(array $batch) {
    +    $this->connection->update('batch')
    +      ->fields([
    +        'token' => $this->csrfToken->get($batch['id']),
    +        'batch' => serialize($batch),
    +      ])
    +      ->condition('bid', $batch['id'])
    +      ->execute();
    +  }
    

    A function called doCreate doing a database update seems really problematic.

  3. +++ b/core/lib/Drupal/Core/Batch/BatchStorage.php
    @@ -138,23 +164,22 @@ public function create(array $batch) {
    +  protected function doGetId(): int {
    +    return $this->connection->insert('batch')
           ->fields([
    -        'bid' => $batch['id'],
             'timestamp' => REQUEST_TIME,
    -        'token' => $this->csrfToken->get($batch['id']),
    -        'batch' => serialize($batch),
    +        'token' => '',
    +        'batch' => NULL,
           ])
           ->execute();
       }
    

    And a function called doGet doing an insert is also interesting.

Status: Needs review » Needs work

The last submitted patch, 11: 3337513-11.patch, failed testing. View results

gidarai’s picture

Status: Needs work » Needs review
StatusFileSize
new6.18 KB
new2.55 KB

@Alexpott i've made the changes you suggested, but didn't really know what to rename the "doGetId" function to. I noticed that the function is used as a sub-function in "getId", but it does indeed do an insert. What do you suggest the new function name to be?

public function getId(): int {
    $try_again = FALSE;
    try {
      // The batch table might not yet exist.
      return $this->doGetId();
    }
    catch (\Exception $e) {
      // If there was an exception, try to create the table.
      if (!$try_again = $this->ensureTableExists()) {
        // If the exception happened for other reason than the missing table,
        // propagate the exception.
        throw $e;
      }
    }
    // Now that the table has been created, try again if necessary.
    if ($try_again) {
      return $this->doGetId();
    }
  }
mondrake’s picture

Maybe

doGetId() => doInsert()
doCreate() => doUpdate()

so the do*() reflect the actual database operations?

mondrake’s picture

Status: Needs review » Needs work

The following PHPStan baseline entry should be adjusted to count: 1

		-
			message: "#^Call to deprecated constant REQUEST_TIME\\: Deprecated in drupal\\:8\\.3\\.0 and is removed from drupal\\:11\\.0\\.0\\. Use \\\\Drupal\\:\\:time\\(\\)\\-\\>getRequestTime\\(\\); $#"
			count: 2
			path: lib/Drupal/Core/Batch/BatchStorage.php

gidarai’s picture

StatusFileSize
new6.66 KB
new412 bytes

Changed PHPStan baseline entry to count 1

daffie’s picture

Maybe

doGetId() => doInsert()
doCreate() => doUpdate()

so the do*() reflect the actual database operations?

It is a solution we can take. For me the methods doCreate() and doGetId() are 2 helper methods and their name should reflect that. I do get the point that we would create a doCreate() method that does an update query. Naming things is not always easy in IT.

mondrake’s picture

Naming things is not always easy in IT.

https://dev.to/thinkster/the-hardest-thing-in-programming-384g

😊

mondrake’s picture

Assigned: gidarai » mondrake

@gidarai I will roll the next patch ok?

gidarai’s picture

@Mondrake Of course, go for it!

daffie’s picture

We need a test for the function system_update_10101().

mondrake’s picture

Status: Needs work » Needs review

Sure we need a test there. Can I get a review before getting into that?

mondrake’s picture

Assigned: mondrake » Unassigned

Added the update path test.

smustgrave’s picture

Status: Needs review » Reviewed & tested by the community

Upgrade status looks good. As an assertion before the run, in this case try/catch which was a great solution btw.

mondrake’s picture

Assigned: Unassigned » mondrake
Status: Reviewed & tested by the community » Needs work

Thanks - the PGSQL failure is real though, NW to get it sorted. On it.

mondrake’s picture

Title: Fix batch process race conditions by making ‘bid (batch id)’ auto-increment » [PP-1] Fix batch process race conditions by making ‘bid (batch id)’ auto-increment
Assigned: mondrake » Unassigned
Status: Needs work » Postponed
Related issues: +#3028706: New serial columns do not own sequences

The PgSql failure will be fixed by #3028706: New serial columns do not own sequences, so better wait on that one.

mondrake’s picture

Title: [PP-1] Fix batch process race conditions by making ‘bid (batch id)’ auto-increment » Fix batch process race conditions by making ‘bid (batch id)’ auto-increment
Status: Postponed » Needs work

I was wrong in #28, #3028706: New serial columns do not own sequences is not fixing the pgsql issue, we still need to understand why after the update inserting to the table we got all the lastIDs to 0.

daffie’s picture

For the change to the users table with added something special for PostgreSQL databases. Maybe we should do the same here.

  // The new PostgreSQL sequence for the uid field needs to start with the last
  // used user ID + 1 and the sequence must be owned by uid field.
  // @todo https://drupal.org/i/3028706 implement a generic fix.
  if ($connection->driver() == 'pgsql') {
    $maximum_uid = $connection->query('SELECT MAX([uid]) FROM {users}')->fetchField();
    $seq = $connection->makeSequenceName('users', 'uid');
    $connection->query("ALTER SEQUENCE " . $seq . " RESTART WITH " . ($maximum_uid + 1) . " OWNED BY {users}.uid");
  }

From : https://git.drupalcode.org/project/drupal/-/blob/9.4.8/core/modules/user...

mondrake’s picture

Assigned: Unassigned » mondrake

Thanks @daffie.

No I actually found out the problem to be a trickier one - in the update path test the call to changeField() is done by the SUT, and the test database connection then gets bogged, its lastId() method does not understand that the field is now a serial so it keeps returning 0. Must be some static caching somewhere.

#30 will be solved by #3028706: New serial columns do not own sequences in a consistent way, and it's not strictly necessary here (although I'd say it'd better to get that in before this).

Working on an update to the MR.

mondrake’s picture

Status: Needs work » Needs review

Let's see the level of bot happiness now.

mondrake’s picture

Assigned: mondrake » Unassigned
daffie’s picture

Status: Needs review » Needs work

The MR looks good.

I create a couple of remarks on the MR.

mondrake’s picture

Status: Needs work » Needs review
daffie’s picture

Status: Needs review » Needs work
Issue tags: +Needs change record updates

All my points have been addressed.
Testing has been added.
The MR is for me RTBC.
The CR needs to be updated. We are not using the keyvalue store as a replacement.

VladimirAus made their first commit to this issue’s fork.

mondrake’s picture

Status: Needs work » Needs review
Issue tags: -Needs change record updates

Updated CR. Now we probably will need another one for #2665216: Deprecate Drupal\Core\Database\Connection::nextId() and the {sequences} table and schema, but one step at a time.

daffie’s picture

Status: Needs review » Reviewed & tested by the community

All my points have been addressed.
Testing has been added.
The IS and the CR are in order.
For me it is RTBC.

The MR from @mondrake is the one to merge.

mondrake’s picture

rebased

quietone’s picture

Status: Reviewed & tested by the community » Needs work
Issue tags: +Needs change record updates

I was reading the change record and I don't understand why it discusses a postponed issue. Oh, I see this is one change record for two issues. That is not a good idea because the two issue may get committed to different versions.

The CR should also be in clear English, see Technical writing (English) and Write a change record for a Drupal core issue.

I am tagging this for change record updates.

daffie’s picture

Status: Needs work » Reviewed & tested by the community
Issue tags: -Needs change record updates

I have updated the CR.
Back to RTBC.

catch’s picture

Status: Reviewed & tested by the community » Fixed

I checked the change record. I think it's fine for it to reference the postponed issue - we explicitly split this issue out of that one, but they're closely related and it's useful context.

Committed/pushed to 10.1.x, thanks!

I had to regenerate the phpstan baseline on commit

  • catch committed 779785e2 on 10.1.x
    Issue #3337513 by mondrake, gidarai, daffie, alexpott, catch: Fix batch...
catch’s picture

smustgrave’s picture

FYI I've been having issues with running updates on 10.1

>  [error]  TypeError: ArrayObject::__construct(): Argument #1 ($array) must be of type array, bool given in ArrayObject->__construct() (line 15 of /var/www/html/vendor/consolidation/output-formatters/src/StructuredData/AbstractListData.php) #0 /var/www/html/vendor/consolidation/output-formatters/src/StructuredData/AbstractListData.php(15): ArrayObject->__construct(false)
> #1 /var/www/html/vendor/consolidation/output-formatters/src/StructuredData/UnstructuredListData.php(21): Consolidation\OutputFormatters\StructuredData\AbstractListData->__construct(false)
> #2 /var/www/html/vendor/drush/drush/src/Commands/core/UpdateDBCommands.php(132): Consolidation\OutputFormatters\StructuredData\UnstructuredListData->__construct(false)
> #3 [internal function]: Drush\Commands\core\UpdateDBCommands->process('3', Array)
> #4 /var/www/html/vendor/consolidation/annotated-command/src/CommandProcessor.php(257): call_user_func_array(Array, Array)
> #5 /var/www/html/vendor/consolidation/annotated-command/src/CommandProcessor.php(212): Consolidation\AnnotatedCommand\CommandProcessor->runCommandCallback(Array, Object(Consolidation\AnnotatedCommand\CommandData))
> #6 /var/www/html/vendor/consolidation/annotated-command/src/CommandProcessor.php(176): Consolidation\AnnotatedCommand\CommandProcessor->validateRunAndAlter(Array, Array, Object(Consolidation\AnnotatedCommand\CommandData))
> #7 /var/www/html/vendor/consolidation/annotated-command/src/AnnotatedCommand.php(390): Consolidation\AnnotatedCommand\CommandProcessor->process(Object(Symfony\Component\Console\Output\ConsoleOutput), Array, Array, Object(Consolidation\AnnotatedCommand\CommandData))
> #8 /var/www/html/web/vendor/symfony/console/Command/Command.php(312): Consolidation\AnnotatedCommand\AnnotatedCommand->execute(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
> #9 /var/www/html/web/vendor/symfony/console/Application.php(1040): Symfony\Component\Console\Command\Command->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
> #10 /var/www/html/web/vendor/symfony/console/Application.php(314): Symfony\Component\Console\Application->doRunCommand(Object(Consolidation\AnnotatedCommand\AnnotatedCommand), Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
> #11 /var/www/html/web/vendor/symfony/console/Application.php(168): Symfony\Component\Console\Application->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
> #12 /var/www/html/vendor/drush/drush/src/Runtime/Runtime.php(124): Symfony\Component\Console\Application->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
> #13 /var/www/html/vendor/drush/drush/src/Runtime/Runtime.php(51): Drush\Runtime\Runtime->doRun(Array, Object(Symfony\Component\Console\Output\ConsoleOutput))
> #14 /var/www/html/vendor/drush/drush/drush.php(77): Drush\Runtime\Runtime->run(Array)
> #15 /var/www/html/vendor/drush/drush/drush(4): require('/var/www/html/v...')
> #16 /var/www/html/vendor/bin/drush(120): include('/var/www/html/v...')
> #17 {main}. 
> TypeError: ArrayObject::__construct(): Argument #1 ($array) must be of type array, bool given in /var/www/html/vendor/consolidation/output-formatters/src/StructuredData/AbstractListData.php on line 15 #0 /var/www/html/vendor/consolidation/output-formatters/src/StructuredData/AbstractListData.php(15): ArrayObject->__construct(false)
> #1 /var/www/html/vendor/consolidation/output-formatters/src/StructuredData/UnstructuredListData.php(21): Consolidation\OutputFormatters\StructuredData\AbstractListData->__construct(false)
> #2 /var/www/html/vendor/drush/drush/src/Commands/core/UpdateDBCommands.php(132): Consolidation\OutputFormatters\StructuredData\UnstructuredListData->__construct(false)
> #3 [internal function]: Drush\Commands\core\UpdateDBCommands->process('3', Array)
> #4 /var/www/html/vendor/consolidation/annotated-command/src/CommandProcessor.php(257): call_user_func_array(Array, Array)
> #5 /var/www/html/vendor/consolidation/annotated-command/src/CommandProcessor.php(212): Consolidation\AnnotatedCommand\CommandProcessor->runCommandCallback(Array, Object(Consolidation\AnnotatedCommand\CommandData))
> #6 /var/www/html/vendor/consolidation/annotated-command/src/CommandProcessor.php(176): Consolidation\AnnotatedCommand\CommandProcessor->validateRunAndAlter(Array, Array, Object(Consolidation\AnnotatedCommand\CommandData))
> #7 /var/www/html/vendor/consolidation/annotated-command/src/AnnotatedCommand.php(390): Consolidation\AnnotatedCommand\CommandProcessor->process(Object(Symfony\Component\Console\Output\ConsoleOutput), Array, Array, Object(Consolidation\AnnotatedCommand\CommandData))
> #8 /var/www/html/web/vendor/symfony/console/Command/Command.php(312): Consolidation\AnnotatedCommand\AnnotatedCommand->execute(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
> #9 /var/www/html/web/vendor/symfony/console/Application.php(1040): Symfony\Component\Console\Command\Command->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
> #10 /var/www/html/web/vendor/symfony/console/Application.php(314): Symfony\Component\Console\Application->doRunCommand(Object(Consolidation\AnnotatedCommand\AnnotatedCommand), Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
> #11 /var/www/html/web/vendor/symfony/console/Application.php(168): Symfony\Component\Console\Application->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
> #12 /var/www/html/vendor/drush/drush/src/Runtime/Runtime.php(124): Symfony\Component\Console\Application->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
> #13 /var/www/html/vendor/drush/drush/src/Runtime/Runtime.php(51): Drush\Runtime\Runtime->doRun(Array, Object(Symfony\Component\Console\Output\ConsoleOutput))
> #14 /var/www/html/vendor/drush/drush/drush.php(77): Drush\Runtime\Runtime->run(Array)
> #15 /var/www/html/vendor/drush/drush/drush(4): require('/var/www/html/v...')
> #16 /var/www/html/vendor/bin/drush(120): include('/var/www/html/v...')
> #17 {main}
>  [warning] Drush command terminated abnormally.

In ProcessBase.php line 171:
                                                                                                                                                                                                                                       
  Unable to decode output into JSON: Syntax error                                                                                                                                                                                      
                                                                                                                                                                                                                                       
  TypeError: ArrayObject::__construct(): Argument #1 ($array) must be of type array, bool given in ArrayObject->__construct() (line 15 of /var/www/html/vendor/consolidation/output-formatters/src/StructuredData/AbstractListData.ph  
  p).                                                   

Reversing this patch I was able to run the updates.

catch’s picture

Status: Fixed » Needs work

Re-opening this but not rolling back just yet since it's only in 10.1

I think we need to open a ticket against drush, and depending what happens there, maybe it's an easy fix in drush, or if not we might need to roll back until the drush ticket is ready.

andypost’s picture

Filed issue for drush as it needs BC too https://github.com/drush-ops/drush/issues/5494

smustgrave’s picture

So reverted the changes in core/lib/Drupal/Core/Batch/BatchStorage.php and things appear to be working again.

rkoller’s picture

I also ran into the issue but with a different error. @catch asked me to post the output in here as well.

i am able to reproduce the error consistently. i set up a new install of 10.1.x-dev on ddev with php 8.2 and mariadb 10.5. after that i apply the patch from #2492171-386: Provide options to sanitize filenames (transliterate, lowercase, replace whitespace, etc). after that `drush updatedb`is executed as shown in the gist (created one since the output is too long for the issue here):

https://gist.github.com/rpkoller/ec980e0bd95d071102bf006a7a19f6d3

  • catch committed 8726c00a on 10.1.x
    Revert "Issue #3337513 by mondrake, gidarai, daffie, alexpott, catch:...
catch’s picture

Since this can be reproduced consistently by @rkoller, I've gone ahead and reverted this. Batch has logic for ::ensureTableExists() etc., but either the patch is breaking that, or it's leading to a situation where existing breakage is being exposed.

rkoller’s picture

per @catch's suggestion i've tested the following now:

1. install 10.1.x-dev
2. went to /admin/modules/update and clicked check manually
3. then went into phpmyadmin and checked if the batch table was in place and it was
4. applied the patch from #2492171-368: Provide options to sanitize filenames (transliterate, lowercase, replace whitespace, etc)
5. went to update.php and ran the update => it ran through without any errors

i did an extra test while writing up this comment

1. install 10.1.x-dev
2. go into phpadmin -> the batch table is missing

andypost’s picture

It means insert into batch skipping ensureTable

mondrake’s picture

Status: Needs work » Needs review

No drush expert - but if I understand correctly batches in drush are run via it's own batch.inc code, i.e. code in Drupal's form.inc is not executed when the update runs via drush. That would explain why the table doesn't exist - in the new code that is ensured in BatchStorage::getid() which drush doesn't execute.

IMHO it would be easier to fix drush if this were in.

EDIT: commented upstream too https://github.com/drush-ops/drush/issues/5494#issuecomment-1484207843

catch’s picture

I don't think this is a drush problem, or not exclusively - if you do a clean install, add an update (via a patch that adds one or manually), then go straight to update.php before executing any other batches, you'll hit this.

mondrake’s picture

ah right - quite an edge case though. We can fix here but the drush problem will remain, more likely to happen when drush is used in test scripts.

mondrake’s picture

second thinking: if we install anew a code base with this issue included, getId() should be ensuring the table, no? so what’s failing?

andypost’s picture

even to start update drush will need to get batch::ID using old method and probably will fail after running update

mondrake’s picture

For me the drush fix is quite clear, I will try to post a PR on github. To test it, though, it would be better to have this in Drupal core. What's still unclear to me is how comes you can end up with a new install (10.1.x including the patch here), call update.php and fail because the table is missing.

mondrake’s picture

mondrake’s picture

Status: Needs review » Reviewed & tested by the community

https://github.com/drush-ops/drush/pull/5509 downstream is making progress, but testing it without the change here in the codebase would be somehow missing sense.

Can I suggest to get this back into core, so we can test drush and address the edge case of #58 separately?

mondrake’s picture

andypost’s picture

Status: Reviewed & tested by the community » Needs work

At least the new auto-increment should get initial value from current `sequences` value to allow finish batches already running/created

mondrake’s picture

Status: Needs work » Reviewed & tested by the community

#66 I do not see why that would be needed. AFAICS the important thing is to get a unique ID for the new ones.

daffie’s picture

The fix for Drush has landed. See: https://github.com/drush-ops/drush/pull/5509

catch’s picture

Looks like the fix hasn't landed in drush 11 yet?

andypost’s picture

Maybe update can use "known ensureTable()" from core and fix it as well if no override applied and table exists?

mondrake’s picture

#69 no, because there's nothing to fix there at the moment while this is not committed. So we're in a catch 22 I'm afraid...

  • catch committed 75085fa4 on 11.x
    Issue #3337513 by mondrake, gidarai, VladimirAus, daffie, catch,...
catch’s picture

Version: 10.1.x-dev » 11.x-dev
Status: Reviewed & tested by the community » Fixed

OK I think the answer here is to commit this to 11.x (10.2.x) - that will give it time to percolate through drush versions and updates, and more time to flush out any remaining issues too. I fixed the deprecation version on commit.

Committed/pushed to 11.x, thanks!

mondrake’s picture

Issue summary: View changes

Added the Drush PR fix in the IS, for the record.

Status: Fixed » Closed (fixed)

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

berdir’s picture

Coming here via https://github.com/drush-ops/drush/issues/5797.

The drush PR that was merged seems incorrect and is not consistent with what core is doing.

The commit here has a specific fallback logic for the update path that does a manual INSERT query. The merge request against drush does not have that, it falls back to \Drupal::database()->nextId(); but does not actually insert the row, so drush never actually persists the batch.

I've proposed a new PR that implements the same logic as core does here.

a.dmitriiev’s picture

Just for the record, the PR from Berdir was merged to Drush 12.4.3 https://github.com/drush-ops/drush/releases/tag/12.4.3 and I can confirm that it works with Drupal 10.2.0-rc1. In my use case module on installation does batch processing. Now it works fine with Drush 12.4.3.