Page MenuHomeSoftware Heritage

directory and directory_entry_dir inconsistency?
Closed, MigratedEdits Locked

Description

Guillaume has found at least one directory '0fda7ed42c34b25e009ad734b828637000fe69ee' which targets dir_entries which are not present in the directory_entry_dir table.

This generates flaky results in the swh_directory_walk and swh_directory_walk_one functions.

softwareheritage=> select * from directory dir where dir.id='\x0fda7ed42c34b25e009ad734b828637000fe69ee';
                     id                     |                     dir_entries                     |                                            file_entries                                            | rev_entries | object_id
--------------------------------------------+-----------------------------------------------------+----------------------------------------------------------------------------------------------------+-------------+------------
 \x0fda7ed42c34b25e009ad734b828637000fe69ee | {928847825,928847896,928847956,928847938,928847936} | {1342314244,1342314344,654942401,1342314411,638363058,1316525564,1316525686,1316571535,1342314386} |             | 1170016533
(1 row)


softwareheritage=> select ded.* from directory dir inner join directory_entry_dir ded on ded.id=any(dir.dir_entries) where dir.id='\x0fda7ed42c34b25e009ad734b828637000fe69ee';
    id     |                   target                   |   name   | perms
-----------+--------------------------------------------+----------+-------
 928847896 | \x896826a64d213e1276211a9c9d755f4c8561c8ef | \x737263 | 16384
(1 row)

softwareheritage=> select * from directory_entry_dir where id in (select unnest(dir_entries) from directory where id='\x0fda7ed42c34b25e009ad734b828637000fe69ee');
    id     |                   target                   |   name   | perms
-----------+--------------------------------------------+----------+-------
 928847896 | \x896826a64d213e1276211a9c9d755f4c8561c8ef | \x737263 | 16384
(1 row)

Event Timeline

That's expected while the query for T686 is running.

olasd claimed this task.

(I thought that was done but I did the array inclusion test backwards on the first pass... A second pass is running now.)