incubator-hugegraph
incubator-hugegraph copied to clipboard
同一种label的节点大量写入会出现hbase热点问题吗
请问这段代码中会将rowKey的第一个字节设置成某值,是为了避免热点问题吗
public BytesBuffer writeId(Id id, boolean big) {
boolean number = id.number();
if (number) {
long value = id.asLong();
this.writeNumber(value);
} else {
byte[] bytes = id.asBytes();
int len = bytes.length;
E.checkArgument(len > 0, "Can't write empty id");
if (!big) {
E.checkArgument(len <= ID_MAX_LEN,
"Id max length is %s, but got %s {%s}",
ID_MAX_LEN, len, id);
len -= 1; // mapping [1, 128] to [0, 127]
this.writeUInt8(len | 0x80);
} else {
E.checkArgument(len <= BIG_ID_MAX_LEN,
"Big id max length is %s, but got %s",
BIG_ID_MAX_LEN, len);
len -= 1;
int high = len >> 8;
int low = len & 0xff;
this.writeUInt8(high | 0x80);
this.writeUInt8(low);
}
this.write(bytes);
}
return this;
}
@youngkangrui 两方面考虑:一个是为了记录顶点id的长度,另一个是部分解决热点问题,主要还是前者。