Binary 类

  • 增加 Binary(byte[] v, int n) 和 Binary(String s, int n)

TsFile Page

序列化方式

  • 方式1: 与现有TEXT相同,先序列化一个int类型 string 长度,再序列化一个bytes数组,bytes.length <= n

  • 方式2:只序列化一个长度为n的byte数组,长度n 放到 TsDataType 后

元数据TsDataType

TsDataType 增加一个enum类型chars,编号为6 TsDataType 增加一个字段charsLength

序列化TsDataType.CHARS时,序列化short编号6之后,再序列化一个int记录长度n

反序列化时TsDataType,先读出一个short,如果为6,再反序列化出一个int,set到charsLength

内存管理

由于有max_string_length=m来限制string 最大长度,我们可以构建一个ByteBufferPool 来管理写入到memtable 中 byte数组

ByteBufferPool

类似于现有的PrimitiveArrayManager的机制,向ByteBufferPool申请到的byte数组也可以分为Buffered Array和OOB Array。

ByteBufferPool 设置最大内存限制 T

BufferPool管理目前也有两种策略:

  • 策略1 :根据注册的不同的n来确定pool中byte数组的种类。
  • 策略2: 类似于netty 内存池对于小buffer的管理,把byte数组分为log2 m种,申请时根据需要的大小进行组合后写入数据

当pool中大小超过T后,申请OOB array,释放时优先释放OOB

SQL语法

增加 datatype = char(n)

  • No labels

1 Comment

  1. Logically, datatype = char(n), n is unsigned. Can n be short (16-bit) rather than int (32-bit)?

    Use 序列化方式1, the data read out will become TEXT rather than this new data type? In another word, how to distinct the data in bytes array is TEXT or char(n) without putting leading data type in serialized bytes?