WIP
This commit is contained in:
@@ -67,6 +67,22 @@ async fn has_column(table: &str, column: &str, pgc: &PgClient) -> Result<bool, E
|
||||
}
|
||||
|
||||
async fn migrate_00(pgc: &PgClient) -> Result<(), Error> {
|
||||
let _ = pgc
|
||||
.execute(
|
||||
"
|
||||
create table if not exists series_by_channel (
|
||||
series bigint not null primary key,
|
||||
facility text not null,
|
||||
channel text not null,
|
||||
scalar_type int not null,
|
||||
shape_dims int[] not null,
|
||||
agg_kind int not null
|
||||
)
|
||||
",
|
||||
&[],
|
||||
)
|
||||
.await;
|
||||
|
||||
if !has_table("ioc_by_channel_log", pgc).await? {
|
||||
let _ = pgc
|
||||
.execute(
|
||||
@@ -134,8 +150,10 @@ async fn migrate_01(pgc: &PgClient) -> Result<(), Error> {
|
||||
}
|
||||
|
||||
pub async fn schema_check(pgc: &PgClient) -> Result<(), Error> {
|
||||
pgc.execute("set client_min_messages = 'warning'", &[]).await?;
|
||||
migrate_00(&pgc).await?;
|
||||
migrate_01(&pgc).await?;
|
||||
pgc.execute("reset client_min_messages", &[]).await?;
|
||||
info!("schema_check done");
|
||||
Ok(())
|
||||
}
|
||||
|
||||
@@ -270,11 +270,11 @@ impl Worker {
|
||||
let mut all_good = true;
|
||||
for h in &mut hashers {
|
||||
let mut good = false;
|
||||
for _ in 0..400 {
|
||||
for _ in 0..800 {
|
||||
h.update(tsbeg.elapsed().subsec_nanos().to_ne_bytes());
|
||||
let f = h.clone().finalize();
|
||||
let series = u64::from_le_bytes(f.as_slice()[0..8].try_into().unwrap());
|
||||
if series >= 100000000000000000 && series <= i64::MAX as u64 {
|
||||
if series >= 1000000000000000000 && series <= i64::MAX as u64 {
|
||||
seriess.push(series as i64);
|
||||
good = true;
|
||||
break;
|
||||
|
||||
Reference in New Issue
Block a user