Skip to content

rgw/s3vector: add basic lancedb support - #66409

Closed
yuvalif wants to merge 8 commits into
ceph:wip-s3vectorfrom
yuvalif:wip-add-lancedb
Closed

yuvalif wants to merge 8 commits into
ceph:wip-s3vectorfrom
yuvalif:wip-add-lancedb

Conversation

@yuvalif

@yuvalif yuvalif commented Nov 25, 2025 •

Copy link
Copy Markdown
Contributor

s3vector APIs:

  • CreateIndex - implemented (schema should be cached as a vector bucket attribute after the vector bucket PR is merged)
  • CreateVectorBucket - mainly implemented in the vector bucket PR
  • DeleteIndex - implemented
  • DeleteVectorBucket - mainly implemented in the vector bucket PR, here we are doing cascade deletion of all indexes (lancedb tables)
  • DeleteVectorBucketPolicy - will be done as followup PR
  • DeleteVectors - implemented
  • GetIndex - implemented
  • GetVectorBucket - mainly implemented in the vector bucket PR
  • GetVectorBucketPolicy - will be done as followup PR
  • GetVectors - implemented
  • ListIndexes - implemented
  • ListTagsForResource - not in scope
  • ListVectorBuckets - implemented in the vector bucket PR
  • ListVectors - implemented
  • PutVectorBucketPolicy - will be done as followup PR
  • PutVectors - implemented
  • QueryVectors - implemented
  • TagResource - not in scope
  • UntagResource - not in scope

Comment thread src/rgw/rgw_rest_s3vector.cc Resolved
@yuvalif yuvalif added the DNM label Jan 1, 2026
@yuvalif
yuvalif marked this pull request as ready for review January 13, 2026 16:48
@yuvalif
yuvalif requested a review from a team as a code owner January 13, 2026 16:48
@github-actions

Copy link
Copy Markdown

This pull request can no longer be automatically merged: a rebase is needed and changes have to be manually resolved

@yuvalif
yuvalif force-pushed the wip-add-lancedb branch 4 times, most recently from b54ce48 to c209165 Compare February 10, 2026 16:59
@yuvalif
yuvalif force-pushed the wip-add-lancedb branch 4 times, most recently from b3880cd to d14af1a Compare February 11, 2026 10:18
@yuvalif
yuvalif force-pushed the wip-add-lancedb branch 2 times, most recently from 0047bc0 to ddd87f4 Compare February 21, 2026 20:06
@yuvalif

yuvalif commented Feb 21, 2026

Copy link
Copy Markdown
Contributor Author

Comment thread src/rgw/rgw_s3vector.cc
// TODO: build the arrow schema when creating the table and store the C ABI schema
// as an attrribute of the vectore bucket
struct ArrowSchema c_schema;
if (int ret = create_table_schema(configuration.dimension, dpp, &c_schema); ret < 0) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

the dimension is persistent(not directly, it is created according to the saved vector size).
the distance_metric is not persistent (so the query may use wrong distance_metric) --> wrong result.
since, this PR using the local-fs, the index properties should saved also locally.
(the non_filterable_metadata_keys and creation_time also missing)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

thr plan is to add these as VectorBucket attributes (held per vector bucket index).
i also plan to cache the index (=table) schema there, so it does not need to be retrieved from the table for every action.

