Skip to content

Commit 3809c6d

Browse files
authored
Cleanup: remove state_dir config (#36)
remove state_dir
1 parent fe27d4b commit 3809c6d

20 files changed

+37
-211
lines changed

.dockerignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ target/
55
.gitignore
66
*.db
77
cache/
8-
state/
98
venv/
109
__pycache__/
1110
*.pyc

.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,5 +15,4 @@
1515
# Project-specific
1616
catalog.db*
1717
cache/
18-
state/
1918

config-docker.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,3 @@ type = "filesystem"
1010

1111
[paths]
1212
cache_dir = "/app/cache"
13-
state_dir = "/app/state"

config-local.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,4 +25,3 @@ type = "filesystem"
2525

2626
[paths]
2727
#cache_dir = "~/.hotdata/rivetdb/cache"
28-
#state_dir = "~/.hotdata/rivetdb/state"

src/catalog/backend.rs

Lines changed: 6 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@ where
183183

184184
pub async fn list_tables(&self, connection_id: Option<i32>) -> Result<Vec<TableInfo>> {
185185
let mut sql = String::from(
186-
"SELECT id, connection_id, schema_name, table_name, parquet_path, state_path, \
186+
"SELECT id, connection_id, schema_name, table_name, parquet_path, \
187187
CAST(last_sync AS TEXT) as last_sync, arrow_schema_json \
188188
FROM tables",
189189
);
@@ -210,7 +210,7 @@ where
210210
table_name: &str,
211211
) -> Result<Option<TableInfo>> {
212212
let sql = format!(
213-
"SELECT id, connection_id, schema_name, table_name, parquet_path, state_path, \
213+
"SELECT id, connection_id, schema_name, table_name, parquet_path, \
214214
CAST(last_sync AS TEXT) as last_sync, arrow_schema_json \
215215
FROM tables WHERE connection_id = {} AND schema_name = {} AND table_name = {}",
216216
DB::bind_param(1),
@@ -227,23 +227,16 @@ where
227227
.map_err(Into::into)
228228
}
229229

230-
pub async fn update_table_sync(
231-
&self,
232-
table_id: i32,
233-
parquet_path: &str,
234-
state_path: &str,
235-
) -> Result<()> {
230+
pub async fn update_table_sync(&self, table_id: i32, parquet_path: &str) -> Result<()> {
236231
let sql = format!(
237-
"UPDATE tables SET parquet_path = {}, state_path = {}, last_sync = CURRENT_TIMESTAMP \
232+
"UPDATE tables SET parquet_path = {}, last_sync = CURRENT_TIMESTAMP \
238233
WHERE id = {}",
239234
DB::bind_param(1),
240235
DB::bind_param(2),
241-
DB::bind_param(3),
242236
);
243237

244238
query(&sql)
245239
.bind(parquet_path)
246-
.bind(state_path)
247240
.bind(table_id)
248241
.execute(&self.pool)
249242
.await?;
@@ -263,7 +256,7 @@ where
263256
.ok_or_else(|| anyhow!("Table '{}.{}' not found", schema_name, table_name))?;
264257

265258
let sql = format!(
266-
"UPDATE tables SET parquet_path = NULL, state_path = NULL, last_sync = NULL WHERE id = {}",
259+
"UPDATE tables SET parquet_path = NULL, last_sync = NULL WHERE id = {}",
267260
DB::bind_param(1)
268261
);
269262

@@ -279,7 +272,7 @@ where
279272
.ok_or_else(|| anyhow!("Connection '{}' not found", name))?;
280273

281274
let sql = format!(
282-
"UPDATE tables SET parquet_path = NULL, state_path = NULL, last_sync = NULL \
275+
"UPDATE tables SET parquet_path = NULL, last_sync = NULL \
283276
WHERE connection_id = {}",
284277
DB::bind_param(1)
285278
);

src/catalog/manager.rs

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ pub struct TableInfo {
1919
pub schema_name: String,
2020
pub table_name: String,
2121
pub parquet_path: Option<String>,
22-
pub state_path: Option<String>,
2322
pub last_sync: Option<String>,
2423
pub arrow_schema_json: Option<String>,
2524
}
@@ -54,12 +53,7 @@ pub trait CatalogManager: Debug + Send + Sync {
5453
schema_name: &str,
5554
table_name: &str,
5655
) -> Result<Option<TableInfo>>;
57-
async fn update_table_sync(
58-
&self,
59-
table_id: i32,
60-
parquet_path: &str,
61-
state_path: &str,
62-
) -> Result<()>;
56+
async fn update_table_sync(&self, table_id: i32, parquet_path: &str) -> Result<()>;
6357

6458
/// Clear table cache metadata (set paths to NULL) without deleting files.
6559
async fn clear_table_cache_metadata(

src/catalog/postgres_manager.rs

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,6 @@ impl PostgresCatalogManager {
4242
schema_name TEXT NOT NULL,
4343
table_name TEXT NOT NULL,
4444
parquet_path TEXT,
45-
state_path TEXT,
4645
last_sync TIMESTAMP,
4746
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
4847
arrow_schema_json TEXT,
@@ -146,15 +145,8 @@ impl CatalogManager for PostgresCatalogManager {
146145
.await
147146
}
148147

149-
async fn update_table_sync(
150-
&self,
151-
table_id: i32,
152-
parquet_path: &str,
153-
state_path: &str,
154-
) -> Result<()> {
155-
self.backend
156-
.update_table_sync(table_id, parquet_path, state_path)
157-
.await
148+
async fn update_table_sync(&self, table_id: i32, parquet_path: &str) -> Result<()> {
149+
self.backend.update_table_sync(table_id, parquet_path).await
158150
}
159151

160152
async fn clear_table_cache_metadata(

src/catalog/sqlite_manager.rs

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,6 @@ impl SqliteCatalogManager {
5656
schema_name TEXT NOT NULL,
5757
table_name TEXT NOT NULL,
5858
parquet_path TEXT,
59-
state_path TEXT,
6059
last_sync TIMESTAMP,
6160
arrow_schema_json TEXT,
6261
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
@@ -124,15 +123,8 @@ impl CatalogManager for SqliteCatalogManager {
124123
.await
125124
}
126125

127-
async fn update_table_sync(
128-
&self,
129-
table_id: i32,
130-
parquet_path: &str,
131-
state_path: &str,
132-
) -> Result<()> {
133-
self.backend
134-
.update_table_sync(table_id, parquet_path, state_path)
135-
.await
126+
async fn update_table_sync(&self, table_id: i32, parquet_path: &str) -> Result<()> {
127+
self.backend.update_table_sync(table_id, parquet_path).await
136128
}
137129

138130
async fn clear_table_cache_metadata(

src/config/mod.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,6 @@ pub struct StorageConfig {
4949
#[derive(Debug, Clone, Deserialize, Serialize, Default)]
5050
pub struct PathsConfig {
5151
pub cache_dir: Option<String>,
52-
pub state_dir: Option<String>,
5352
}
5453

5554
impl AppConfig {

src/datafusion/lazy_table_provider.rs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -147,10 +147,7 @@ impl LazyTableProvider {
147147
.get_table(self.connection_id, &self.schema_name, &self.table_name)
148148
.await
149149
{
150-
let _ = self
151-
.catalog
152-
.update_table_sync(info.id, &parquet_url, "")
153-
.await;
150+
let _ = self.catalog.update_table_sync(info.id, &parquet_url).await;
154151
}
155152

156153
Ok(parquet_url)

0 commit comments

Comments
 (0)