Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rsc: Create indexes for outputs(job_id) #1633

Merged
merged 1 commit into from
Aug 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
}
}
Loading