Skip to content

Commit

Permalink
removed extreaneous prints used to debug
Browse files Browse the repository at this point in the history
  • Loading branch information
Katie Tezapsidis committed Nov 27, 2017
1 parent ee5f419 commit af8f2f7
Show file tree
Hide file tree
Showing 5 changed files with 4 additions and 50 deletions.
2 changes: 0 additions & 2 deletions integration/disk_cleanup_deletes_inactive_directories_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
package integration

import (
"fmt"
"runtime/debug"
"testing"
"time"
Expand Down Expand Up @@ -96,7 +95,6 @@ func TestDiskCleansupInactiveDirectories(t *testing.T) {
time.Sleep(10 * time.Second)
debug.PrintStack()
}()
fmt.Println("attempting to delete", nsToDelete)
require.NoError(t, <-nsResetErr)

go func() {
Expand Down
13 changes: 0 additions & 13 deletions integration/disk_cleanup_helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ package integration

import (
"errors"
"fmt"
"os"
"testing"
"time"
Expand Down Expand Up @@ -155,11 +154,8 @@ func waitUntilDataCleanedUpExtended(

// nolint: deadcode, unused
func waitUntilNamespacesCleanedUp(filePathPrefix string, namespace ts.ID, waitTimeout time.Duration) error {
nsDir := fs.NamespaceDirPath(filePathPrefix, namespace)
fmt.Println("Loooking for namespace to be delete:", nsDir)
dataCleanedUp := func() bool {
namespaceDir := fs.NamespaceDirPath(filePathPrefix, namespace)
fmt.Println("found", namespaceDir)
return !fs.FileExists(namespaceDir)
}

Expand All @@ -172,19 +168,10 @@ func waitUntilNamespacesCleanedUp(filePathPrefix string, namespace ts.ID, waitTi
// nolint: deadcode, unused
func waitUntilNamespacesHaveReset(testSetup *testSetup, newNamespaces []namespace.Metadata, newShardSet sharding.ShardSet) (*testSetup, error) {
testSetup.stopServer()
// testSetup.waitUntilServerIsDown()
// Reset to the desired shard set and namespaces
// Because restarting the server would bootstrap
// To old data we wanted to delete
fmt.Println("resetting the namespaces to the following new namespaces")
for _, md := range newNamespaces {
fmt.Println("new ns:", md.ID().String())
}
testSetup.opts = testSetup.opts.SetNamespaces(newNamespaces)
testSetupNamespaces := testSetup.opts.Namespaces()
for _, md := range testSetupNamespaces {
fmt.Println("changed to new ns:", md.ID().String())
}

resetSetup, err := newTestSetup(nil, testSetup.opts, testSetup.fsOpts)
if err != nil {
Expand Down
16 changes: 0 additions & 16 deletions integration/options.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
package integration

import (
"fmt"
"testing"
"time"

Expand Down Expand Up @@ -288,24 +287,9 @@ func newTestOptions(t *testing.T) testOptions {
}

func (o *options) SetNamespaces(value []namespace.Metadata) testOptions {
fmt.Println("setting namespaces now.")
opts := *o
fmt.Println("attempting to set namespaces as:")
for _, v := range value {
fmt.Println("pNS:", v.ID().String())
}
fmt.Println("original namespaces:")
for _, ns := range opts.namespaces {
fmt.Println("ns1:", ns.ID().String())
}

opts.namespaces = opts.namespaces[:0]
opts.namespaces = value
fmt.Println("namepsaces after set:")
for _, ns := range opts.namespaces {
fmt.Println("ns1:", ns.ID().String())
}

return &opts
}

Expand Down
4 changes: 0 additions & 4 deletions integration/setup.go
Original file line number Diff line number Diff line change
Expand Up @@ -105,10 +105,6 @@ func newTestSetup(t *testing.T, opts testOptions, fsOpts fs.Options) (*testSetup
if opts == nil {
opts = newTestOptions(t)
}
mds := opts.Namespaces()
for _, md := range mds {
fmt.Println(opts.ID(), "has starting namespace", md.ID().String())
}
nsInit := opts.NamespaceInitializer()
if nsInit == nil {
nsInit = namespace.NewStaticInitializer(opts.Namespaces())
Expand Down
19 changes: 4 additions & 15 deletions storage/cleanup.go
Original file line number Diff line number Diff line change
Expand Up @@ -93,11 +93,10 @@ func (m *cleanupManager) Cleanup(t time.Time) error {
"encountered errors when cleaning up fileset files for %v: %v", t, err))
}

/*
if err := m.deleteInactiveFilesetFiles(); err != nil {
multiErr = multiErr.Add(fmt.Errorf(
"encountered errors when deleting inactive fileset files for %v: %v", t, err))
} */
if err := m.deleteInactiveFilesetFiles(); err != nil {
multiErr = multiErr.Add(fmt.Errorf(
"encountered errors when deleting inactive fileset files for %v: %v", t, err))
}

if err := m.deleteInactiveNamespaceFiles(); err != nil {
multiErr = multiErr.Add(fmt.Errorf(
Expand Down Expand Up @@ -136,23 +135,14 @@ func (m *cleanupManager) deleteInactiveNamespaceFiles() error {
var namespaceDirNames []string
filePathPrefix := m.database.Options().CommitLogOptions().FilesystemOptions().FilePathPrefix()
dataDirPath := fs.DataDirPath(filePathPrefix)
fmt.Println("data dir", dataDirPath)
fmt.Println("checking for extra contents")
namespaces, err := m.database.GetOwnedNamespaces()
fmt.Println("owned namespaces: ")
for _, n := range namespaces {
fmt.Println("namespace", n.ID().String())
}
if err != nil {
return err
}

for _, n := range namespaces {
namespaceDirNames = append(namespaceDirNames, n.ID().String())
fmt.Println("namespace dir", n.ID().String())
fmt.Println("the path would be", fs.NamespaceDirPath(filePathPrefix, n.ID()))
}
fmt.Println("filepathPathPefix=", filePathPrefix, ", dataDirPath=", dataDirPath)

return m.deleteInactiveDirectoriesFn(dataDirPath, namespaceDirNames)
}
Expand All @@ -166,7 +156,6 @@ func (m *cleanupManager) deleteInactiveFilesetFiles() error {
}
for _, n := range namespaces {
var activeShards []string
//replace with injection later
namespaceDirPath := fs.NamespaceDirPath(filePathPrefix, n.ID())
for _, s := range n.GetOwnedShards() {
shard := fmt.Sprintf("%d", s.ID())
Expand Down

0 comments on commit af8f2f7

Please sign in to comment.