Skip to content

Commit

Permalink
Fix for bulk insert issue in gcp native
Browse files Browse the repository at this point in the history
Signed-off-by: "gifi-siby" <[email protected]>
  • Loading branch information
gifi-siby committed Jan 16, 2025
1 parent 75d7978 commit 8644c8f
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 13 deletions.
11 changes: 7 additions & 4 deletions internal/storage/gcp_native_object_storage.go
Original file line number Diff line number Diff line change
Expand Up @@ -170,10 +170,13 @@ func (gcs *GcpNativeObjectStorage) WalkWithObjects(ctx context.Context,
return checkObjectStorageError(prefix, err)
}
if objAttrs.Prefix != "" {
continue
}
if !walkFunc(&ChunkObjectInfo{FilePath: objAttrs.Name, ModifyTime: objAttrs.Updated}) {
return nil
if !walkFunc(&ChunkObjectInfo{FilePath: objAttrs.Prefix, ModifyTime: objAttrs.Updated}) {
return nil
}
} else if objAttrs.Name != "" {
if !walkFunc(&ChunkObjectInfo{FilePath: objAttrs.Name, ModifyTime: objAttrs.Updated}) {
return nil
}
}
}
return nil
Expand Down
15 changes: 6 additions & 9 deletions internal/storage/gcp_native_object_storage_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -147,14 +147,11 @@ func TestGcpNativeObjectStorage(t *testing.T) {
value []byte
}{
{false, "abc/", []byte("123")},
{true, "abc/d/", []byte("1234")},
{false, "abc/d/e", []byte("12345")},
{true, "abc/d", []byte("1234")},
{true, "abc/e/d", []byte("12354")},
{true, "key_/1/1", []byte("111")},
{true, "key_/1/2/", []byte("222")},
{false, "key_/1/2/3", []byte("333")},
{true, "key_/1/2", []byte("222")},
{true, "key_/2/3", []byte("333")},
{true, "key_/test.txt", []byte("333")},
}

for _, test := range prepareTests {
Expand All @@ -172,10 +169,10 @@ func TestGcpNativeObjectStorage(t *testing.T) {
prefix string
expectedValue []string
}{
{true, "abc/", []string{"abc/e/d"}},
{true, "key_/", []string{"key_/1/1", "key_/2/3", "key_/test.txt"}},
{false, "abc/", []string{}},
{false, "key_/", []string{"key_/test.txt"}},
{true, "abc/", []string{"abc/d", "abc/e/d"}},
{true, "key_/", []string{"key_/1/1", "key_/1/2", "key_/2/3"}},
{false, "abc/", []string{"abc/d", "abc/e/"}},
{false, "key_/", []string{"key_/1/", "key_/2/"}},
}

for _, test := range insertWithPrefixTests {
Expand Down

0 comments on commit 8644c8f

Please sign in to comment.