Skip to content
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 10 additions & 6 deletions cmd/lakefs/cmd/run.go
Original file line number Diff line number Diff line change
Expand Up @@ -139,12 +139,6 @@ var runCmd = &cobra.Command{
logger.WithError(err).Fatal("failed to create login token provider")
}

blockstoreType := baseCfg.Blockstore.Type
if blockstoreType == "mem" {
printLocalWarning(os.Stderr, fmt.Sprintf("blockstore type %s", blockstoreType))
logger.WithField("adapter_type", blockstoreType).Warn("Block adapter NOT SUPPORTED for production use")
}

metadata := initStatsMetadata(ctx, logger, authMetadataManager, cfg)
bufferedCollector := stats.NewBufferedCollector(metadata.InstallationID, stats.Config(baseCfg.Stats),
stats.WithLogger(logger.WithField("service", "stats_collector")))
Expand All @@ -155,6 +149,16 @@ var runCmd = &cobra.Command{
logger.WithError(err).Fatal("Failed to create block adapter")
}

blockstoreMetadata, err := blockStore.BlockstoreMetadata(ctx)
if err != nil {
logger.WithError(err).Fatal("Failed to get block adapter metadata")
}
if !blockstoreMetadata.IsProductionSafe {
blockstoreType := blockStore.BlockstoreType()
printLocalWarning(os.Stderr, fmt.Sprintf("blockstore type %s", blockstoreType))
logger.WithField("adapter_type", blockstoreType).Warn("Block adapter NOT SUPPORTED for production use")
}

bufferedCollector.SetRuntimeCollector(blockStore.RuntimeStats)
// send metadata
bufferedCollector.CollectMetadata(metadata)
Expand Down
3 changes: 2 additions & 1 deletion pkg/block/adapter.go
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,8 @@ type Properties struct {
}

type BlockstoreMetadata struct {
Region *string
IsProductionSafe bool
Region *string
}

