Skip to content

Commit

Permalink
Attempt manual garbage collection
Browse files Browse the repository at this point in the history
  • Loading branch information
Russell-Tran committed Jun 4, 2024
1 parent 23bcf8f commit 774aa53
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions go/cmd/gcsobjtable/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import (
"log"
"math/rand"
"net"
"runtime"
"strconv"
"sync"

Expand Down Expand Up @@ -121,6 +122,12 @@ func (s *GCSObjServer) flushToDisk() error {
}
// Completely delete the current map in memory and start blank
s.objectLocations = make(map[uint64][]uint64) // orphaning the old map will get it garbage collected
// Manually trigger garbage collection
garbage_collect := true // TODO: REMOVE HARDCODED
if garbage_collect {
runtime.GC()
fmt.Println("Garbage collection triggered")
}
return nil
}

Expand Down Expand Up @@ -184,8 +191,6 @@ func (s *GCSObjServer) NotifyOwns(ctx context.Context, req *pb.NotifyOwnsRequest
s.mu.Lock()
defer s.mu.Unlock()

log.Printf("WAS JUST NOTIFYOWNS()ED")

uid, nodeId := req.Uid, req.NodeId

// Append the nodeId to the list for the given object uid
Expand Down Expand Up @@ -257,11 +262,6 @@ func (s *GCSObjServer) RequestLocation(ctx context.Context, req *pb.RequestLocat

func (s *GCSObjServer) GetObjectLocations(ctx context.Context, req *pb.ObjectLocationsRequest) (*pb.ObjectLocationsResponse, error) {
locations := make(map[uint64]*pb.LocationByteTuple)
// log.Printf("DEEP PRINT!")
// log.Printf("length = %v", len(s.objectLocations))
// for k, v := range s.objectLocations {
// log.Printf("s.objectLocations[%v] = %v", k, v)
// }

for _, u := range req.Args {
if _, ok := s.objectLocations[uint64(u)]; ok {
Expand Down

0 comments on commit 774aa53

Please sign in to comment.