-
-
Notifications
You must be signed in to change notification settings - Fork 516
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
dolt gc --full: Implement a flag for GC which will collect everything, including the old gen. #8462
Changes from all commits
fc12a80
c4e485f
cc47d3f
38a9720
e37acff
95e2adb
760ec2c
0905d48
88a9a34
077294f
6cfac1b
0a53805
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -343,7 +343,24 @@ func (ms *MemoryStoreView) EndGC() { | |
ms.transitionToNoGC() | ||
} | ||
|
||
func (ms *MemoryStoreView) MarkAndSweepChunks(ctx context.Context, hashes <-chan []hash.Hash, dest ChunkStore) error { | ||
type msvGcFinalizer struct { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. After GC, what does the memory store contain? This refactor looks like it preserves previous behavior, but I'm not sure why the previous behavior is the way it is. Educate me There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. AFAIK, memory store is an in-memory chunk store implementation. After GC, memory store just contains all the visited chunks – that is, all the chunks whose address came through on the keepers channel. |
||
ms *MemoryStoreView | ||
keepers map[hash.Hash]Chunk | ||
} | ||
|
||
func (mgcf msvGcFinalizer) AddChunksToStore(ctx context.Context) (HasManyFunc, error) { | ||
panic("unsupported") | ||
} | ||
|
||
func (mgcf msvGcFinalizer) SwapChunksInStore(ctx context.Context) error { | ||
mgcf.ms.mu.Lock() | ||
defer mgcf.ms.mu.Unlock() | ||
mgcf.ms.storage = &MemoryStorage{rootHash: mgcf.ms.rootHash, data: mgcf.keepers} | ||
mgcf.ms.pending = map[hash.Hash]Chunk{} | ||
return nil | ||
} | ||
|
||
func (ms *MemoryStoreView) MarkAndSweepChunks(ctx context.Context, hashes <-chan []hash.Hash, dest ChunkStore) (GCFinalizer, error) { | ||
if dest != ms { | ||
panic("unsupported") | ||
} | ||
|
@@ -366,20 +383,16 @@ LOOP: | |
for _, h := range hs { | ||
c, err := ms.Get(ctx, h) | ||
if err != nil { | ||
return err | ||
return nil, err | ||
} | ||
keepers[h] = c | ||
} | ||
case <-ctx.Done(): | ||
return ctx.Err() | ||
return nil, ctx.Err() | ||
} | ||
} | ||
|
||
ms.mu.Lock() | ||
defer ms.mu.Unlock() | ||
ms.storage = &MemoryStorage{rootHash: ms.rootHash, data: keepers} | ||
ms.pending = map[hash.Hash]Chunk{} | ||
return nil | ||
return msvGcFinalizer{ms, keepers}, nil | ||
} | ||
|
||
func (ms *MemoryStoreView) Count() (uint32, error) { | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These tests are weird. Just an observation. I was thinking that I was going to ask for a test for the Full flag here, but it looks like these tests are basically just running Exec. Maybe bats is better than this?
sqlengine tests for this instead? Just sayin. These tests are weird.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, I don't think these tests are worth much compared to a bats test which does the same. Obviously they're supposed to target the DoltDB.GC invocation itself, and they're much easy to attach a debugger to or whatever, but AFAICT they're not providing much in the way of protection compared to existing layers of cheese.