type PutResponse struct {
Expand Down
4 changes: 3 additions & 1 deletion pkg/block/azure/adapter.go
Original file line number Diff line number Diff line change
Expand Up @@ -616,7 +616,9 @@ func (a *Adapter) BlockstoreType() string {
}

func (a *Adapter) BlockstoreMetadata(_ context.Context) (*block.BlockstoreMetadata, error) {
return nil, block.ErrOperationNotSupported
return &block.BlockstoreMetadata{
IsProductionSafe: true,
}, nil
}

func (a *Adapter) CompleteMultiPartUpload(ctx context.Context, obj block.ObjectPointer, _ string, multipartList *block.MultipartUploadCompletion) (*block.CompleteMultiPartUploadResponse, error) {
Expand Down
4 changes: 3 additions & 1 deletion pkg/block/gs/adapter.go
Original file line number Diff line number Diff line change
Expand Up @@ -681,7 +681,9 @@ func (a *Adapter) BlockstoreType() string {
}

func (a *Adapter) BlockstoreMetadata(_ context.Context) (*block.BlockstoreMetadata, error) {
return nil, block.ErrOperationNotSupported
return &block.BlockstoreMetadata{
IsProductionSafe: true,
}, nil
}

func (a *Adapter) GetStorageNamespaceInfo(string) *block.StorageNamespaceInfo {
Expand Down
4 changes: 3 additions & 1 deletion pkg/block/local/adapter.go
Original file line number Diff line number Diff line change
Expand Up @@ -533,7 +533,9 @@ func (l *Adapter) BlockstoreType() string {
}

func (l *Adapter) BlockstoreMetadata(_ context.Context) (*block.BlockstoreMetadata, error) {
return nil, block.ErrOperationNotSupported
return &block.BlockstoreMetadata{
IsProductionSafe: true,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How come the local adapter is production safe?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We do have a bunch of customers using local adapter in Prod.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

😱

}, nil
}

func (l *Adapter) GetStorageNamespaceInfo(string) *block.StorageNamespaceInfo {
Expand Down
4 changes: 3 additions & 1 deletion pkg/block/mem/adapter.go
Original file line number Diff line number Diff line change
Expand Up @@ -434,7 +434,9 @@ func (a *Adapter) BlockstoreType() string {
}

func (a *Adapter) BlockstoreMetadata(_ context.Context) (*block.BlockstoreMetadata, error) {
return nil, fmt.Errorf("blockstore metadata: %w", block.ErrOperationNotSupported)
return &block.BlockstoreMetadata{
IsProductionSafe: false,
}, nil
}

func (a *Adapter) GetStorageNamespaceInfo(string) *block.StorageNamespaceInfo {
Expand Down
5 changes: 4 additions & 1 deletion pkg/block/s3/adapter.go
Original file line number Diff line number Diff line change
Expand Up @@ -895,7 +895,10 @@ func (a *Adapter) BlockstoreMetadata(ctx context.Context) (*block.BlockstoreMeta
if err != nil {
return nil, err
}
return &block.BlockstoreMetadata{Region: &region}, nil
return &block.BlockstoreMetadata{
IsProductionSafe: true,
Region: &region,
}, nil
}

func (a *Adapter) GetStorageNamespaceInfo(string) *block.StorageNamespaceInfo {
Expand Down
4 changes: 3 additions & 1 deletion pkg/block/transient/adapter.go
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,9 @@ func (a *Adapter) BlockstoreType() string {
}

func (a *Adapter) BlockstoreMetadata(_ context.Context) (*block.BlockstoreMetadata, error) {
return nil, block.ErrOperationNotSupported
return &block.BlockstoreMetadata{
IsProductionSafe: false,
}, nil
}

func (a *Adapter) GetStorageNamespaceInfo(string) *block.StorageNamespaceInfo {
Expand Down
8 changes: 4 additions & 4 deletions pkg/block/validations.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,17 @@ package block

import (
"context"
"errors"
"fmt"
)

func ValidateInterRegionStorage(ctx context.Context, adapter Adapter, storageID, storageNamespace string) error {
blockstoreMetadata, err := adapter.BlockstoreMetadata(ctx)
if errors.Is(err, ErrOperationNotSupported) {
if err != nil {
return err
}
if blockstoreMetadata.Region == nil {
// region detection not supported for the server's blockstore, skip validation
return nil
} else if err != nil {
return fmt.Errorf("failed to get blockstore region: %w", err)
}

bucketRegion, err := adapter.GetRegion(ctx, storageID, storageNamespace)
Expand Down
4 changes: 2 additions & 2 deletions pkg/block/validations_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ func TestController_ValidateInterRegionStorage(t *testing.T) {

t.Run("namespace with the same region as the storage", func(t *testing.T) {
opts := []testutil.MockAdapterOption{
testutil.WithBlockstoreMetadata(&block.BlockstoreMetadata{Region: swag.String("us-west-2")}),
testutil.WithBlockstoreMetadata(block.BlockstoreMetadata{Region: swag.String("us-west-2")}),
testutil.WithNamespaceRegion("us-west-2"),
}
adapter := testutil.NewMockAdapter(opts...)
Expand All @@ -26,7 +26,7 @@ func TestController_ValidateInterRegionStorage(t *testing.T) {

t.Run("namespace region different from storage region", func(t *testing.T) {
opts := []testutil.MockAdapterOption{
testutil.WithBlockstoreMetadata(&block.BlockstoreMetadata{Region: swag.String("us-east-1")}),
testutil.WithBlockstoreMetadata(block.BlockstoreMetadata{Region: swag.String("us-east-1")}),
testutil.WithNamespaceRegion("us-west-2"),
}
adapter := testutil.NewMockAdapter(opts...)
Expand Down
10 changes: 3 additions & 7 deletions pkg/testutil/adapter.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ type MockAdapter struct {
LastStorageNamespace string
LastStorageClass *string

blockstoreMetadata *block.BlockstoreMetadata
blockstoreMetadata block.BlockstoreMetadata
namespaceRegion *string
}

Expand All @@ -39,7 +39,7 @@ func NewMockAdapter(opts ...MockAdapterOption) *MockAdapter {
return adapter
}

func WithBlockstoreMetadata(bm *block.BlockstoreMetadata) func(a *MockAdapter) {
func WithBlockstoreMetadata(bm block.BlockstoreMetadata) func(a *MockAdapter) {
return func(a *MockAdapter) {
a.blockstoreMetadata = bm
}
Expand Down Expand Up @@ -132,11 +132,7 @@ func (a *MockAdapter) BlockstoreType() string {
}

func (a *MockAdapter) BlockstoreMetadata(_ context.Context) (*block.BlockstoreMetadata, error) {
if a.blockstoreMetadata != nil {
return a.blockstoreMetadata, nil
} else {
return nil, block.ErrOperationNotSupported
}
return &a.blockstoreMetadata, nil
}

func (a *MockAdapter) GetStorageNamespaceInfo(string) *block.StorageNamespaceInfo {
Expand Down
2 changes: 1 addition & 1 deletion webui/test/e2e/poms/repositoryPage.ts
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also here, fixing Enterprise E2E.

Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ export class RepositoryPage {
}

async uploadObject(filePath: string): Promise<void> {
await this.page.getByRole("button", { name: "Upload" }).click();
await this.page.getByRole("button", { name: "Upload", exact: true }).click();
await this.page.getByText("Drag & drop files or folders here").click();
const fileInput = await this.page.locator('input[type="file"]');
await fileInput.setInputFiles(filePath);
Expand Down
Loading