All Downloads are FREE. Search and download functionalities are using the official Maven repository.

db.changelog.db.tw-tasks-mysql-random-uuids.xml Maven / Gradle / Ivy

The newest version!




  
    
      This form is much better for cases where the application can not keep the UUIDs sequential. For example when Kafka messages are coming in
      with random UUIDs.
      The trick here is to create a sequential primary key index. So unordered unique index will have issues but with very large datasets not
      realistic in Transferwise.
    
    
      CREATE TABLE tw_task (
      aid BIGINT NOT NULL PRIMARY KEY AUTO_INCREMENT,
      id BINARY(16) NOT NULL,
      status ENUM('NEW', 'WAITING', 'SUBMITTED', 'PROCESSING', 'DONE', 'ERROR', 'FAILED'),
      -- Microsecond precision (6) is strongly recommended here to reduce the chance of gap locks deadlocking on tw_task_idx1
      next_event_time DATETIME(6) NOT NULL,
      state_time DATETIME(3) NOT NULL,
      version BIGINT NOT NULL,
      priority INT NOT NULL DEFAULT 5,
      processing_start_time DATETIME(3) NULL,
      processing_tries_count BIGINT NOT NULL,
      time_created DATETIME(3) NOT NULL,
      time_updated DATETIME(3) NOT NULL,
      type VARCHAR(250) CHARACTER SET latin1 NOT NULL,
      sub_type VARCHAR(250) CHARACTER SET latin1 NULL,
      processing_client_id VARCHAR(250) CHARACTER SET latin1 NULL,
      data LONGTEXT NOT NULL);

      CREATE INDEX tw_task_idx1 ON tw_task (status, next_event_time);
      CREATE UNIQUE INDEX tw_task_idx2 ON tw_task (id);
      );
    
  





© 2015 - 2024 Weber Informatics LLC | Privacy Policy