Comment thread src/rgw/rgw_s3vector.cc
.replace = 1, // replace existing index
.force_update_statistics = 0 // don't force update statistics
};
if (const LanceDBError result = lancedb_table_create_scalar_index(

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

the schema is currently hardcoded ("key" ,"data") , there is no dynamic metadata (passed by the user) that actually persist between calls (put-vector , query-vector).
the data-type is always "float32".
the scalar-btree is saved into lance-index-files (local fs) , the same is with the vector-data.

i guess the hardcoded thing is on purpose for the current phase.
in order to verify that variety of lance-db-functions works properly, it need to remove the hard coded definitions.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

the "key" and "data" will be hardcoded in the future as well, since the s3vectors API does not give the user any freedom with these fields.

regarding metadata, the plan is to *deviate from the AWS API and treat the "non-filterable-metadata" as "filterable-metadata".
this would mean, that, for the list of metadata fields that are "filterable", we would create matching columns in the table, while any other metadata values will just go into a json encoded "metadata" column.

however, this will be implemented in later phases. for now we will just have non-filterable metadata support (meaning, just put values and fetch them)

if we want to support the API, as AWS defined it, we would need to:

  • add something like duckdb for holding the metadata values
  • join with the lancedb table to perform "after-the-fact" query

not sure we would like to do that... but still an option

@galsalomon66 galsalomon66 Feb 25, 2026 •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

important notes.

as mentioned it's better to deviate from the AWS API, i.e.
for one thing, we can add schema-definition to s3-vector-create-index API (the user knows upfront what is the required schema)

another option, is deduce the schema from the data attached to put-vector, it's flexible and user friendly approach.(comes with some complexity)
the lancedb-engine contain table_add_columns API (it needs C wrapper), so we can dynamically add columns as data streaming in.

there is no need for external engine on-top of lance-db, once the lancedb engine knows what is the schema, and also "knows" about the scalar indexes, the lancedb engine has the option to run pre-filter or post-filter(per user request), and to use the schema scalar-indexes efficiently.

the option of adding a "generic data field (JSON that can contain all)" , is simple but problematic (performance perspective).

(i checking the different options with a prototype application.)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

important notes.

as mentioned it's better to deviate from the AWS API, i.e. for one thing, we can add schema-definition to s3-vector-create-index API (the user knows upfront what is the required schema)

beside adding columns based on the metadata fields that we want to make searchable, what kind of schema changes do you want to support?
what would eb the usecase (assuming s3vectors goal is not to replaces an interactive vectordb implementation).

another option, is deduce the schema from the data attached to put-vector, it's flexible and user friendly approach.(comes with some complexity) the lancedb-engine contain table_add_columns API (it needs C wrapper), so we can dynamically add columns as data streaming in.

i don't think this would scale. each vector put (and we can have millions of these in an index) will be able to add columns to the table

there is no need for external engine on-top of lance-db, once the lancedb engine knows what is the schema, and also "knows" about the scalar indexes, the lancedb engine has the option to run pre-filter or post-filter(per user request), and to use the schema scalar-indexes efficiently.

not sure what you mean by external engine?
if we know the schema (including the searchable metadata fields) upon index creation, we will create the table at that point.
if a searchable column is just generic string column, we can create a btree index at that point, if the column has some low cardinality value, the background process will be able to create a bitmap index on it once there is some data in the table.

the option of adding a "generic data field (JSON that can contain all)" , is simple but problematic (performance perspective).

the s3vectors API allow sending a JSON metadata object together with each vector. this is not an optional feature, we have to support that,
if these values does not need to be used as filters, we will just store then in a column so it could be fetched later

(i checking the different options with a prototype application.)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

important notes.
as mentioned it's better to deviate from the AWS API, i.e. for one thing, we can add schema-definition to s3-vector-create-index API (the user knows upfront what is the required schema)

beside adding columns based on the metadata fields that we want to make searchable, what kind of schema changes do you want to support? what would eb the usecase (assuming s3vectors goal is not to replaces an interactive vectordb implementation).

it need to support a table schema-definition, that is essential. as for schema changes, it is also essential (rollback mistakes, user need a change), it not about replacing-interactive, it's about minimal and vital operations.

another option, is deduce the schema from the data attached to put-vector, it's flexible and user friendly approach.(comes with some complexity) the lancedb-engine contain table_add_columns API (it needs C wrapper), so we can dynamically add columns as data streaming in.

i don't think this would scale. each vector put (and we can have millions of these in an index) will be able to add columns to the table

for sure it should be limited ( no more than X metadata fields), in any case the put-vector api, should be validated as for its data integrity.

there is no need for external engine on-top of lance-db, once the lancedb engine knows what is the schema, and also "knows" about the scalar indexes, the lancedb engine has the option to run pre-filter or post-filter(per user request), and to use the schema scalar-indexes efficiently.

not sure what you mean by external engine? if we know the schema (including the searchable metadata fields) upon index creation, we will create the table at that point. if a searchable column is just generic string column, we can create a btree index at that point, if the column has some low cardinality value, the background process will be able to create a bitmap index on it once there is some data in the table.

upon lancedb is "aware" of the table metadata-columns, its engine able to create and use scalar-index upon search, and to use that efficiently with its query-planner. the lancedb-engine is able to "merge" the vector-index-search(IVF) with the scalar index result(list of row-id's)

not clear why it needs to create a btree-index (the duckdb was mentioned in comment as an external engine)

the option of adding a "generic data field (JSON that can contain all)" , is simple but problematic (performance perspective).

the s3vectors API allow sending a JSON metadata object together with each vector. this is not an optional feature, we have to support that, if these values does not need to be used as filters, we will just store then in a column so it could be fetched later

there is no problem with storing data into a string data type.
the JSON metadata is not searchable, and upon fetching it, it need to extract the data-fields from the JSON format (no issue with that).

(i checking the different options with a prototype application.)

@github-actions

Copy link
Copy Markdown

This pull request can no longer be automatically merged: a rebase is needed and changes have to be manually resolved

@yuvalif

yuvalif commented Feb 25, 2026 •

Copy link
Copy Markdown
Contributor Author

it need to support a table schema-definition, that is essential. as for schema changes, it is also essential (rollback mistakes, user need a change), it not about replacing-interactive, it's about minimal and vital operations.

i dont understand why this is essential?
users dont define schemas over s3vectors and dont expect to. so, there are no mistakes, rollbacks etc.
we should extend the AWS APIs when it gives value to the users (e.g. distinguish between searchable and non-searchable metadata columns). this API is not intended to be a vectordb API

@galsalomon66

Copy link
Copy Markdown
Contributor

points been discussed
-- the lancedb API's enable to define searchable metadata columns, it enable to define a scalar-index
-- the lancedb engine knows how to merge the result of the filter(using scalar-index, yes or no) with vector-index search-results using its planner.
-- adding a generic metadata is ok. it should be noted that it is not searchable, its only for description.
-- searchable metadata is needed (similar search can not stand by itself for most of the use cases), thus schama definition is required.
-- as for schema definition it needs to define data-name and type, the searching options is based on data type(number , datetime, string).

Shilpa Jagannath and others added 4 commits March 11, 2026 16:26
…n empty

payload hash computed for UNSIGNED-PAYLOAD. use that hash for the header
'x-amz-content-sha256' in AWSSignerV4::prepare()

Signed-off-by: Shilpa Jagannath <[email protected]>
not implemented in this commit:
* caching information as VectorBucket attributes and fetching them from
  there: schema, distance type
* VectorBucket policy APIs
* metadata support

Signed-off-by: Yuval Lifshitz <[email protected]>
also fix shaman build failures with lancedb-c. see:
https://shaman.ceph.com/builds/ceph/wip-add-lancedb/e7ce95d8e2e279b373f3c486bd1f64c39b23883f/

note that currently we are testing only against centos
since the rust version in ubuntu jammy and noble is too old for lancedb

liblancedb.so is installed as part of the ceph_base

Signed-off-by: Yuval Lifshitz <[email protected]>
Signed-off-by: Yuval Lifshitz <[email protected]>
@yuvalif

yuvalif commented Mar 12, 2026 •

Copy link
Copy Markdown
Contributor Author

@yuvalif

yuvalif commented Mar 13, 2026

Copy link
Copy Markdown
Contributor Author

@yuvalif

yuvalif commented Mar 13, 2026

Copy link
Copy Markdown
Contributor Author

cherry-picked into #66066

@yuvalif yuvalif closed this Mar 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants