Skip to content
Closed
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
7 changes: 2 additions & 5 deletions pkg/authentication/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -166,12 +166,9 @@ func (s *APIService) OauthCallback(w http.ResponseWriter, r *http.Request, _ ses
// context on every client request.
func addRequestID(headerName string) apiclient.RequestEditorFn {
return func(ctx context.Context, req *http.Request) error {
reqIDField := ctx.Value(httputil.RequestIDContextKey)
if reqIDField == nil {
return nil
if reqID, ok := ctx.Value(httputil.RequestIDContextKey).(string); ok {
req.Header.Add(headerName, reqID)
}
reqID := reqIDField.(string)
req.Header.Add(headerName, reqID)
return nil
}
}
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,
}, 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
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@
// Wait a bit for the button to be stable after hover
await this.page.waitForTimeout(500);

await firstRow.locator('button').last().click();

Check failure on line 60 in webui/test/e2e/poms/repositoryPage.ts

View workflow job for this annotation

GitHub Actions / E2E - DynamoDB Local - Local Block Adapter

[common] › test/e2e/common/revertCommit.spec.ts:98:9 › Revert Commit › revert multiple commits

1) [common] › test/e2e/common/revertCommit.spec.ts:98:9 › Revert Commit › revert multiple commits Error: locator.click: Test timeout of 30000ms exceeded. Call log: - waiting for locator('table tbody tr').first().locator('button').last() - locator resolved to <button type="button" aria-expanded="false" id="react-aria7239864380-:r33:" class="row-hover dropdown-toggle btn btn-light btn-sm">…</button> - attempting click action 2 × waiting for element to be visible, enabled and stable - element is not visible - retrying click action - waiting 20ms 2 × waiting for element to be visible, enabled and stable - element is not visible - retrying click action - waiting 100ms 49 × waiting for element to be visible, enabled and stable - element is not visible - retrying click action - waiting 500ms at e2e/poms/repositoryPage.ts:60 58 | await this.page.waitForTimeout(500); 59 | > 60 | await firstRow.locator('button').last().click(); | ^ 61 | await this.page.getByRole('button', { name: 'Delete' }).click(); 62 | await this.page.getByRole("button", { name: "Yes" }).click(); 63 | } at RepositoryPage.deleteFirstObjectInDirectory (/home/runner/work/lakeFS/lakeFS/webui/test/e2e/poms/repositoryPage.ts:60:45) at /home/runner/work/lakeFS/lakeFS/webui/test/e2e/common/revertCommit.spec.ts:113:9
await this.page.getByRole('button', { name: 'Delete' }).click();
await this.page.getByRole("button", { name: "Yes" }).click();
}
Expand Down Expand Up @@ -134,7 +134,7 @@
}

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