Skip to content

Commit 8d3ab29

Browse files
authored
feat: distributed Implementation of the Parseable Server (#656)
This PR contains the ingester side changes
1 parent 81b58dd commit 8d3ab29

26 files changed

+2128
-1002
lines changed

server/src/about.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -90,10 +90,10 @@ pub fn print_about(
9090
eprint!(
9191
"
9292
{}
93-
Version: \"v{}\"",
93+
Version:\t\t\t\t\t\"v{}\"",
9494
"About:".to_string().bold(),
9595
current_version,
96-
);
96+
); // " " " "
9797

9898
if let Some(latest_release) = latest_release {
9999
if latest_release.version > current_version {
@@ -103,8 +103,8 @@ pub fn print_about(
103103

104104
eprintln!(
105105
"
106-
Commit: \"{commit_hash}\"
107-
Docs: \"https://logg.ing/docs\""
106+
Commit:\t\t\t\t\t\t\"{commit_hash}\"
107+
Docs:\t\t\t\t\t\t\"https://logg.ing/docs\""
108108
);
109109
}
110110

server/src/analytics.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ impl Report {
9090
cpu_count,
9191
memory_total_bytes: mem_total,
9292
platform: platform().to_string(),
93-
mode: CONFIG.mode_string().to_string(),
93+
mode: CONFIG.get_storage_mode_string().to_string(),
9494
version: current().released_version.to_string(),
9595
commit_hash: current().commit_hash,
9696
metrics: build_metrics(),

server/src/banner.rs

Lines changed: 17 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -35,13 +35,13 @@ pub async fn print(config: &Config, meta: &StorageMetadata) {
3535

3636
fn print_ascii_art() {
3737
let ascii_name = r#"
38-
`7MM"""Mq. *MM `7MM
39-
MM `MM. MM MM
40-
MM ,M9 ,6"Yb. `7Mb,od8 ,pP"Ybd .gP"Ya ,6"Yb. MM,dMMb. MM .gP"Ya
41-
MMmmdM9 8) MM MM' "' 8I `" ,M' Yb 8) MM MM `Mb MM ,M' Yb
42-
MM ,pm9MM MM `YMMMa. 8M"""""" ,pm9MM MM M8 MM 8M""""""
43-
MM 8M MM MM L. I8 YM. , 8M MM MM. ,M9 MM YM. ,
44-
.JMML. `Moo9^Yo..JMML. M9mmmP' `Mbmmd' `Moo9^Yo. P^YbmdP' .JMML. `Mbmmd'
38+
`7MM"""Mq. *MM `7MM
39+
MM `MM. MM MM
40+
MM ,M9 ,6"Yb. `7Mb,od8 ,pP"Ybd .gP"Ya ,6"Yb. MM,dMMb. MM .gP"Ya
41+
MMmmdM9 8) MM MM' "' 8I `" ,M' Yb 8) MM MM `Mb MM ,M' Yb
42+
MM ,pm9MM MM `YMMMa. 8M"""""" ,pm9MM MM M8 MM 8M""""""
43+
MM 8M MM MM L. I8 YM. , 8M MM MM. ,M9 MM YM. ,
44+
.JMML. `Moo9^Yo..JMML. M9mmmP' `Mbmmd' `Moo9^Yo. P^YbmdP' .JMML. `Mbmmd'
4545
"#;
4646

4747
eprint!("{ascii_name}");
@@ -77,12 +77,14 @@ fn status_info(config: &Config, scheme: &str, id: Uid) {
7777
eprintln!(
7878
"
7979
{}
80-
Address: {}
81-
Credentials: {}
82-
LLM Status: \"{}\"",
80+
Address:\t\t\t\t\t{}
81+
Credentials:\t\t\t\t\t{}
82+
Server Mode:\t\t\t\t\t\"{}\"
83+
LLM Status:\t\t\t\t\t\"{}\"",
8384
"Server:".to_string().bold(),
8485
address,
8586
credentials,
87+
config.parseable.mode.to_str(),
8688
llm_status
8789
);
8890
}
@@ -99,10 +101,10 @@ async fn storage_info(config: &Config) {
99101
eprintln!(
100102
"
101103
{}
102-
Mode: \"{}\"
103-
Staging: \"{}\"",
104+
Storage Mode:\t\t\t\t\t\"{}\"
105+
Staging Path:\t\t\t\t\t\"{}\"",
104106
"Storage:".to_string().bold(),
105-
config.mode_string(),
107+
config.get_storage_mode_string(),
106108
config.staging_dir().to_string_lossy(),
107109
);
108110

@@ -114,7 +116,7 @@ async fn storage_info(config: &Config) {
114116

115117
eprintln!(
116118
"\
117-
{:8}Cache: \"{}\", (size: {})",
119+
{:8}Cache:\t\t\t\t\t\"{}\", (size: {})",
118120
"",
119121
path.display(),
120122
size
@@ -123,7 +125,7 @@ async fn storage_info(config: &Config) {
123125

124126
eprintln!(
125127
"\
126-
{:8}Store: \"{}\", (latency: {:?})",
128+
{:8}Store:\t\t\t\t\t\t\"{}\", (latency: {:?})",
127129
"",
128130
storage.get_endpoint(),
129131
latency

server/src/catalog.rs

Lines changed: 61 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,8 @@ use relative_path::RelativePathBuf;
2424
use crate::{
2525
catalog::manifest::Manifest,
2626
query::PartialTimeFilter,
27-
storage::{ObjectStorage, ObjectStorageError},
27+
storage::{ObjectStorage, ObjectStorageError, MANIFEST_FILE},
28+
utils::get_address,
2829
};
2930

3031
use self::{column::Column, snapshot::ManifestItem};
@@ -105,20 +106,67 @@ pub async fn update_snapshot(
105106
item.time_lower_bound <= lower_bound && lower_bound < item.time_upper_bound
106107
});
107108

109+
// if the mode in I.S. manifest needs to be created but it is not getting created because
110+
// there is already a pos, to index into stream.json
111+
108112
// We update the manifest referenced by this position
109113
// This updates an existing file so there is no need to create a snapshot entry.
110114
if let Some(pos) = pos {
111115
let info = &mut manifests[pos];
112116
let path = partition_path(stream_name, info.time_lower_bound, info.time_upper_bound);
113-
let Some(mut manifest) = storage.get_manifest(&path).await? else {
114-
return Err(ObjectStorageError::UnhandledError(
115-
"Manifest found in snapshot but not in object-storage"
116-
.to_string()
117-
.into(),
118-
));
119-
};
120-
manifest.apply_change(change);
121-
storage.put_manifest(&path, manifest).await?;
117+
118+
let mut ch = false;
119+
for m in manifests.iter() {
120+
let s = get_address();
121+
let p = format!("{}.{}.{}", s.0, s.1, MANIFEST_FILE);
122+
if m.manifest_path.contains(&p) {
123+
ch = true;
124+
}
125+
}
126+
if ch {
127+
let Some(mut manifest) = storage.get_manifest(&path).await? else {
128+
return Err(ObjectStorageError::UnhandledError(
129+
"Manifest found in snapshot but not in object-storage"
130+
.to_string()
131+
.into(),
132+
));
133+
};
134+
manifest.apply_change(change);
135+
storage.put_manifest(&path, manifest).await?;
136+
} else {
137+
let lower_bound = lower_bound.date_naive().and_time(NaiveTime::MIN).and_utc();
138+
let upper_bound = lower_bound
139+
.date_naive()
140+
.and_time(
141+
NaiveTime::from_num_seconds_from_midnight_opt(
142+
23 * 3600 + 59 * 60 + 59,
143+
999_999_999,
144+
)
145+
.unwrap(),
146+
)
147+
.and_utc();
148+
149+
let manifest = Manifest {
150+
files: vec![change],
151+
..Manifest::default()
152+
};
153+
154+
let addr = get_address();
155+
let mainfest_file_name = format!("{}.{}.{}", addr.0, addr.1, MANIFEST_FILE);
156+
let path =
157+
partition_path(stream_name, lower_bound, upper_bound).join(&mainfest_file_name);
158+
storage
159+
.put_object(&path, serde_json::to_vec(&manifest).unwrap().into())
160+
.await?;
161+
let path = storage.absolute_url(&path);
162+
let new_snapshot_entriy = snapshot::ManifestItem {
163+
manifest_path: path.to_string(),
164+
time_lower_bound: lower_bound,
165+
time_upper_bound: upper_bound,
166+
};
167+
manifests.push(new_snapshot_entriy);
168+
storage.put_snapshot(stream_name, meta).await?;
169+
}
122170
} else {
123171
let lower_bound = lower_bound.date_naive().and_time(NaiveTime::MIN).and_utc();
124172
let upper_bound = lower_bound
@@ -137,7 +185,9 @@ pub async fn update_snapshot(
137185
..Manifest::default()
138186
};
139187

140-
let path = partition_path(stream_name, lower_bound, upper_bound).join("manifest.json");
188+
let addr = get_address();
189+
let mainfest_file_name = format!("{}.{}.{}", addr.0, addr.1, MANIFEST_FILE);
190+
let path = partition_path(stream_name, lower_bound, upper_bound).join(&mainfest_file_name);
141191
storage
142192
.put_object(&path, serde_json::to_vec(&manifest).unwrap().into())
143193
.await?;

0 commit comments

Comments
 (0)