Now in our storage engine, we create so many Schema/Field for many purpose. I think after a table is created, its Schema and Filed are not modified unless there is a schema change. However, schema change for a table is infrequent operation, which means that Schema/Field will keep the same most time. So, I think we can reuse this Schema/Field to avoid unnecessary object creation and deletion.
To achieve this, I will create a FieldList struct and keep it in tablet. When tablet's schema is changed, we will create a new FieldList. For safety I will store it in shared_ptr, when old is invalidated in tablet, others can still use the old one.
And Schema will contain one FiledList to reuse this struct. If only some fields are used, then column ids of used columns and FiledList can build Schema.
1条答案
按热度按时间0yycz8jy1#
related to #1726