create table simba_mutex( mutex varchar(66) not null primary key comment 'mutex name', acquired_at bigint unsigned not null, ttl_at bigint unsigned not null, transition_at bigint unsigned not null, owner_id char(32) not null, version int unsigned not null);create table if not exists cosid_machine( name varchar(100) not null comment '{namespace}.{machine_id}', namespace varchar(100) not null, machine_id integer not null default 0, last_timestamp bigint not null default 0, instance_id varchar(100) not null default '', distribute_time bigint not null default 0, revert_time bigint not null default 0, constraint cosid_machine_pk primary key (name)) engine = InnoDB;create index if not exists idx_namespace on cosid_machine (namespace);create index if not exists idx_instance_id on cosid_machine (instance_id);create table publish_event( id bigint unsigned auto_increment primary key, event_name varchar(100) not null, event_data_id bigint unsigned default 0 not null, event_data mediumtext not null, status smallint unsigned not null, published_time bigint unsigned default 0 not null, version smallint unsigned not null, create_time bigint unsigned not null);create index idx_status on publish_event (status);create table publish_event_compensate( id bigint unsigned auto_increment primary key, publish_event_id bigint unsigned not null, start_time bigint unsigned not null, taken bigint unsigned not null, failed_msg text null);create table publish_event_failed( id bigint unsigned auto_increment primary key, publish_event_id bigint unsigned not null, failed_msg text not null, create_time bigint unsigned not null);create table subscribe_event( id bigint unsigned auto_increment primary key, subscribe_name varchar(100) not null, status smallint unsigned not null, subscribe_time bigint unsigned not null, event_id bigint unsigned not null, event_name varchar(100) not null, event_data_id bigint unsigned default 0 not null, event_data mediumtext not null, event_create_time bigint unsigned not null, version smallint unsigned not null, create_time bigint unsigned not null, constraint uk_subscribe_name_even_id_event_name unique (subscribe_name, event_id, event_name));create index idx_status on subscribe_event (status);create table subscribe_event_compensate( id bigint unsigned auto_increment primary key, subscribe_event_id bigint unsigned not null, start_time bigint unsigned not null, taken int unsigned not null, failed_msg text null);create table subscribe_event_failed( id bigint unsigned auto_increment primary key, subscribe_event_id bigint unsigned not null, failed_msg text not null, create_time bigint unsigned not null);insert into simba_mutex (mutex, acquired_at, ttl_at, transition_at, owner_id, version)values ('eventbus_publish_leader', 0, 0, 0, '', 0);insert into simba_mutex (mutex, acquired_at, ttl_at, transition_at, owner_id, version)values ('eventbus_subscribe_leader', 0, 0, 0, '', 0);
请发表评论