feat: hbaseapi support ttl & maxversions
This commit is contained in:
@ -1115,6 +1115,123 @@
|
||||
##这两行之间的这些action,如果不写在这两行之间的话会导致清空不掉相应的action。
|
||||
#
|
||||
#####========******####======== actions begin ========####******========####
|
||||
#class EachTenantDDLActionPostCreateAllKvTTLTasks(BaseEachTenantDDLAction):
|
||||
# @staticmethod
|
||||
# def get_seq_num():
|
||||
# return 0
|
||||
# def dump_before_do_action(self):
|
||||
# my_utils.query_and_dump_results(self._query_cursor, """select tenant_id, table_id, table_name from {0} where table_name = '__all_kv_ttl_task'""".format(self.get_all_table_name()))
|
||||
# def check_before_do_action(self):
|
||||
# (desc, results) = self._query_cursor.exec_query("""select tenant_id, table_id, table_name from {0} where table_name = '__all_kv_ttl_task'""".format(self.get_all_table_name()))
|
||||
# if len(results) > 0:
|
||||
# raise MyError('__all_kv_ttl_task already created')
|
||||
# def dump_before_do_each_tenant_action(self, tenant_id):
|
||||
# my_utils.query_and_dump_results(self._query_cursor, """select tenant_id, table_id, table_name from {0} where table_name = '__all_kv_ttl_task' and tenant_id = {1}""".format(self.get_all_table_name(), tenant_id))
|
||||
# def skip_pre_check(self):
|
||||
# return True
|
||||
# def skip_each_tenant_action(self, tenant_id):
|
||||
# (desc, results) = self._query_cursor.exec_query("""select tenant_id, table_id, table_name from {0} where table_name = '__all_kv_ttl_task' and tenant_id = {1}""".format(self.get_all_table_name(), tenant_id))
|
||||
# return (1 == len(results))
|
||||
# def check_before_do_each_tenant_action(self, tenant_id):
|
||||
# (desc, results) = self._query_cursor.exec_query("""select tenant_id, table_id, table_name from {0} where table_name = '__all_kv_ttl_task' and tenant_id = {1}""".format(self.get_all_table_name(), tenant_id))
|
||||
# if len(results) > 0:
|
||||
# raise MyError('tenant_id:{0} has already create table __all_kv_ttl_task'.format(tenant_id))
|
||||
# @staticmethod
|
||||
# def get_each_tenant_action_ddl(tenant_id):
|
||||
# pure_table_id = 410
|
||||
# table_id = (tenant_id << 40) | pure_table_id
|
||||
# return """CREATE TABLE `__all_kv_ttl_task` (
|
||||
# `gmt_create` timestamp(6) NULL DEFAULT CURRENT_TIMESTAMP(6),
|
||||
# `gmt_modified` timestamp(6) NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6),
|
||||
# `tenant_id` bigint(20) NOT NULL,
|
||||
# `task_id` bigint(20) NOT NULL,
|
||||
# `table_id` bigint(20) NOT NULL,
|
||||
# `partition_id` bigint(20) NOT NULL,
|
||||
# `task_start_time` bigint(20) NOT NULL,
|
||||
# `task_update_time` bigint(20) NOT NULL,
|
||||
# `trigger_type` bigint(20) NOT NULL,
|
||||
# `status` bigint(20) NOT NULL,
|
||||
# `ttl_del_cnt` bigint(20) NOT NULL,
|
||||
# `max_version_del_cnt` bigint(20) NOT NULL,
|
||||
# `scan_cnt` bigint(20) NOT NULL,
|
||||
# `row_key` varbinary(2048) NOT NULL,
|
||||
# `ret_code` varchar(512) NOT NULL,
|
||||
# PRIMARY KEY (`tenant_id`, `task_id`, `table_id`, `partition_id`)
|
||||
# ) TABLE_ID={0} DEFAULT CHARSET = utf8mb4 ROW_FORMAT = COMPACT COMPRESSION = 'none' REPLICA_NUM = 1 BLOCK_SIZE = 16384 USE_BLOOM_FILTER = FALSE TABLET_SIZE = 134217728 PCTFREE = 10 TABLEGROUP = 'oceanbase' """.format(table_id)
|
||||
# @staticmethod
|
||||
# def get_each_tenant_rollback_sql(tenant_id):
|
||||
# return """select 1"""
|
||||
# def dump_after_do_each_tenant_action(self, tenant_id):
|
||||
# my_utils.query_and_dump_results(self._query_cursor, """select tenant_id, table_id, table_name from {0} where table_name = '__all_kv_ttl_task' and tenant_id = {1}""".format(self.get_all_table_name(), tenant_id))
|
||||
# def check_after_do_each_tenant_action(self, tenant_id):
|
||||
# (desc, results) = self._query_cursor.exec_query("""select tenant_id, table_id, table_name from {0} where table_name = '__all_kv_ttl_task' and tenant_id = {1}""".format(self.get_all_table_name(), tenant_id))
|
||||
# if len(results) != 1:
|
||||
# raise MyError('tenant_id:{0} create table __all_kv_ttl_task failed'.format(tenant_id))
|
||||
# def dump_after_do_action(self):
|
||||
# my_utils.query_and_dump_results(self._query_cursor, """select tenant_id, table_id, table_name from {0} where table_name = '__all_kv_ttl_task'""".format(self.get_all_table_name()))
|
||||
# def check_after_do_action(self):
|
||||
# (desc, results) = self._query_cursor.exec_query("""select tenant_id, table_id, table_name from {0} where table_name = '__all_kv_ttl_task'""".format(self.get_all_table_name()))
|
||||
# if len(results) != len(self.get_tenant_id_list()):
|
||||
# raise MyError('there should be {0} rows in {1} whose table_name is __all_kv_ttl_task, but there has {2} rows like that'.format(len(self.get_tenant_id_list()), self.get_all_table_name(), len(results)))
|
||||
#
|
||||
#class EachTenantDDLActionPostCreateAllKvTTLTaskHistory(BaseEachTenantDDLAction):
|
||||
# @staticmethod
|
||||
# def get_seq_num():
|
||||
# return 1
|
||||
# def dump_before_do_action(self):
|
||||
# my_utils.query_and_dump_results(self._query_cursor, """select tenant_id, table_id, table_name from {0} where table_name = '__all_kv_ttl_task_history'""".format(self.get_all_table_name()))
|
||||
# def skip_pre_check(self):
|
||||
# return True
|
||||
# def skip_each_tenant_action(self, tenant_id):
|
||||
# (desc, results) = self._query_cursor.exec_query("""select tenant_id, table_id, table_name from {0} where table_name = '__all_kv_ttl_task_history' and tenant_id = {1}""".format(self.get_all_table_name(), tenant_id))
|
||||
# return (1 == len(results))
|
||||
# def check_before_do_action(self):
|
||||
# (desc, results) = self._query_cursor.exec_query("""select tenant_id, table_id, table_name from {0} where table_name = '__all_kv_ttl_task_history'""".format(self.get_all_table_name()))
|
||||
# if len(results) > 0:
|
||||
# raise MyError('__all_kv_ttl_task_history already created')
|
||||
# def dump_before_do_each_tenant_action(self, tenant_id):
|
||||
# my_utils.query_and_dump_results(self._query_cursor, """select tenant_id, table_id, table_name from {0} where table_name = '__all_kv_ttl_task_history' and tenant_id = {1}""".format(self.get_all_table_name(), tenant_id))
|
||||
# def check_before_do_each_tenant_action(self, tenant_id):
|
||||
# (desc, results) = self._query_cursor.exec_query("""select tenant_id, table_id, table_name from {0} where table_name = '__all_kv_ttl_task_history' and tenant_id = {1}""".format(self.get_all_table_name(), tenant_id))
|
||||
# if len(results) > 0:
|
||||
# raise MyError('tenant_id:{0} has already create table __all_kv_ttl_task_history'.format(tenant_id))
|
||||
# @staticmethod
|
||||
# def get_each_tenant_action_ddl(tenant_id):
|
||||
# pure_table_id = 411
|
||||
# table_id = (tenant_id << 40) | pure_table_id
|
||||
# return """CREATE TABLE `__all_kv_ttl_task_history` (
|
||||
# `gmt_create` timestamp(6) NULL DEFAULT CURRENT_TIMESTAMP(6),
|
||||
# `gmt_modified` timestamp(6) NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6),
|
||||
# `tenant_id` bigint(20) NOT NULL,
|
||||
# `task_id` bigint(20) NOT NULL,
|
||||
# `table_id` bigint(20) NOT NULL,
|
||||
# `partition_id` bigint(20) NOT NULL,
|
||||
# `task_start_time` bigint(20) NOT NULL,
|
||||
# `task_update_time` bigint(20) NOT NULL,
|
||||
# `trigger_type` bigint(20) NOT NULL,
|
||||
# `status` bigint(20) NOT NULL,
|
||||
# `ttl_del_cnt` bigint(20) NOT NULL,
|
||||
# `max_version_del_cnt` bigint(20) NOT NULL,
|
||||
# `scan_cnt` bigint(20) NOT NULL,
|
||||
# `row_key` varbinary(2048) NOT NULL,
|
||||
# `ret_code` varchar(512) NOT NULL,
|
||||
# PRIMARY KEY (`tenant_id`, `task_id`, `table_id`, `partition_id`)
|
||||
# ) TABLE_ID={0} DEFAULT CHARSET = utf8mb4 ROW_FORMAT = COMPACT COMPRESSION = 'none' REPLICA_NUM = 1 BLOCK_SIZE = 16384 USE_BLOOM_FILTER = FALSE TABLET_SIZE = 134217728 PCTFREE = 10 TABLEGROUP = 'oceanbase' """.format(table_id)
|
||||
# @staticmethod
|
||||
# def get_each_tenant_rollback_sql(tenant_id):
|
||||
# return """select 1"""
|
||||
# def dump_after_do_each_tenant_action(self, tenant_id):
|
||||
# my_utils.query_and_dump_results(self._query_cursor, """select tenant_id, table_id, table_name from {0} where table_name = '__all_kv_ttl_task_history' and tenant_id = {1}""".format(self.get_all_table_name(), tenant_id))
|
||||
# def check_after_do_each_tenant_action(self, tenant_id):
|
||||
# (desc, results) = self._query_cursor.exec_query("""select tenant_id, table_id, table_name from {0} where table_name = '__all_kv_ttl_task_history' and tenant_id = {1}""".format(self.get_all_table_name(), tenant_id))
|
||||
# if len(results) != 1:
|
||||
# raise MyError('tenant_id:{0} create table __all_kv_ttl_task_history failed'.format(tenant_id))
|
||||
# def dump_after_do_action(self):
|
||||
# my_utils.query_and_dump_results(self._query_cursor, """select tenant_id, table_id, table_name from {0} where table_name = '__all_kv_ttl_task_history'""".format(self.get_all_table_name()))
|
||||
# def check_after_do_action(self):
|
||||
# (desc, results) = self._query_cursor.exec_query("""select tenant_id, table_id, table_name from {0} where table_name = '__all_kv_ttl_task_history'""".format(self.get_all_table_name()))
|
||||
# if len(results) != len(self.get_tenant_id_list()):
|
||||
# raise MyError('there should be {0} rows in {1} whose table_name is __all_kv_ttl_task_history, but there has {2} rows like that'.format(len(self.get_tenant_id_list()), self.get_all_table_name(), len(results)))
|
||||
#####========******####========= actions end =========####******========####
|
||||
#
|
||||
#def do_each_tenant_ddl_actions(cur, tenant_id_list):
|
||||
|
Reference in New Issue
Block a user