@@ -20,9 +20,7 @@ use self::error::{CreateStreamError, StreamError};
2020use super :: cluster:: utils:: { merge_quried_stats, IngestionStats , QueriedStats , StorageStats } ;
2121use super :: cluster:: { sync_streams_with_ingestors, INTERNAL_STREAM_NAME } ;
2222use super :: ingest:: create_stream_if_not_exists;
23- use super :: modal:: utils:: logstream_utils:: {
24- create_stream_and_schema_from_storage, create_update_stream, update_first_event_at,
25- } ;
23+ use super :: modal:: utils:: logstream_utils:: { create_update_stream, update_first_event_at} ;
2624use super :: query:: update_schema_when_distributed;
2725use crate :: alerts:: Alerts ;
2826use crate :: event:: format:: { override_data_type, LogSource } ;
@@ -31,6 +29,7 @@ use crate::hottier::{HotTierManager, StreamHotTier, CURRENT_HOT_TIER_VERSION};
3129use crate :: metadata:: { SchemaVersion , STREAM_INFO } ;
3230use crate :: metrics:: { EVENTS_INGESTED_DATE , EVENTS_INGESTED_SIZE_DATE , EVENTS_STORAGE_SIZE_DATE } ;
3331use crate :: option:: { Mode , CONFIG } ;
32+ use crate :: parseable:: PARSEABLE ;
3433use crate :: rbac:: role:: Action ;
3534use crate :: rbac:: Users ;
3635use crate :: stats:: { event_labels_date, storage_size_labels_date, Stats } ;
@@ -138,7 +137,10 @@ pub async fn schema(stream_name: Path<String>) -> Result<impl Responder, StreamE
138137 match STREAM_INFO . schema ( & stream_name) {
139138 Ok ( _) => { }
140139 Err ( _) if CONFIG . options . mode == Mode :: Query => {
141- if !create_stream_and_schema_from_storage ( & stream_name) . await ? {
140+ if !PARSEABLE
141+ . create_stream_and_schema_from_storage ( & stream_name)
142+ . await ?
143+ {
142144 return Err ( StreamError :: StreamNotFound ( stream_name. clone ( ) ) ) ;
143145 }
144146 }
@@ -225,7 +227,10 @@ pub async fn put_alert(
225227 //check if it exists in the storage
226228 //create stream and schema from storage
227229 if CONFIG . options . mode == Mode :: Query {
228- match create_stream_and_schema_from_storage ( & stream_name) . await {
230+ match PARSEABLE
231+ . create_stream_and_schema_from_storage ( & stream_name)
232+ . await
233+ {
229234 Ok ( true ) => { }
230235 Ok ( false ) | Err ( _) => return Err ( StreamError :: StreamNotFound ( stream_name. clone ( ) ) ) ,
231236 }
@@ -273,7 +278,10 @@ pub async fn get_retention(stream_name: Path<String>) -> Result<impl Responder,
273278 //check if it exists in the storage
274279 //create stream and schema from storage
275280 if CONFIG . options . mode == Mode :: Query {
276- match create_stream_and_schema_from_storage ( & stream_name) . await {
281+ match PARSEABLE
282+ . create_stream_and_schema_from_storage ( & stream_name)
283+ . await
284+ {
277285 Ok ( true ) => { }
278286 Ok ( false ) | Err ( _) => return Err ( StreamError :: StreamNotFound ( stream_name. clone ( ) ) ) ,
279287 }
@@ -306,7 +314,10 @@ pub async fn put_retention(
306314 //check if it exists in the storage
307315 //create stream and schema from storage
308316 if CONFIG . options . mode == Mode :: Query {
309- match create_stream_and_schema_from_storage ( & stream_name) . await {
317+ match PARSEABLE
318+ . create_stream_and_schema_from_storage ( & stream_name)
319+ . await
320+ {
310321 Ok ( true ) => { }
311322 Ok ( false ) | Err ( _) => return Err ( StreamError :: StreamNotFound ( stream_name. clone ( ) ) ) ,
312323 }
@@ -371,7 +382,10 @@ pub async fn get_stats(
371382 //check if it exists in the storage
372383 //create stream and schema from storage
373384 if cfg ! ( not( test) ) && CONFIG . options . mode == Mode :: Query {
374- match create_stream_and_schema_from_storage ( & stream_name) . await {
385+ match PARSEABLE
386+ . create_stream_and_schema_from_storage ( & stream_name)
387+ . await
388+ {
375389 Ok ( true ) => { }
376390 Ok ( false ) | Err ( _) => return Err ( StreamError :: StreamNotFound ( stream_name. clone ( ) ) ) ,
377391 }
@@ -541,7 +555,10 @@ pub async fn get_stream_info(stream_name: Path<String>) -> Result<impl Responder
541555 let stream_name = stream_name. into_inner ( ) ;
542556 if !STREAM_INFO . stream_exists ( & stream_name) {
543557 if CONFIG . options . mode == Mode :: Query {
544- match create_stream_and_schema_from_storage ( & stream_name) . await {
558+ match PARSEABLE
559+ . create_stream_and_schema_from_storage ( & stream_name)
560+ . await
561+ {
545562 Ok ( true ) => { }
546563 Ok ( false ) | Err ( _) => return Err ( StreamError :: StreamNotFound ( stream_name. clone ( ) ) ) ,
547564 }
@@ -594,7 +611,10 @@ pub async fn put_stream_hot_tier(
594611 //check if it exists in the storage
595612 //create stream and schema from storage
596613 if CONFIG . options . mode == Mode :: Query {
597- match create_stream_and_schema_from_storage ( & stream_name) . await {
614+ match PARSEABLE
615+ . create_stream_and_schema_from_storage ( & stream_name)
616+ . await
617+ {
598618 Ok ( true ) => { }
599619 Ok ( false ) | Err ( _) => return Err ( StreamError :: StreamNotFound ( stream_name. clone ( ) ) ) ,
600620 }
@@ -646,7 +666,10 @@ pub async fn get_stream_hot_tier(stream_name: Path<String>) -> Result<impl Respo
646666 //check if it exists in the storage
647667 //create stream and schema from storage
648668 if CONFIG . options . mode == Mode :: Query {
649- match create_stream_and_schema_from_storage ( & stream_name) . await {
669+ match PARSEABLE
670+ . create_stream_and_schema_from_storage ( & stream_name)
671+ . await
672+ {
650673 Ok ( true ) => { }
651674 Ok ( false ) | Err ( _) => return Err ( StreamError :: StreamNotFound ( stream_name. clone ( ) ) ) ,
652675 }
@@ -673,7 +696,10 @@ pub async fn delete_stream_hot_tier(
673696 //check if it exists in the storage
674697 //create stream and schema from storage
675698 if CONFIG . options . mode == Mode :: Query {
676- match create_stream_and_schema_from_storage ( & stream_name) . await {
699+ match PARSEABLE
700+ . create_stream_and_schema_from_storage ( & stream_name)
701+ . await
702+ {
677703 Ok ( true ) => { }
678704 Ok ( false ) | Err ( _) => return Err ( StreamError :: StreamNotFound ( stream_name. clone ( ) ) ) ,
679705 }
0 commit comments