-
Notifications
You must be signed in to change notification settings - Fork 312
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
server: support default TTL for a table #202
Conversation
@@ -256,7 +256,7 @@ max_concurrent_uploading_file_count = 5 | |||
rocksdb_verbose_log = false | |||
rocksdb_write_buffer_size = 10485760 | |||
updating_rocksdb_sstsize_interval_seconds = 30 | |||
manual_compact_min_interval_seconds = 3600 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这个是做测试用的,没有改回去?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
测试代码里有多次触发manual compact的流程,需要把这里的间隔改小
/// * a new writen item, 'default_ttl' will be applied on this item. | ||
/// * an exist item, 'default_ttl' will be applied on this item when it was compacted. | ||
/// <= 0 means no effect | ||
const std::string TABLE_LEVEL_DEFAULT_TTL("default_ttl"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
感觉叫 "table_level_ttl"比较合适,不需要default
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这里其实是有考虑的:
在设置时,这个值是本身就是针对一个table设置的(先use $table),再加一个"table"显得多余
在代码里,他作用于一个replica的存储引擎部分,这里其实已经没有table的概念了
再者它是对没有设置ttl的数据有效,是一个默认值,”default“便于理解
|
||
uint32_t expire_ts = | ||
pegasus_extract_expire_ts(_value_schema_version, utils::to_string_view(existing_value)); | ||
if (_default_ttl != 0 && expire_ts == 0) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这里可以仔细优化下,尽量避免数据拷贝或者移动
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
可以在 pegasus_value_schema.h 加一个函数:
void update_expire_ts_in_place(std::string &raw_value, uint64_t new_expire_ts)
return check_if_record_expired( | ||
_value_schema_version, utils::epoch_now(), utils::to_string_view(existing_value)); | ||
} | ||
return check_if_ts_expired(utils::epoch_now(), expire_ts); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
如果用了table_level_ttl,这里就不需要重复执行check_if_ts_expired了,因为结果是肯定not expired
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
如果重新设置了ttl,上面已经直接返回了false
Former-commit-id: 3e558143dce26a75736d2afc661403ddbcb76e79 [formerly 7dae1c5] Former-commit-id: ad8416a1c577dc6c5304fc66caf5a358641b0765
#198