Skip to content

Commit

Permalink
satellite/metainfo: drop pending objects table support
Browse files Browse the repository at this point in the history
We decided that we won't use seprate table for handling pending
objects. We need to remove related code.

After this change we still needs to remove related code from metabase.

#6421

Change-Id: Idaaa8ae08b80bab7114e316849994be171daf948
  • Loading branch information
mniewrzal committed Nov 15, 2023
1 parent 40d6706 commit d208328
Show file tree
Hide file tree
Showing 8 changed files with 66 additions and 811 deletions.
93 changes: 41 additions & 52 deletions satellite/internalpb/metainfo_sat.pb.go
Expand Up @@ -36,13 +36,10 @@ type StreamID struct {
SatelliteSignature []byte `protobuf:"bytes,9,opt,name=satellite_signature,json=satelliteSignature,proto3" json:"satellite_signature,omitempty"`
StreamId []byte `protobuf:"bytes,10,opt,name=stream_id,json=streamId,proto3" json:"stream_id,omitempty"`
Placement int32 `protobuf:"varint,13,opt,name=placement,proto3" json:"placement,omitempty"`
// temporary field to determine if we should go with new pending_objects table or
// fallback to pending object in objects table.
UsePendingObjectsTable bool `protobuf:"varint,14,opt,name=use_pending_objects_table,json=usePendingObjectsTable,proto3" json:"use_pending_objects_table,omitempty"`
Versioned bool `protobuf:"varint,15,opt,name=versioned,proto3" json:"versioned,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
Versioned bool `protobuf:"varint,15,opt,name=versioned,proto3" json:"versioned,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
}

func (m *StreamID) Reset() { *m = StreamID{} }
Expand Down Expand Up @@ -139,13 +136,6 @@ func (m *StreamID) GetPlacement() int32 {
return 0
}

func (m *StreamID) GetUsePendingObjectsTable() bool {
if m != nil {
return m.UsePendingObjectsTable
}
return false
}

