storagenode/piecestore: move queue size defaults (#3881)
This commit is contained in:
parent
ffbaaff179
commit
ef2671927d
@ -135,6 +135,8 @@ func (planet *Planet) newStorageNodes(count int, whitelistedSatellites storj.Nod
|
|||||||
OrderLimitGracePeriod: time.Hour,
|
OrderLimitGracePeriod: time.Hour,
|
||||||
StreamOperationTimeout: time.Hour,
|
StreamOperationTimeout: time.Hour,
|
||||||
ReportCapacityThreshold: 100 * memory.MB,
|
ReportCapacityThreshold: 100 * memory.MB,
|
||||||
|
DeleteQueueSize: 10000,
|
||||||
|
DeleteWorkers: 1,
|
||||||
Orders: orders.Config{
|
Orders: orders.Config{
|
||||||
SenderInterval: defaultInterval,
|
SenderInterval: defaultInterval,
|
||||||
SenderTimeout: 10 * time.Minute,
|
SenderTimeout: 10 * time.Minute,
|
||||||
|
@ -43,14 +43,6 @@ type Deleter struct {
|
|||||||
|
|
||||||
// NewDeleter creates a new Deleter.
|
// NewDeleter creates a new Deleter.
|
||||||
func NewDeleter(log *zap.Logger, store *Store, numWorkers int, queueSize int) *Deleter {
|
func NewDeleter(log *zap.Logger, store *Store, numWorkers int, queueSize int) *Deleter {
|
||||||
if numWorkers == 0 {
|
|
||||||
numWorkers = 1
|
|
||||||
}
|
|
||||||
if queueSize == 0 {
|
|
||||||
// Default queueSize is chosen as a large number that uses a manageable
|
|
||||||
// amount of memory.
|
|
||||||
queueSize = 10000
|
|
||||||
}
|
|
||||||
return &Deleter{
|
return &Deleter{
|
||||||
ch: make(chan DeleteRequest, queueSize),
|
ch: make(chan DeleteRequest, queueSize),
|
||||||
numWorkers: numWorkers,
|
numWorkers: numWorkers,
|
||||||
|
@ -34,7 +34,7 @@ func TestDeleter(t *testing.T) {
|
|||||||
store := pieces.NewStore(zaptest.NewLogger(t), blobs, nil, nil, nil, pieces.DefaultConfig)
|
store := pieces.NewStore(zaptest.NewLogger(t), blobs, nil, nil, nil, pieces.DefaultConfig)
|
||||||
|
|
||||||
// Also test that 0 works for maxWorkers
|
// Also test that 0 works for maxWorkers
|
||||||
deleter := pieces.NewDeleter(zaptest.NewLogger(t), store, 0, 0)
|
deleter := pieces.NewDeleter(zaptest.NewLogger(t), store, 1, 10000)
|
||||||
defer ctx.Check(deleter.Close)
|
defer ctx.Check(deleter.Close)
|
||||||
deleter.SetupTest()
|
deleter.SetupTest()
|
||||||
|
|
||||||
@ -98,11 +98,6 @@ func TestEnqueueUnhandled(t *testing.T) {
|
|||||||
pieces: 10,
|
pieces: 10,
|
||||||
expUnhandled: 9,
|
expUnhandled: 9,
|
||||||
},
|
},
|
||||||
{
|
|
||||||
queueSize: 0, // should default to a big number
|
|
||||||
pieces: 10,
|
|
||||||
expUnhandled: 0,
|
|
||||||
},
|
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, tc := range testcases {
|
for _, tc := range testcases {
|
||||||
@ -111,7 +106,7 @@ func TestEnqueueUnhandled(t *testing.T) {
|
|||||||
for i := 0; i < tc.pieces; i++ {
|
for i := 0; i < tc.pieces; i++ {
|
||||||
pieceIDs = append(pieceIDs, testrand.PieceID())
|
pieceIDs = append(pieceIDs, testrand.PieceID())
|
||||||
}
|
}
|
||||||
deleter := pieces.NewDeleter(zaptest.NewLogger(t), nil, 0, tc.queueSize)
|
deleter := pieces.NewDeleter(zaptest.NewLogger(t), nil, 1, tc.queueSize)
|
||||||
unhandled := deleter.Enqueue(context.Background(), satelliteID, pieceIDs)
|
unhandled := deleter.Enqueue(context.Background(), satelliteID, pieceIDs)
|
||||||
require.Equal(t, tc.expUnhandled, unhandled)
|
require.Equal(t, tc.expUnhandled, unhandled)
|
||||||
require.NoError(t, deleter.Close())
|
require.NoError(t, deleter.Close())
|
||||||
|
@ -53,8 +53,8 @@ type Config struct {
|
|||||||
DatabaseDir string `help:"directory to store databases. if empty, uses data path" default:""`
|
DatabaseDir string `help:"directory to store databases. if empty, uses data path" default:""`
|
||||||
ExpirationGracePeriod time.Duration `help:"how soon before expiration date should things be considered expired" default:"48h0m0s"`
|
ExpirationGracePeriod time.Duration `help:"how soon before expiration date should things be considered expired" default:"48h0m0s"`
|
||||||
MaxConcurrentRequests int `help:"how many concurrent requests are allowed, before uploads are rejected. 0 represents unlimited." default:"0"`
|
MaxConcurrentRequests int `help:"how many concurrent requests are allowed, before uploads are rejected. 0 represents unlimited." default:"0"`
|
||||||
DeleteWorkers int `help:"how many piece delete workers" default:"0"`
|
DeleteWorkers int `help:"how many piece delete workers" default:"1"`
|
||||||
DeleteQueueSize int `help:"size of the piece delete queue" default:"0"`
|
DeleteQueueSize int `help:"size of the piece delete queue" default:"10000"`
|
||||||
OrderLimitGracePeriod time.Duration `help:"how long after OrderLimit creation date are OrderLimits no longer accepted" default:"24h0m0s"`
|
OrderLimitGracePeriod time.Duration `help:"how long after OrderLimit creation date are OrderLimits no longer accepted" default:"24h0m0s"`
|
||||||
CacheSyncInterval time.Duration `help:"how often the space used cache is synced to persistent storage" releaseDefault:"1h0m0s" devDefault:"0h1m0s"`
|
CacheSyncInterval time.Duration `help:"how often the space used cache is synced to persistent storage" releaseDefault:"1h0m0s" devDefault:"0h1m0s"`
|
||||||
StreamOperationTimeout time.Duration `help:"how long to spend waiting for a stream operation before canceling" default:"30m"`
|
StreamOperationTimeout time.Duration `help:"how long to spend waiting for a stream operation before canceling" default:"30m"`
|
||||||
|
Loading…
Reference in New Issue
Block a user