Skip to content

Conversation

@xav-db
Copy link
Member

@xav-db xav-db commented Nov 14, 2025

Description

Related Issues

Closes #

Checklist when merging to main

  • No compiler warnings (if applicable)
  • Code is formatted with rustfmt
  • No useless or dead code (if applicable)
  • Code is easy to understand
  • Doc comments are used for all functions, enums, structs, and fields (where appropriate)
  • All tests pass
  • Performance has not regressed (assuming change was not to fix a bug)
  • Version number has been updated in helix-cli/Cargo.toml and helixdb/Cargo.toml

Additional Notes

Greptile Summary

  • Added RocksDB as an alternative storage backend alongside LMDB, making both backends selectable via feature flags with RocksDB now the default
  • Implemented complete RocksDB-based graph storage with column families for nodes, edges, vectors, and HNSW index structures
  • Refactored transaction handling and storage methods to abstract over both LMDB and RocksDB implementations

Important Files Changed

Filename Overview
helix-db/src/helix_engine/traversal_core/mod.rs Added transaction type aliases for RocksDB/LMDB abstraction, changed path parameter to use .leak() which causes memory leak
helix-db/src/helix_engine/storage_core/mod.rs Refactored storage layer to support both LMDB and RocksDB via feature flags, extracted backend-specific code into separate modules
helix-db/src/helix_engine/vector_core/rocks/vector_core.rs New RocksDB implementation of vector storage with HNSW algorithm, includes commented-out filter logic that needs cleanup

Sequence Diagram

sequenceDiagram
    participant User
    participant HelixGraphEngine
    participant HelixGraphStorage
    participant RocksDB
    participant VectorCore
    participant HNSW

    User->>HelixGraphEngine: new(opts)
    HelixGraphEngine->>HelixGraphStorage: new(path, config, version_info)
    HelixGraphStorage->>RocksDB: open TransactionDB with column families
    RocksDB-->>HelixGraphStorage: db instance
    HelixGraphStorage->>VectorCore: new(db, config)
    VectorCore-->>HelixGraphStorage: vector core initialized
    HelixGraphStorage-->>HelixGraphEngine: storage ready
    HelixGraphEngine-->>User: engine ready

    User->>HelixGraphEngine: insert vector
    HelixGraphEngine->>HelixGraphStorage: write_txn()
    HelixGraphStorage->>RocksDB: transaction()
    RocksDB-->>HelixGraphStorage: txn
    HelixGraphStorage->>VectorCore: insert(txn, data)
    VectorCore->>HNSW: search_level for neighbors
    HNSW->>RocksDB: get edges from hnsw_edges CF
    RocksDB-->>HNSW: neighbor data
    HNSW->>VectorCore: nearest neighbors
    VectorCore->>RocksDB: put_cf(vectors, vector_data)
    VectorCore->>RocksDB: merge_cf(hnsw_edges, edge_updates)
    RocksDB-->>VectorCore: committed
    VectorCore-->>HelixGraphStorage: vector inserted
    HelixGraphStorage->>RocksDB: txn.commit()
    HelixGraphStorage-->>User: success
Loading

@xav-db
Copy link
Member Author

xav-db commented Nov 19, 2025

@greptile

@xav-db xav-db changed the title Rocks impl impl (core): Implementing RocksDB into the HelixDB core Nov 19, 2025
Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

103 files reviewed, 2 comments

Edit Code Review Agent Settings | Greptile
React with 👍 or 👎 to share your feedback on this new summary format

Ok(db) => Arc::new(db),
Err(err) => return Err(err),
};
let storage = match HelixGraphStorage::new(opts.path.leak(), opts.config, opts.version_info)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

logic: .leak() causes a memory leak by permanently leaking the String allocation. This prevents the path string from ever being freed.

Suggested change
let storage = match HelixGraphStorage::new(opts.path.leak(), opts.config, opts.version_info)
let storage = match HelixGraphStorage::new(opts.path.as_str(), opts.config, opts.version_info)
Prompt To Fix With AI
This is a comment left during a code review.
Path: helix-db/src/helix_engine/traversal_core/mod.rs
Line: 38:38

Comment:
**logic:** `.leak()` causes a memory leak by permanently leaking the `String` allocation. This prevents the path string from ever being freed.

```suggestion
        let storage = match HelixGraphStorage::new(opts.path.as_str(), opts.config, opts.version_info)
```

How can I resolve this? If you propose a fix, please make it concise.

Comment on lines +442 to +451
/*
let passes_filters = match filter {
Some(filter_slice) => filter_slice.iter().all(|f| f(&neighbor, txn)),
None => true,
};
if passes_filters {
result.push(neighbor);
}
*/
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

style: commented-out code should be removed

Suggested change
/*
let passes_filters = match filter {
Some(filter_slice) => filter_slice.iter().all(|f| f(&neighbor, txn)),
None => true,
};
if passes_filters {
result.push(neighbor);
}
*/
neighbor.set_distance(neighbor.distance_to(query)?);
if filter.is_none() || filter.unwrap().iter().all(|f| f(&neighbor, txn)) {
result.push(neighbor);
}
Prompt To Fix With AI
This is a comment left during a code review.
Path: helix-db/src/helix_engine/vector_core/rocks/vector_core.rs
Line: 442:451

Comment:
**style:** commented-out code should be removed

```suggestion
                neighbor.set_distance(neighbor.distance_to(query)?);

                if filter.is_none() || filter.unwrap().iter().all(|f| f(&neighbor, txn)) {
                    result.push(neighbor);
                }
```

How can I resolve this? If you propose a fix, please make it concise.

@xav-db xav-db marked this pull request as ready for review November 19, 2025 06:26
@greptile-apps
Copy link
Contributor

greptile-apps bot commented Nov 19, 2025

Skipped: This PR changes more files than the configured file change limit: (107 files found, 100 file limit)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants