johncming / go-spec

my wiki
Apache License 2.0
0 stars 0 forks source link

wal #107

Open johncming opened 6 years ago

johncming commented 6 years ago
func encodeFrameSize(dataBytes int) (lenField uint64, padBytes int) {
    lenField = uint64(dataBytes)
    // force 8 byte alignment so length never gets a torn write
    padBytes = (8 - (dataBytes % 8)) % 8
    if padBytes != 0 {
        lenField |= uint64(0x80|padBytes) << 56
    }
    return lenField, padBytes
}

set dataBytes=5

lenField=8300000000000005h

johncming commented 6 years ago

image

johncming commented 6 years ago

image

在mac下也是预分配了很多空间

62500k  0000000000000000-0000000000000000.wal