mirror of
https://github.com/dolthub/dolt.git
synced 2026-01-30 19:09:34 -06:00
Compress dictionaries when streaming to archives. Need a TEST
This commit is contained in:
@@ -25,6 +25,7 @@ import (
|
||||
"sort"
|
||||
|
||||
"github.com/dolthub/dolt/go/store/hash"
|
||||
"github.com/dolthub/gozstd"
|
||||
)
|
||||
|
||||
type stagedByteSpanSlice []byteSpan
|
||||
@@ -544,8 +545,11 @@ func (asw *ArchiveStreamWriter) writeArchiveToChunker(chunker ArchiveToChunker)
|
||||
var err error
|
||||
dictId, ok := asw.dictMap[dict]
|
||||
if !ok {
|
||||
// compress the raw bytes of the dictionary before persisting it.
|
||||
compressedDict := gozstd.Compress(nil, *dict.rawDictionary)
|
||||
|
||||
// New dictionary. Write it out, and add id to the map.
|
||||
dictId, err = asw.writer.writeByteSpan(*dict.rawDictionary)
|
||||
dictId, err = asw.writer.writeByteSpan(compressedDict)
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user