@@ -21,14 +21,10 @@ use std::{
2121 collections:: { HashMap , HashSet } ,
2222 num:: NonZeroU32 ,
2323 path:: PathBuf ,
24- str:: FromStr ,
2524 sync:: { Arc , LazyLock , RwLock } ,
2625} ;
2726
28- use actix_web:: http:: {
29- StatusCode ,
30- header:: { CONTENT_TYPE , HeaderMap , HeaderName , HeaderValue } ,
31- } ;
27+ use actix_web:: http:: { StatusCode , header:: HeaderMap } ;
3228use arrow_schema:: { Field , Schema } ;
3329use bytes:: Bytes ;
3430use chrono:: Utc ;
@@ -53,12 +49,10 @@ use crate::{
5349 format:: { LogSource , LogSourceEntry } ,
5450 } ,
5551 handlers:: {
56- DatasetTag , STREAM_TYPE_KEY , TelemetryType ,
52+ DatasetTag , TelemetryType ,
5753 http:: {
58- cluster:: { PMETA_STREAM_NAME , sync_streams_with_ingestors} ,
5954 ingest:: PostError ,
6055 logstream:: error:: { CreateStreamError , StreamError } ,
61- middleware:: { CLUSTER_SECRET , CLUSTER_SECRET_HEADER } ,
6256 modal:: {
6357 ingest_server:: INGESTOR_META ,
6458 utils:: { logstream_utils:: PutStreamHeaders , rbac_utils:: get_metadata} ,
@@ -570,72 +564,6 @@ impl Parseable {
570564 Ok ( true )
571565 }
572566
573- pub async fn create_internal_stream_if_not_exists ( & self ) -> Result < ( ) , StreamError > {
574- let log_source_entry = LogSourceEntry :: new ( LogSource :: Pmeta , HashSet :: new ( ) ) ;
575- let tenants = if let Some ( tenants) = PARSEABLE . list_tenants ( ) {
576- tenants. into_iter ( ) . map ( Some ) . collect ( )
577- } else {
578- vec ! [ None ]
579- } ;
580- for tenant_id in tenants {
581- let internal_stream_result = self
582- . create_stream_if_not_exists (
583- PMETA_STREAM_NAME ,
584- StreamType :: Internal ,
585- None ,
586- vec ! [ log_source_entry. clone( ) ] ,
587- TelemetryType :: Logs ,
588- & tenant_id,
589- vec ! [ ] ,
590- vec ! [ ] ,
591- )
592- . await ;
593-
594- // Check if either stream creation failed
595- if let Err ( e) = & internal_stream_result {
596- tracing:: error!( "Failed to create pmeta stream: {:?}" , e) ;
597- }
598-
599- // Check if both streams already existed
600- if matches ! ( internal_stream_result, Ok ( true ) ) {
601- continue ;
602- }
603-
604- let mut header_map = HeaderMap :: new ( ) ;
605- header_map. insert (
606- HeaderName :: from_str ( STREAM_TYPE_KEY ) . unwrap ( ) ,
607- HeaderValue :: from_str ( & StreamType :: Internal . to_string ( ) ) . unwrap ( ) ,
608- ) ;
609- header_map. insert ( CONTENT_TYPE , HeaderValue :: from_static ( "application/json" ) ) ;
610-
611- if let Some ( ( _, hash) ) = CLUSTER_SECRET . get ( ) {
612- header_map. insert (
613- HeaderName :: from_static ( CLUSTER_SECRET_HEADER ) ,
614- HeaderValue :: from_str ( hash) . unwrap ( ) ,
615- ) ;
616- header_map. insert (
617- HeaderName :: from_static ( "intra-cluster-tenant" ) ,
618- HeaderValue :: from_str ( tenant_id. as_deref ( ) . unwrap_or ( DEFAULT_TENANT ) ) . unwrap ( ) ,
619- ) ;
620- }
621-
622- // Sync only the streams that were created successfully
623- if matches ! ( internal_stream_result, Ok ( false ) )
624- && let Err ( e) = sync_streams_with_ingestors (
625- header_map. clone ( ) ,
626- Bytes :: new ( ) ,
627- PMETA_STREAM_NAME ,
628- & tenant_id,
629- )
630- . await
631- {
632- tracing:: error!( "Failed to sync pmeta stream with ingestors: {:?}" , e) ;
633- }
634- }
635-
636- Ok ( ( ) )
637- }
638-
639567 // Check if the stream exists and create a new stream if doesn't exist
640568 #[ allow( clippy:: too_many_arguments) ]
641569 pub async fn create_stream_if_not_exists (
0 commit comments