List the files under a path by path, not by string prefix (closes #223)
check / check (push) Waiting to run
check / check (push) Waiting to run
FileRepository.ListByPrefix matched with SQL LIKE: a plain string prefix that ignores ASCII case and treats _ and % as wildcards. Restoring /home/u/doc also restored doc2, DOC and doc.txt.bak, and a backup counted the files of a longer sibling path as deleted. It is now ListUnderPath, which returns the file at the path and every file whose path starts with the path plus a slash, compared exactly. A trailing slash is ignored, so "/" still lists every file. Three tests relied on string-prefix matching and now name a full path or call ListAll. ListIDsWithChunksNotInUploadedBlobs keeps its LIKE: it only adds file IDs the scan never looks up. Model: opus-5-5
This commit was merged in pull request #250.
This commit is contained in:
@@ -442,12 +442,12 @@ func TestLargeDatasets(t *testing.T) {
|
||||
createLargeDatasetFiles(t, repos, snapshot.ID.String(), fileCount)
|
||||
})
|
||||
|
||||
// Test ListByPrefix performance
|
||||
// Test ListUnderPath performance
|
||||
//nolint:paralleltest // phases share one database and are order-dependent
|
||||
t.Run("list by prefix performance", func(t *testing.T) {
|
||||
t.Run("list under path performance", func(t *testing.T) {
|
||||
start := time.Now()
|
||||
|
||||
files, err := repos.Files.ListByPrefix(ctx, "/large/")
|
||||
files, err := repos.Files.ListUnderPath(ctx, "/large/")
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
@@ -472,7 +472,7 @@ func TestLargeDatasets(t *testing.T) {
|
||||
t.Logf("Cleaned up orphaned files in %v", time.Since(start))
|
||||
|
||||
// Verify correct number remain
|
||||
files, err := repos.Files.ListByPrefix(ctx, "/large/")
|
||||
files, err := repos.Files.ListUnderPath(ctx, "/large/")
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user