Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix SeekGE in DDB #6561

Merged
merged 9 commits into from
Sep 10, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 3 additions & 2 deletions pkg/gateway/testutil/gateway_setup.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ import (
"github.com/treeverse/lakefs/pkg/config"
"github.com/treeverse/lakefs/pkg/gateway"
"github.com/treeverse/lakefs/pkg/gateway/multipart"
"github.com/treeverse/lakefs/pkg/kv"
"github.com/treeverse/lakefs/pkg/kv/kvparams"
"github.com/treeverse/lakefs/pkg/kv/kvtest"
_ "github.com/treeverse/lakefs/pkg/kv/mem"
"github.com/treeverse/lakefs/pkg/logging"
"github.com/treeverse/lakefs/pkg/stats"
Expand All @@ -34,7 +34,8 @@ func GetBasicHandler(t *testing.T, authService *FakeAuthService, repoName string
ctx := context.Background()
viper.Set(config.BlockstoreTypeKey, block.BlockstoreTypeMem)

store := kvtest.MakeStoreByName("mem", kvparams.Config{})(t, ctx)
store, err := kv.Open(ctx, kvparams.Config{Type: "mem"})
testutil.MustDo(t, "open kv store", err)
defer store.Close()
multipartTracker := multipart.NewTracker(store)

Expand Down
18 changes: 18 additions & 0 deletions pkg/kv/cosmosdb/main_test.go
Original file line number Diff line number Diff line change
@@ -1,14 +1,32 @@
package cosmosdb_test

import (
"context"
"os"
"testing"

"github.com/treeverse/lakefs/pkg/kv"
"github.com/treeverse/lakefs/pkg/kv/cosmosdb"
"github.com/treeverse/lakefs/pkg/kv/kvparams"
"github.com/treeverse/lakefs/pkg/kv/kvtest"
)

var testParams *kvparams.CosmosDB

func TestCosmosDB(t *testing.T) {
t.Skip("CosmosDB tests are flaky due to the emulator. If you plan on running those, make sure to assign at least 3CPUs and" +
" 4GB of memory to the container running the emulator.")
kvtest.DriverTest(t, func(t testing.TB, ctx context.Context) kv.Store {
t.Helper()
store, err := kv.Open(ctx, kvparams.Config{CosmosDB: testParams, Type: cosmosdb.DriverName})
if err != nil {
t.Fatalf("failed to open kv '%s' store: %s", cosmosdb.DriverName, err)
}
t.Cleanup(store.Close)
return store
})
}

func TestMain(m *testing.M) {
code := m.Run()
os.Exit(code)
Expand Down
15 changes: 0 additions & 15 deletions pkg/kv/cosmosdb/store_test.go

This file was deleted.

15 changes: 4 additions & 11 deletions pkg/kv/dynamodb/main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,22 +10,15 @@ import (
)

var testParams *kvparams.DynamoDB
var databaseURI string

func TestMain(m *testing.M) {
databaseURI, cleanupFunc, err := testutil.GetDynamoDBInstance()
var err error
var cleanupFunc func()
databaseURI, cleanupFunc, err = testutil.GetDynamoDBInstance()
if err != nil {
log.Fatalf("Could not connect to Docker: %s", err)
}

testParams = &kvparams.DynamoDB{
TableName: testutil.UniqueKVTableName(),
ScanLimit: 10,
Endpoint: databaseURI,
AwsRegion: "us-east-1",
AwsAccessKeyID: "fakeMyKeyId",
AwsSecretAccessKey: "fakeSecretAccessKey",
}

code := m.Run()
cleanupFunc()
os.Exit(code)
Expand Down
1 change: 1 addition & 0 deletions pkg/kv/dynamodb/store.go
Original file line number Diff line number Diff line change
Expand Up @@ -380,6 +380,7 @@ func (s *Store) DropTable() error {
func (e *EntriesIterator) SeekGE(key []byte) {
if !e.isInRange(key) {
e.startKey = key
e.exclusiveStartKey = nil
e.runQuery()
return
}
Expand Down
24 changes: 22 additions & 2 deletions pkg/kv/dynamodb/store_test.go
Original file line number Diff line number Diff line change
@@ -1,13 +1,33 @@
package dynamodb_test

import (
"context"
"github.com/treeverse/lakefs/pkg/kv"
"github.com/treeverse/lakefs/pkg/kv/dynamodb"
"github.com/treeverse/lakefs/pkg/testutil"
"testing"

"github.com/treeverse/lakefs/pkg/kv/dynamodb"
"github.com/treeverse/lakefs/pkg/kv/kvparams"
"github.com/treeverse/lakefs/pkg/kv/kvtest"
)

func TestDynamoKV(t *testing.T) {
kvtest.DriverTest(t, dynamodb.DriverName, kvparams.Config{DynamoDB: testParams})
kvtest.DriverTest(t, func(t testing.TB, ctx context.Context) kv.Store {
t.Helper()
testParams = &kvparams.DynamoDB{
TableName: testutil.UniqueKVTableName(),
ScanLimit: kvtest.MaxPageSize,
Endpoint: databaseURI,
AwsRegion: "us-east-1",
AwsAccessKeyID: "fakeMyKeyId",
AwsSecretAccessKey: "fakeSecretAccessKey",
}

store, err := kv.Open(ctx, kvparams.Config{DynamoDB: testParams, Type: dynamodb.DriverName})
if err != nil {
t.Fatalf("failed to open kv '%s' store: %s", dynamodb.DriverName, err)
}
t.Cleanup(store.Close)
return store
})
}