Skip to content

Commit ef5abe9

Browse files
fix: v7 import does not set meta root (ThinkParQ/beegfs-rs#180)
Recent changes skip setting the root inode on the first meta target when importing v7 data. This made the UPDATE query used to set the meta root silently do nothing since the table is empty. Instead use an INSERT query to add a single row with the given information.
1 parent 99331e2 commit ef5abe9

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

mgmtd/src/db/import_v7.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -313,17 +313,17 @@ fn storage_pools(tx: &Transaction, f: &Path) -> Result<()> {
313313
Ok(())
314314
}
315315

316-
/// Sets the root inode info according to the given info
316+
/// Sets the root inode info according to the given info. Should only be used against a new empty
317+
/// root_inode table with no rows as part of the import process.
317318
fn set_meta_root(tx: &Transaction, root_id: NodeId, root_mirrored: bool) -> Result<()> {
318-
// overwrite root inode with the correct setting
319319
if root_mirrored {
320320
tx.execute(
321-
sql!("UPDATE root_inode SET target_id = NULL, group_id = ?1"),
321+
sql!("INSERT INTO root_inode (target_id, group_id) VALUES (NULL, ?1)"),
322322
[root_id],
323323
)?;
324324
} else {
325325
tx.execute(
326-
sql!("UPDATE root_inode SET group_id = NULL, target_id = ?1"),
326+
sql!("INSERT INTO root_inode (target_id, group_id) VALUES (?1, NULL)"),
327327
[root_id],
328328
)?;
329329
}

0 commit comments

Comments
 (0)