satellite/gc/bloomfilter: minor cleanups
* service was running wrong RunOnce method * after doing integration with GC sender we concluded that we don't need special flag "gc-sender" to be uploaded as its safe to consume partial results by GC senger. This part was removed. * prefix format for moving data after error was unified with GC sender https: //github.com/storj/team-metainfo/issues/120 Change-Id: I204b696b9c2def4874ad1d17d0e84231cc98d583
This commit is contained in:
parent
e6b5501f9b
commit
c3ca98f552
@ -78,7 +78,7 @@ func (service *Service) Run(ctx context.Context) (err error) {
|
||||
return errs.New("Bucket is not set")
|
||||
}
|
||||
|
||||
return service.Loop.Run(ctx, service.segmentLoop.RunOnce)
|
||||
return service.Loop.Run(ctx, service.RunOnce)
|
||||
}
|
||||
|
||||
// RunOnce runs service only once.
|
||||
@ -188,15 +188,7 @@ func (service *Service) uploadBloomFilters(ctx context.Context, latestCreationDa
|
||||
return err
|
||||
}
|
||||
|
||||
// upload empty object as a flag that bloom filters can be consumed.
|
||||
upload, err := project.UploadObject(ctx, service.config.Bucket, "gc-done", &uplink.UploadOptions{
|
||||
Expires: expirationTime,
|
||||
})
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return upload.Commit()
|
||||
return nil
|
||||
}
|
||||
|
||||
// uploadPack uploads single zip pack with multiple bloom filters.
|
||||
@ -252,7 +244,7 @@ func (service *Service) uploadPack(ctx context.Context, project *uplink.Project,
|
||||
func (service *Service) cleanup(ctx context.Context, project *uplink.Project) (err error) {
|
||||
defer mon.Task()(&ctx)(&err)
|
||||
|
||||
prefix := strconv.FormatInt(time.Now().Unix(), 10)
|
||||
prefix := "upload-error-" + time.Now().Format(time.RFC3339)
|
||||
iterator := project.ListObjects(ctx, service.config.Bucket, nil)
|
||||
|
||||
for iterator.Next() {
|
||||
|
@ -79,10 +79,6 @@ func TestGarbageCollectionBloomFilters(t *testing.T) {
|
||||
nodeIds := []string{}
|
||||
packNames := []string{}
|
||||
for iterator.Next() {
|
||||
if iterator.Item().Key == "gc-done" {
|
||||
continue
|
||||
}
|
||||
|
||||
packNames = append(packNames, iterator.Item().Key)
|
||||
|
||||
data, err := planet.Uplinks[0].Download(ctx, planet.Satellites[0], tc.Bucket, iterator.Item().Key)
|
||||
@ -130,9 +126,6 @@ func TestGarbageCollectionBloomFilters(t *testing.T) {
|
||||
sort.Strings(expectedNodeIds)
|
||||
sort.Strings(nodeIds)
|
||||
require.Equal(t, expectedNodeIds, nodeIds)
|
||||
|
||||
_, err = project.StatObject(ctx, tc.Bucket, "gc-done")
|
||||
require.NoError(t, err)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
@ -75,13 +75,10 @@ func TestSendRetainFilters(t *testing.T) {
|
||||
})
|
||||
require.True(t, it.Next())
|
||||
keys = append(keys, it.Item().Key)
|
||||
require.True(t, it.Next())
|
||||
keys = append(keys, it.Item().Key)
|
||||
require.False(t, it.Next())
|
||||
|
||||
sort.Strings(keys)
|
||||
require.Equal(t, "gc-done", keys[0])
|
||||
require.Regexp(t, "sent-.*/.*.zip$", keys[1])
|
||||
require.Regexp(t, "sent-.*/.*.zip$", keys[0])
|
||||
})
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user