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

Resurrect CBOR index handling and migration, update to migrate failed builds #2187

Merged
merged 3 commits into from
Aug 9, 2023
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
3 changes: 3 additions & 0 deletions .cargo/audit.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ ignore = [
"RUSTSEC-2020-0036", # failure is officially deprecated/unmaintained
# https://github.com/rust-lang/docs.rs/issues/1014

"RUSTSEC-2021-0127", # serde_cbor is unmaintained
# https://github.com/rust-lang/docs.rs/issues/1568

"RUSTSEC-2023-0018", # rustwide -> remove_dir_all,TOCTOU / Race Condition
# https://github.com/rust-lang/docs.rs/issues/2074
]
Expand Down
37 changes: 29 additions & 8 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ string_cache = "0.8.0"
postgres-types = { version = "0.2", features = ["derive"] }
zip = {version = "0.6.2", default-features = false, features = ["bzip2"]}
bzip2 = "0.4.4"
serde_cbor = "0.11.1"
getrandom = "0.2.1"
itertools = { version = "0.11.0", optional = true}
rusqlite = { version = "0.29.0", features = ["bundled"] }
Expand All @@ -86,6 +87,7 @@ uuid = "1.1.2"
# Data serialization and deserialization
serde = { version = "1.0", features = ["derive"] }
serde_json = "1.0"
memmap2 = "0.5.0"

# axum dependencies
axum = { version = "0.6.1", features = ["headers"]}
Expand Down
11 changes: 9 additions & 2 deletions src/bin/cratesfyi.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ use docs_rs::utils::{
remove_crate_priority, set_crate_priority, ConfigName,
};
use docs_rs::{
start_background_metrics_webserver, start_web_server, BuildQueue, Config, Context, Index,
InstanceMetrics, PackageKind, RustwideBuilder, ServiceMetrics, Storage,
migrate_old_archive_indexes, start_background_metrics_webserver, start_web_server, BuildQueue,
Config, Context, Index, InstanceMetrics, PackageKind, RustwideBuilder, ServiceMetrics, Storage,
};
use humantime::Duration;
use once_cell::sync::OnceCell;
Expand Down Expand Up @@ -482,6 +482,9 @@ enum DatabaseSubcommand {
/// Backfill GitHub/Gitlab stats for crates.
BackfillRepositoryStats,

/// migrate the old CBOR archive index files to SQLIte
MigrateArchiveIndex,

/// Updates info for a crate from the registry's API
UpdateCrateRegistryFields {
#[arg(name = "CRATE")]
Expand Down Expand Up @@ -533,6 +536,10 @@ impl DatabaseSubcommand {
ctx.repository_stats_updater()?.update_all_crates()?;
}

Self::MigrateArchiveIndex => {
migrate_old_archive_indexes(&*ctx.storage()?, &mut *ctx.conn()?)?;
}

Self::BackfillRepositoryStats => {
ctx.repository_stats_updater()?.backfill_repositories()?;
}
Expand Down
1 change: 1 addition & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ pub use self::docbuilder::PackageKind;
pub use self::docbuilder::RustwideBuilder;
pub use self::index::Index;
pub use self::metrics::{InstanceMetrics, ServiceMetrics};
pub use self::storage::migrate_old_archive_indexes;
pub use self::storage::Storage;
pub use self::web::{start_background_metrics_webserver, start_web_server};

Expand Down
Loading
Loading