Skip to content

Commit

Permalink
rsc: Create indexes for outputs(job_id) (#1633)
Browse files Browse the repository at this point in the history
  • Loading branch information
V-FEXrt authored Aug 20, 2024
1 parent 835d80a commit 20dd7c3
Show file tree
Hide file tree
Showing 3 changed files with 77 additions and 3 deletions.
2 changes: 2 additions & 0 deletions rust/migration/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ mod m20240522_185420_create_job_history;
mod m20240731_152842_create_job_size_proc;
mod m20240731_201632_create_job_blob_timestamp_index;
mod m20240805_163520_create_blob_id_fk_indexes;
mod m20240819_193352_add_output_indexes;

pub struct Migrator;

Expand All @@ -33,6 +34,7 @@ impl MigratorTrait for Migrator {
Box::new(m20240731_152842_create_job_size_proc::Migration),
Box::new(m20240731_201632_create_job_blob_timestamp_index::Migration),
Box::new(m20240805_163520_create_blob_id_fk_indexes::Migration),
Box::new(m20240819_193352_add_output_indexes::Migration),
]
}
}
72 changes: 72 additions & 0 deletions rust/migration/src/m20240819_193352_add_output_indexes.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
use sea_orm_migration::prelude::*;

#[derive(DeriveMigrationName)]
pub struct Migration;

#[async_trait::async_trait]
impl MigrationTrait for Migration {
async fn up(&self, manager: &SchemaManager) -> Result<(), DbErr> {
manager
.get_connection()
.execute_unprepared(
"
CREATE INDEX IF NOT EXISTS output_file_job_id_idx
ON output_file(job_id)
",
)
.await?;

manager
.get_connection()
.execute_unprepared(
"
CREATE INDEX IF NOT EXISTS output_dir_job_id_idx
ON output_dir(job_id)
",
)
.await?;

manager
.get_connection()
.execute_unprepared(
"
CREATE INDEX IF NOT EXISTS output_symlink_job_id_idx
ON output_symlink(job_id)
",
)
.await?;

Ok(())
}

async fn down(&self, manager: &SchemaManager) -> Result<(), DbErr> {
manager
.get_connection()
.execute_unprepared(
"
DROP INDEX IF EXISTS output_file_job_id_idx
",
)
.await?;

manager
.get_connection()
.execute_unprepared(
"
DROP INDEX IF EXISTS output_dir_job_id_idx
",
)
.await?;

manager
.get_connection()
.execute_unprepared(
"
DROP INDEX IF EXISTS output_symlink_job_id_idx
",
)
.await?;

Ok(())
}
}
6 changes: 3 additions & 3 deletions rust/rsc/.config.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"server_address": "0.0.0.0:3002",
"connection_pool_timeout": 60,
"standalone": false,
"active_store": "ad834497-92f8-438e-91b7-9b54108d8ea5",
"active_store": "5eed6ba4-d65f-46ca-b4a6-eff98b00857d",
"log_directory": null,
"blob_eviction": {
"tick_rate": 60,
Expand All @@ -23,7 +23,7 @@
},
"load_shed": {
"tick_rate": 30,
"target": 16.0,
"min_runtime": 0.1
"target": 80.0,
"min_runtime": 0.5
}
}

0 comments on commit 20dd7c3

Please sign in to comment.