File tree Expand file tree Collapse file tree 3 files changed +35
-1
lines changed Expand file tree Collapse file tree 3 files changed +35
-1
lines changed Original file line number Diff line number Diff line change @@ -33,6 +33,7 @@ use crate::storage::object_storage::ingestor_metadata_path;
33
33
use crate :: storage:: object_storage:: parseable_json_path;
34
34
use crate :: storage:: staging;
35
35
use crate :: storage:: ObjectStorageError ;
36
+ use crate :: storage:: StorageMetadata ;
36
37
use crate :: sync;
37
38
38
39
use super :: server:: Server ;
@@ -276,7 +277,24 @@ impl IngestServer {
276
277
let path = parseable_json_path ( ) ;
277
278
278
279
match store. get_object ( & path) . await {
279
- Ok ( _) => Ok ( ( ) ) ,
280
+ Ok ( bytes) => {
281
+ let size = serde_json:: from_slice :: < StorageMetadata > ( & bytes) ?. hot_tier_capacity ;
282
+ let hot_tier_enabled = CONFIG . is_hot_tier_active ( ) ;
283
+ match size {
284
+ Some ( size) => {
285
+ if hot_tier_enabled && CONFIG . parseable . local_cache_size != size {
286
+ return Err ( ObjectStorageError :: Custom ( "Hot Tier Capacity does not match with Other Nodes. Please check the hot tier capacity and try again." ) ) ;
287
+ }
288
+ }
289
+ None => {
290
+ if hot_tier_enabled {
291
+ return Err ( ObjectStorageError :: Custom ( "Hot Tier is active on Current Node but disabled on Other Nodes. Please set hot tier and try again." ) ) ;
292
+ }
293
+ }
294
+ }
295
+ // fall through
296
+ Ok ( ( ) )
297
+ }
280
298
Err ( _) => Err ( ObjectStorageError :: Custom (
281
299
"Query Server has not been started yet. Please start the querier server first."
282
300
,
Original file line number Diff line number Diff line change @@ -121,6 +121,14 @@ pub fn update_v3(mut storage_metadata: JsonValue) -> JsonValue {
121
121
) ;
122
122
}
123
123
124
+ let hot_tier_capacity = metadata. get ( "hot_tier_capacity" ) ;
125
+ if hot_tier_capacity. is_none ( ) {
126
+ metadata. insert (
127
+ "hot_tier_capacity" . to_string ( ) ,
128
+ JsonValue :: Bool ( CONFIG . is_hot_tier_active ( ) ) ,
129
+ ) ;
130
+ }
131
+
124
132
storage_metadata
125
133
}
126
134
Original file line number Diff line number Diff line change @@ -61,10 +61,17 @@ pub struct StorageMetadata {
61
61
pub roles : HashMap < String , Vec < DefaultPrivilege > > ,
62
62
#[ serde( default ) ]
63
63
pub default_role : Option < String > ,
64
+ pub hot_tier_capacity : Option < u64 > ,
64
65
}
65
66
66
67
impl StorageMetadata {
67
68
pub fn new ( ) -> Self {
69
+ let hot_tier_capacity = if CONFIG . is_hot_tier_active ( ) {
70
+ Some ( CONFIG . parseable . local_cache_size )
71
+ } else {
72
+ None
73
+ } ;
74
+
68
75
Self {
69
76
version : "v3" . to_string ( ) ,
70
77
mode : CONFIG . storage_name . to_owned ( ) ,
@@ -76,6 +83,7 @@ impl StorageMetadata {
76
83
streams : Vec :: new ( ) ,
77
84
roles : HashMap :: default ( ) ,
78
85
default_role : None ,
86
+ hot_tier_capacity,
79
87
}
80
88
}
81
89
You can’t perform that action at this time.
0 commit comments