mononoke: bring long_running_request_queue in sync with what we have in prod

Reviewed By: krallin

Differential Revision: D29817070

fbshipit-source-id: 37b029e74c54df7ff5a7bd4a1c8ef3f85fff127c
This commit is contained in:
Stanislau Hlebik 2021-07-27 14:11:42 -07:00 committed by Facebook GitHub Bot
parent 871316b597
commit 3b7d6bdfae
2 changed files with 13 additions and 8 deletions

View File

@ -184,6 +184,7 @@ mod tests {
use super::*;
use context::CoreContext;
use fbinit::FacebookInit;
use mononoke_types::Timestamp;
use requests_table::{ClaimedBy, RequestStatus};
use source_control::{
@ -230,9 +231,9 @@ mod tests {
.await?
.expect("Request is mising in the DB");
assert_eq!(entry.status, RequestStatus::New);
assert_eq!(entry.started_processing_at, None);
assert_eq!(entry.ready_at, None);
assert_eq!(entry.polled_at, None);
assert_eq!(entry.started_processing_at, Some(Timestamp::from_timestamp_secs(0)));
assert_eq!(entry.ready_at, Some(Timestamp::from_timestamp_secs(0)));
assert_eq!(entry.polled_at, Some(Timestamp::from_timestamp_secs(0)));
assert_eq!(entry.repo_id, RepositoryId::new(0));
assert_eq!(
entry.request_type,

View File

@ -8,14 +8,18 @@
CREATE TABLE long_running_request_queue (
`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,
`repo_id` INTEGER NOT NULL,
`bookmark` VARBINARY NOT NULL,
`bookmark` VARCHAR(512) NOT NULL,
`request_type` varchar(255) NOT NULL,
`args_blobstore_key` varchar(255) NOT NULL,
`result_blobstore_key` varchar(255) DEFAULT NULL,
`created_at` bigint(20) NOT NULL DEFAULT '0',
`started_processing_at` bigint(20) DEFAULT NULL,
`ready_at` bigint(20) DEFAULT NULL,
`polled_at` bigint(20) DEFAULT NULL,
`created_at` bigint(20) NOT NULL,
`started_processing_at` bigint(20) NOT NULL DEFAULT 0,
`ready_at` bigint(20) NOT NULL DEFAULT 0,
`polled_at` bigint(20) NOT NULL DEFAULT 0,
`status` VARCHAR(32) NOT NULL, -- enum('new','in_progress','ready','polled') NOT NULL DEFAULT 'new',
`claimed_by` VARCHAR(255) NULL
);
CREATE INDEX `request_status` ON long_running_request_queue (`status`, `request_type`);
CREATE INDEX `request_creation` ON long_running_request_queue (`created_at`);
CREATE INDEX `request_dequeue` ON long_running_request_queue (`status`, `repo_id`, `created_at`);