Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #216 from bareos/dev/arogge/master/fix-975
Fix #975: .bvfs_lsdirs limit offset command parameters do not work properly
- Loading branch information
Showing
8 changed files
with
115 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
# | ||
# for .bvfs_lsdir | ||
# | ||
# Retrieve special directors "." and "..". | ||
# If attributes of this paths are known, include them, | ||
# otherwise result for extra columns will be empty. | ||
# | ||
# parameter: | ||
# %s PathId | ||
# %s PathId | ||
# %s JobIds ("1,2,...") | ||
# | ||
# row 0 1 2 3 4 5 | ||
SELECT DISTINCT ON (PathId) 'D', SpecialDir.PathId, SpecialDir.Path, JobId, LStat, FileId | ||
FROM ( | ||
SELECT %s AS PathId, '.' AS Path | ||
|
||
UNION | ||
|
||
SELECT PPathId AS PathId, '..' AS Path | ||
FROM PathHierarchy | ||
WHERE PathId = %s | ||
) AS SpecialDir | ||
LEFT JOIN ( | ||
SELECT PathId, JobId, LStat, FileId | ||
FROM File | ||
WHERE File.Name = '' | ||
AND File.JobId IN (%s) | ||
ORDER BY PathId ASC, JobId DESC | ||
) AS DirAttribute | ||
ON (SpecialDir.PathId = DirAttribute.PathId) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
# for .bvfs_lsdirs | ||
# | ||
# Let's retrieve the list of the visible dirs in this dir ... | ||
# | ||
# First, the empty filename to locate efficiently | ||
# the dirs in the file table. | ||
# | ||
# Then get all the dir entries from File ... | ||
# | ||
# parameter: | ||
# %s PathId | ||
# %s JobIds ("1,2,...") | ||
# %s extra filter | ||
# %s JobIds ("1,2,...") | ||
# %s JobIds ("1,2,...") | ||
# | ||
# row 0 1 2 3 4 5 | ||
( | ||
SELECT DISTINCT ON (Path) 'D', PathId, Path, JobId, LStat, FileId | ||
FROM ( | ||
SELECT | ||
Path1.PathId AS PathId, | ||
Path1.Path AS Path, | ||
lower(Path1.Path) AS lpath, | ||
listfile1.JobId AS JobId, | ||
listfile1.LStat AS LStat, | ||
listfile1.FileId AS FileId | ||
FROM ( | ||
SELECT listpath1.PathId AS PathId | ||
FROM ( | ||
SELECT DISTINCT PathHierarchy1.PathId AS PathId | ||
FROM PathHierarchy AS PathHierarchy1 | ||
INNER JOIN Path AS Path2 | ||
ON (PathHierarchy1.PathId = Path2.PathId) | ||
INNER JOIN PathVisibility AS PathVisibility1 | ||
ON (PathHierarchy1.PathId = PathVisibility1.PathId) | ||
WHERE PathHierarchy1.PPathId = %s | ||
AND PathVisibility1.JobId IN (%s) | ||
) AS listpath1 | ||
LEFT JOIN ( | ||
SELECT PVD1.PathId AS PathId | ||
FROM ( | ||
SELECT PV1.PathId AS PathId, MAX(JobId) AS MaxJobId | ||
FROM PathVisibility AS PV1 WHERE JobId IN (%s) GROUP BY PathId | ||
) AS PVD1 | ||
INNER JOIN File AS F2 | ||
ON (F2.PathId = PVD1.PathId AND F2.JobId = PVD1.MaxJobId AND F2.FileIndex = 0 AND F2.Name = '') | ||
) AS listpath2 | ||
ON (listpath1.PathId = listpath2.PathId) | ||
WHERE listpath2.PathId IS NULL | ||
%s | ||
) AS listpath3 | ||
INNER JOIN Path AS Path1 ON (listpath3.PathId = Path1.PathId) | ||
LEFT JOIN ( | ||
SELECT File1.PathId AS PathId, File1.JobId AS JobId, File1.LStat AS LStat, File1.FileId AS FileId | ||
FROM File AS File1 | ||
WHERE File1.Name = '' | ||
AND File1.JobId IN (%s) | ||
) AS listfile1 | ||
ON (listpath3.PathId = listfile1.PathId) | ||
) AS A | ||
ORDER BY Path ASC, JobId DESC | ||
) | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters