Skip to content

Commit 5f9668f

Browse files
committed
MC-34522: Two near-simultaneous product imports interfere with each other
- Change default value of user_id column to NULL for backward compatibility
1 parent 4c8d30a commit 5f9668f

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

app/code/Magento/ImportExport/Model/ResourceModel/Import/Data.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,8 @@ public function saveBunch($entity, $behavior, array $data)
200200
*/
201201
private function prepareSelect(Select $select): Select
202202
{
203-
$select->where('user_id=?', $this->getCurrentUserId() ?? self::DEFAULT_USER_ID);
203+
// user_id is NULL part is for backward compatibility
204+
$select->where('user_id=? OR user_id is NULL', $this->getCurrentUserId() ?? self::DEFAULT_USER_ID);
204205

205206
return $select;
206207
}
@@ -226,7 +227,8 @@ private function prepareInsert(array $data): array
226227
*/
227228
private function prepareDelete(array $where): array
228229
{
229-
$where['user_id=?'] = $this->getCurrentUserId() ?? self::DEFAULT_USER_ID;
230+
// user_id is NULL part is for backward compatibility
231+
$where['user_id=? OR user_id is NULL'] = $this->getCurrentUserId() ?? self::DEFAULT_USER_ID;
230232

231233
return $where;
232234
}

app/code/Magento/ImportExport/etc/db_schema.xml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,7 @@
1212
<column xsi:type="varchar" name="entity" nullable="false" length="50" comment="Entity"/>
1313
<column xsi:type="varchar" name="behavior" nullable="false" length="10" default="append" comment="Behavior"/>
1414
<column xsi:type="longtext" name="data" nullable="true" comment="Data"/>
15-
<column xsi:type="int" name="user_id" unsigned="true" nullable="false" identity="false" default="0"
16-
comment="User ID"/>
15+
<column xsi:type="int" name="user_id" unsigned="true" nullable="true" identity="false" comment="User ID"/>
1716
<constraint xsi:type="primary" referenceId="PRIMARY">
1817
<column name="id"/>
1918
</constraint>

0 commit comments

Comments
 (0)