func (m *StreamID) GetVersioned() bool {
if m != nil {
return m.Versioned
Expand Down Expand Up @@ -240,42 +230,41 @@ func init() {
func init() { proto.RegisterFile("metainfo_sat.proto", fileDescriptor_47c60bd892d94aaf) }

var fileDescriptor_47c60bd892d94aaf = []byte{
// 589 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x52, 0xcb, 0x6e, 0xd4, 0x30,
0x14, 0x25, 0x0c, 0x33, 0x9d, 0xf1, 0x4c, 0x3b, 0x95, 0xfb, 0x90, 0x29, 0x45, 0x13, 0x15, 0x21,
0x0d, 0x9b, 0x04, 0xb5, 0xab, 0x2e, 0xa9, 0x86, 0xc5, 0x88, 0x47, 0x4b, 0x5a, 0x36, 0x6c, 0x22,
0x27, 0xbe, 0x8d, 0xdc, 0x26, 0x76, 0x64, 0x3b, 0xa8, 0x5d, 0xf2, 0x07, 0x7c, 0x16, 0x3b, 0xf6,
0x2c, 0xca, 0xaf, 0xa0, 0x38, 0xaf, 0x91, 0x68, 0x17, 0xb0, 0xf3, 0x3d, 0xf7, 0xf8, 0xfa, 0xf8,
0xdc, 0x83, 0x70, 0x06, 0x86, 0x72, 0x71, 0x29, 0x43, 0x4d, 0x8d, 0x97, 0x2b, 0x69, 0x24, 0xc6,
0x9a, 0x1a, 0x48, 0x53, 0x6e, 0xc0, 0x6b, 0xba, 0x7b, 0x9b, 0x20, 0x62, 0x75, 0x9b, 0x1b, 0x2e,
0x45, 0xc5, 0xda, 0x43, 0x89, 0x4c, 0x64, 0x7d, 0x9e, 0x25, 0x52, 0x26, 0x29, 0xf8, 0xb6, 0x8a,
0x8a, 0x4b, 0xdf, 0xf0, 0x0c, 0xb4, 0xa1, 0x59, 0x5e, 0x13, 0x36, 0x9a, 0x41, 0x55, 0x7d, 0xf0,
0xf3, 0x09, 0x1a, 0x9e, 0x1b, 0x05, 0x34, 0x5b, 0x2e, 0xf0, 0x2e, 0x1a, 0x44, 0x45, 0x7c, 0x0d,
0x86, 0x38, 0xae, 0x33, 0x9f, 0x04, 0x75, 0x85, 0x5f, 0xa3, 0xed, 0xfa, 0x55, 0x60, 0xa1, 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 0xc3, 0x87, 0x72, 0x71, 0xf2, 0xf2, 0xcb, 0x0b, 0x6d, 0xa4, 0xba, 0xf2, 0xb8, 0xf4, 0xed,
0xc1, 0x6f, 0x49, 0x3e, 0x17, 0x06, 0x94, 0xa0, 0x69, 0x1e, 0x45, 0x03, 0xab, 0xe1, 0xe8, 0x4f,
0x00, 0x00, 0x00, 0xff, 0xff, 0x81, 0xe3, 0xf1, 0xc8, 0x7c, 0x04, 0x00, 0x00,
// 563 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x52, 0xcb, 0x6e, 0xd3, 0x40,
0x14, 0xc5, 0xa4, 0x49, 0x9d, 0x49, 0x9a, 0x44, 0xd3, 0x14, 0x8d, 0x42, 0x51, 0xac, 0x22, 0x24,
0xb3, 0xb1, 0x51, 0xbb, 0x62, 0x49, 0x14, 0x16, 0xe1, 0xd5, 0xe2, 0xc0, 0x86, 0x8d, 0x35, 0xb6,
0x6f, 0xad, 0x69, 0x6d, 0x8f, 0x35, 0x33, 0x41, 0xcd, 0x92, 0x3f, 0x60, 0xcd, 0x17, 0xf1, 0x0d,
0x2c, 0xca, 0xaf, 0x20, 0x8f, 0x5f, 0x91, 0x68, 0x17, 0xb0, 0x9b, 0x7b, 0xee, 0x99, 0x3b, 0x77,
0xce, 0x39, 0x08, 0xa7, 0xa0, 0x28, 0xcb, 0x2e, 0xb9, 0x2f, 0xa9, 0x72, 0x72, 0xc1, 0x15, 0xc7,
0x58, 0x52, 0x05, 0x49, 0xc2, 0x14, 0x38, 0x75, 0x77, 0x36, 0x81, 0x2c, 0x14, 0xdb, 0x5c, 0x31,
0x9e, 0x95, 0xac, 0x19, 0x8a, 0x79, 0xcc, 0xab, 0xf3, 0x3c, 0xe6, 0x3c, 0x4e, 0xc0, 0xd5, 0x55,
0xb0, 0xb9, 0x74, 0x15, 0x4b, 0x41, 0x2a, 0x9a, 0xe6, 0x15, 0x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87, 0xf5, 0xdd, 0x16, 0xbb, 0x23,
0x5c, 0xfb, 0xff, 0x1d, 0xae, 0x7b, 0x2c, 0x36, 0xef, 0xb3, 0x78, 0xf1, 0xec, 0xcb, 0x53, 0xa9,
0xb8, 0xb8, 0x72, 0x18, 0x77, 0xf5, 0xc1, 0x6d, 0x48, 0x2e, 0xcb, 0x14, 0x88, 0x8c, 0x26, 0x79,
0x10, 0xf4, 0xf4, 0x0e, 0x67, 0x7f, 0x02, 0x00, 0x00, 0xff, 0xff, 0x0b, 0x41, 0x2d, 0x1d, 0x47,
0x04, 0x00, 0x00,
}
5 changes: 1 addition & 4 deletions satellite/internalpb/metainfo_sat.proto
Expand Up @@ -12,6 +12,7 @@ import "google/protobuf/timestamp.proto";
import "metainfo.proto";

message StreamID {
reserved 14;
bytes bucket = 1;
bytes encrypted_object_key = 2;
int64 version = 3;
Expand All @@ -29,10 +30,6 @@ message StreamID {

int32 placement = 13;

// temporary field to determine if we should go with new pending_objects table or
// fallback to pending object in objects table.
bool use_pending_objects_table = 14;

bool versioned = 15;
}

Expand Down
56 changes: 0 additions & 56 deletions satellite/metainfo/config.go
Expand Up @@ -4,7 +4,6 @@
package metainfo

import (
"encoding/binary"
"fmt"
"strconv"
"strings"
Expand Down Expand Up @@ -146,11 +145,6 @@ type Config struct {
ServerSideCopy bool `help:"enable code for server-side copy, deprecated. please leave this to true." default:"true"`
ServerSideCopyDisabled bool `help:"disable already enabled server-side copy. this is because once server side copy is enabled, delete code should stay changed, even if you want to disable server side copy" default:"false"`

UsePendingObjectsTable bool `help:"enable new flow for upload which is using pending_objects table" default:"false"`
// flags to simplify testing by enabling feature only for specific projects or for for specific percentage of projects
UsePendingObjectsTableProjects []string `help:"list of projects which will have UsePendingObjectsTable feature flag enabled" default:"" hidden:"true"`
UsePendingObjectsTableRollout int `help:"percentage (0-100) of projects which should have this feature enabled" default:"0" hidden:"true"`

UseBucketLevelObjectVersioning bool `help:"enable the use of bucket level object versioning" default:"false"`
// flag to simplify testing by enabling bucket level versioning feature only for specific projects
UseBucketLevelObjectVersioningProjects []string `help:"list of projects which will have UseBucketLevelObjectVersioning feature flag enabled" default:"" hidden:"true"`
Expand All @@ -177,28 +171,12 @@ func (c Config) Metabase(applicationName string) metabase.Config {
type ExtendedConfig struct {
Config

usePendingObjectsTableProjects []uuid.UUID
usePendingObjectsTableRolloutCursor uuid.UUID

useBucketLevelObjectVersioningProjects []uuid.UUID
}

// NewExtendedConfig creates new instance of extended config.
func NewExtendedConfig(config Config) (_ ExtendedConfig, err error) {
extendedConfig := ExtendedConfig{Config: config}
for _, projectIDString := range config.UsePendingObjectsTableProjects {
projectID, err := uuid.FromString(projectIDString)
if err != nil {
return ExtendedConfig{}, err
}
extendedConfig.usePendingObjectsTableProjects = append(extendedConfig.usePendingObjectsTableProjects, projectID)
}

extendedConfig.usePendingObjectsTableRolloutCursor, err = createRolloutCursor(config.UsePendingObjectsTableRollout)
if err != nil {
return ExtendedConfig{}, err
}

for _, projectIDString := range config.UseBucketLevelObjectVersioningProjects {
projectID, err := uuid.FromString(projectIDString)
if err != nil {
Expand All @@ -210,27 +188,6 @@ func NewExtendedConfig(config Config) (_ ExtendedConfig, err error) {
return extendedConfig, nil
}

// UsePendingObjectsTableByProject checks if UsePendingObjectsTable should be enabled for specific project.
func (ec ExtendedConfig) UsePendingObjectsTableByProject(projectID uuid.UUID) bool {
// if its globally enabled don't look at projects
if ec.UsePendingObjectsTable {
return true
}
for _, p := range ec.usePendingObjectsTableProjects {
if p == projectID {
return true
}
}

if !ec.usePendingObjectsTableRolloutCursor.IsZero() {
if projectID.Less(ec.usePendingObjectsTableRolloutCursor) {
return true
}
}

return false
}

// UseBucketLevelObjectVersioningByProject checks if UseBucketLevelObjectVersioning should be enabled for specific project.
func (ec ExtendedConfig) UseBucketLevelObjectVersioningByProject(projectID uuid.UUID) bool {
// if its globally enabled don't look at projects
Expand All @@ -245,16 +202,3 @@ func (ec ExtendedConfig) UseBucketLevelObjectVersioningByProject(projectID uuid.

return false
}

func createRolloutCursor(percentage int) (uuid.UUID, error) {
if percentage <= 0 {
return uuid.UUID{}, nil
} else if percentage >= 100 {
return uuid.Max(), nil
}

cursorValue := uint32(1 << 32 * (float32(percentage) / 100))
bytes := make([]byte, 16)
binary.BigEndian.PutUint32(bytes, cursorValue)
return uuid.FromBytes(bytes)
}
88 changes: 1 addition & 87 deletions satellite/metainfo/config_test.go
Expand Up @@ -99,87 +99,6 @@ func TestRSConfigValidation(t *testing.T) {
}
}

func TestExtendedConfig_UsePendingObjectsTable(t *testing.T) {
projectA := testrand.UUID()
projectB := testrand.UUID()
projectC := testrand.UUID()
config, err := metainfo.NewExtendedConfig(metainfo.Config{
UsePendingObjectsTable: false,
UsePendingObjectsTableProjects: []string{
projectA.String(),
projectB.String(),
},
})
require.NoError(t, err)

require.True(t, config.UsePendingObjectsTableByProject(projectA))
require.True(t, config.UsePendingObjectsTableByProject(projectB))
require.False(t, config.UsePendingObjectsTableByProject(projectC))

config, err = metainfo.NewExtendedConfig(metainfo.Config{
UsePendingObjectsTable: true,
UsePendingObjectsTableProjects: []string{
projectA.String(),
},
})
require.NoError(t, err)

require.True(t, config.UsePendingObjectsTableByProject(projectA))
require.True(t, config.UsePendingObjectsTableByProject(projectB))
require.True(t, config.UsePendingObjectsTableByProject(projectC))

config, err = metainfo.NewExtendedConfig(metainfo.Config{
UsePendingObjectsTable: false,
UsePendingObjectsTableProjects: []string{
"01000000-0000-0000-0000-000000000000",
},
})
require.NoError(t, err)
require.True(t, config.UsePendingObjectsTableByProject(uuid.UUID{1}))
}

func TestExtendedConfig_UsePendingObjectsTableRollout(t *testing.T) {
uuidA := testrand.UUID()
config, err := metainfo.NewExtendedConfig(metainfo.Config{
UsePendingObjectsTable: false,
UsePendingObjectsTableRollout: 0,
})
require.NoError(t, err)

require.False(t, config.UsePendingObjectsTableByProject(uuidA))
require.False(t, config.UsePendingObjectsTableByProject(makeUUID("00000001-0000-0000-0000-000000000000")))
require.False(t, config.UsePendingObjectsTableByProject(makeUUID("FFFFFFFF-0000-0000-0000-000000000000")))

config, err = metainfo.NewExtendedConfig(metainfo.Config{
UsePendingObjectsTable: false,
UsePendingObjectsTableRollout: 50,
})
require.NoError(t, err)

require.True(t, config.UsePendingObjectsTableByProject(makeUUID("00000001-0000-0000-0000-000000000000")))
require.False(t, config.UsePendingObjectsTableByProject(makeUUID("FFFFFFFF-0000-0000-0000-000000000000")))

config, err = metainfo.NewExtendedConfig(metainfo.Config{
UsePendingObjectsTable: false,
UsePendingObjectsTableRollout: 25,
})
require.NoError(t, err)

require.True(t, config.UsePendingObjectsTableByProject(makeUUID("00000001-0000-0000-0000-000000000000")))
require.True(t, config.UsePendingObjectsTableByProject(makeUUID("3FFFFFFF-0000-0000-0000-000000000000")))
require.False(t, config.UsePendingObjectsTableByProject(makeUUID("40000000-0000-0000-0000-000000000000")))
require.False(t, config.UsePendingObjectsTableByProject(makeUUID("FFFFFFFF-0000-0000-0000-000000000000")))

config, err = metainfo.NewExtendedConfig(metainfo.Config{
UsePendingObjectsTable: false,
UsePendingObjectsTableRollout: 100,
})
require.NoError(t, err)

require.True(t, config.UsePendingObjectsTableByProject(makeUUID("00000001-0000-0000-0000-000000000000")))
require.True(t, config.UsePendingObjectsTableByProject(makeUUID("FFFFFFFF-0000-0000-0000-000000000000")))
}

func TestExtendedConfig_UseBucketLevelObjectVersioning(t *testing.T) {
projectA := testrand.UUID()
projectB := testrand.UUID()
Expand All @@ -197,16 +116,11 @@ func TestExtendedConfig_UseBucketLevelObjectVersioning(t *testing.T) {
require.False(t, config.UseBucketLevelObjectVersioningByProject(projectC))

config, err = metainfo.NewExtendedConfig(metainfo.Config{
UsePendingObjectsTable: false,
UseBucketLevelObjectVersioning: false,
UseBucketLevelObjectVersioningProjects: []string{
"01000000-0000-0000-0000-000000000000",
},
})
require.NoError(t, err)
require.True(t, config.UseBucketLevelObjectVersioningByProject(uuid.UUID{1}))
}

func makeUUID(uuidString string) uuid.UUID {
value, _ := uuid.FromString(uuidString)
return value
}

0 comments on commit d208328

Please sign in to comment.