Skip to content

session uptake for rgw s3 vectors - #68731

Closed
9401adarsh wants to merge 17 commits into
ceph:wip-s3vectorfrom
9401adarsh:wip-adashoka-session-cache-uptake
Closed

9401adarsh wants to merge 17 commits into
ceph:wip-s3vectorfrom
9401adarsh:wip-adashoka-session-cache-uptake

Conversation

@9401adarsh

@9401adarsh 9401adarsh commented May 4, 2026 •

Copy link
Copy Markdown
Contributor

rgw s3vectors: add session operations in background skeleton, modify relevant bucket and vector operations to connect with session

changes introduced:

  • rgw_s3vector_background.cc, rgw_s3vector_background.h: add a session pool owned by the background process with a session for each bucket, add relevant session lifecycle ops - create and delete, and method to pass a session to rgw_frontend.
  • rgw_s3vector.cc - add helpers to connect with session, and open table with a session, also consume session in bucket ops - create, delete and vector ops - put, get, delete and query.

future work (deferred for the time being):

  • periodic session cleanup in the background process every x seconds or so to ensure cleanup of sessions happens explicitly rather than relying on only existence of bucket checks.

Signed-off-by: Adarsh Ashokan [email protected]

Contribution Guidelines

  • To sign and title your commits, please refer to Submitting Patches to Ceph.

  • If you are submitting a fix for a stable branch (e.g. "quincy"), please refer to Submitting Patches to Ceph - Backports for the proper workflow.

  • When filling out the below checklist, you may click boxes directly in the GitHub web UI. When entering or editing the entire PR message in the GitHub web UI editor, you may also select a checklist item by adding an x between the brackets: [x]. Spaces and capitalization matter when checking off items this way.

Checklist

  • Tracker (select at least one)
    • References tracker ticket
    • Very recent bug; references commit where it was introduced
    • New feature (ticket optional)
    • Doc update (no ticket needed)
    • Code cleanup (no ticket needed)
  • Component impact
    • Affects Dashboard, opened tracker ticket
    • Affects Orchestrator, opened tracker ticket
    • No impact that needs to be tracked
  • Documentation (select at least one)
    • Updates relevant documentation
    • No doc update is appropriate
  • Tests (select at least one)
Show available Jenkins commands

You must only issue one Jenkins command per-comment. Jenkins does not understand
comments with more than one command.

yuvalif added 13 commits April 23, 2026 05:31
do some fixes to message validation based on the tesst

Signed-off-by: Yuval Lifshitz <[email protected]>
Signed-off-by: Yuval Lifshitz <[email protected]>
Signed-off-by: Yuval Lifshitz <[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]>
use non-system user. similar to fix here:
8935c1f

Signed-off-by: Yuval Lifshitz <[email protected]>
also. fix token waited issue

Signed-off-by: Yuval Lifshitz <[email protected]>
see: lancedb/lancedb-c#45
also run test on rpm latest (rocky10)

Signed-off-by: Yuval Lifshitz <[email protected]>
* wait for longer than sleep idle time for graceful shutdown
* empty queue on shutdown
* avoud double join on non-graceful shutdown

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

Copy link
Copy Markdown
Collaborator

Thank you for your contribution. Since you, the author, are not a member of the Ceph GitHub Org yet, our CI will not automatically run. Any member of the Ceph Org may comment "ok - to - test" (without the dashes) to allow the Jenkins jobs to run.

13 similar comments
@ceph-jenkins

Copy link
Copy Markdown
Collaborator

Thank you for your contribution. Since you, the author, are not a member of the Ceph GitHub Org yet, our CI will not automatically run. Any member of the Ceph Org may comment "ok - to - test" (without the dashes) to allow the Jenkins jobs to run.

@ceph-jenkins

Copy link
Copy Markdown
Collaborator

Thank you for your contribution. Since you, the author, are not a member of the Ceph GitHub Org yet, our CI will not automatically run. Any member of the Ceph Org may comment "ok - to - test" (without the dashes) to allow the Jenkins jobs to run.

@ceph-jenkins

Copy link
Copy Markdown
Collaborator

Thank you for your contribution. Since you, the author, are not a member of the Ceph GitHub Org yet, our CI will not automatically run. Any member of the Ceph Org may comment "ok - to - test" (without the dashes) to allow the Jenkins jobs to run.

@ceph-jenkins

Copy link
Copy Markdown
Collaborator

Thank you for your contribution. Since you, the author, are not a member of the Ceph GitHub Org yet, our CI will not automatically run. Any member of the Ceph Org may comment "ok - to - test" (without the dashes) to allow the Jenkins jobs to run.

@ceph-jenkins

Copy link
Copy Markdown
Collaborator

Thank you for your contribution. Since you, the author, are not a member of the Ceph GitHub Org yet, our CI will not automatically run. Any member of the Ceph Org may comment "ok - to - test" (without the dashes) to allow the Jenkins jobs to run.

@ceph-jenkins

Copy link
Copy Markdown
Collaborator

Thank you for your contribution. Since you, the author, are not a member of the Ceph GitHub Org yet, our CI will not automatically run. Any member of the Ceph Org may comment "ok - to - test" (without the dashes) to allow the Jenkins jobs to run.

@ceph-jenkins

Copy link
Copy Markdown
Collaborator

Thank you for your contribution. Since you, the author, are not a member of the Ceph GitHub Org yet, our CI will not automatically run. Any member of the Ceph Org may comment "ok - to - test" (without the dashes) to allow the Jenkins jobs to run.

@ceph-jenkins

Copy link
Copy Markdown
Collaborator

Thank you for your contribution. Since you, the author, are not a member of the Ceph GitHub Org yet, our CI will not automatically run. Any member of the Ceph Org may comment "ok - to - test" (without the dashes) to allow the Jenkins jobs to run.

@ceph-jenkins

Copy link
Copy Markdown
Collaborator

Thank you for your contribution. Since you, the author, are not a member of the Ceph GitHub Org yet, our CI will not automatically run. Any member of the Ceph Org may comment "ok - to - test" (without the dashes) to allow the Jenkins jobs to run.

@ceph-jenkins

Copy link
Copy Markdown
Collaborator

Thank you for your contribution. Since you, the author, are not a member of the Ceph GitHub Org yet, our CI will not automatically run. Any member of the Ceph Org may comment "ok - to - test" (without the dashes) to allow the Jenkins jobs to run.

@ceph-jenkins

Copy link
Copy Markdown
Collaborator

Thank you for your contribution. Since you, the author, are not a member of the Ceph GitHub Org yet, our CI will not automatically run. Any member of the Ceph Org may comment "ok - to - test" (without the dashes) to allow the Jenkins jobs to run.

@ceph-jenkins

Copy link
Copy Markdown
Collaborator

Thank you for your contribution. Since you, the author, are not a member of the Ceph GitHub Org yet, our CI will not automatically run. Any member of the Ceph Org may comment "ok - to - test" (without the dashes) to allow the Jenkins jobs to run.

@ceph-jenkins

Copy link
Copy Markdown
Collaborator

Thank you for your contribution. Since you, the author, are not a member of the Ceph GitHub Org yet, our CI will not automatically run. Any member of the Ceph Org may comment "ok - to - test" (without the dashes) to allow the Jenkins jobs to run.

@github-actions github-actions Bot added the rgw label May 4, 2026
Comment thread src/rgw/rgw_s3vector.cc Outdated
@@ -80,6 +96,20 @@ namespace rgw::s3vector {
return table;
}

LanceDBTable* open_table_with_session(DoutPrefixProvider* dpp, const std::string& vector_bucket_name, const std::string& index_name) {

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.

we probably only want that with the query apis, so we don't pay the cost the lock for all operations

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.

query, put vectors, get vectors. rule of thumb - all operations involving vectors.

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.

might have to ignore list vectors (check again)

Comment thread src/rgw/rgw_s3vector.cc Outdated
@@ -66,6 +66,22 @@ namespace rgw::s3vector {
return conn;
}

LanceDBConnection *connect_with_session(DoutPrefixProvider* dpp, const std::string& vector_bucket_name){

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.

we probably want to call this function from the create bucket API. so we have the session ready when we start querying

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.

needs to be called with create_bucket_from_index()

Copilot AI left a comment

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.

Pull request overview

Copilot reviewed 3 out of 3 changed files in this pull request and generated 5 comments.

Comment thread src/rgw/rgw_s3vector.cc Resolved
Comment thread src/rgw/rgw_s3vector_background.cc Resolved
Comment thread src/rgw/rgw_s3vector.cc Resolved
Comment thread src/rgw/rgw_s3vector_background.cc Resolved
Comment thread src/rgw/rgw_s3vector_background.cc Resolved
Comment thread src/rgw/rgw_s3vector.cc Resolved
@9401adarsh

Copy link
Copy Markdown
Contributor Author

jenkins test make check

3 similar comments
@yuvalif

yuvalif commented May 19, 2026 •

Copy link
Copy Markdown
Contributor

jenkins test make check

@yuvalif

yuvalif commented May 19, 2026

Copy link
Copy Markdown
Contributor

jenkins test make check

@yuvalif

yuvalif commented May 25, 2026

Copy link
Copy Markdown
Contributor

jenkins test make check

@yuvalif
yuvalif requested a review from soumyakoduri May 25, 2026 12:48
@yuvalif

yuvalif commented May 25, 2026

Copy link
Copy Markdown
Contributor

@soumyakoduri this is the basic session management work

@yuvalif

yuvalif commented May 25, 2026

Copy link
Copy Markdown
Contributor

@9401adarsh the vector bucket may be deleted by another RGW - and it would be nice to delete the session in such a case as well.
please see calls to driver->load_vector_bucket() in rgw_rest_s3vector.cc
we should probably add something like:

  op_ret = driver->load_vector_bucket(this, bucket_id, &bucket, y);
  if (op_ret < 0) {
    if (op_ret == -ENOENT) {
      notify_session_delete(this, bucket_id);
    }
    ldpp_dout(this, 1) << "ERROR: failed to load s3vector bucket " << bucket_id << ". error: " << op_ret << dendl;
    return;
  }

@9401adarsh

Copy link
Copy Markdown
Contributor Author

@9401adarsh the vector bucket may be deleted by another RGW - and it would be nice to delete the session in such a case as well. please see calls to driver->load_vector_bucket() in rgw_rest_s3vector.cc we should probably add something like:

  op_ret = driver->load_vector_bucket(this, bucket_id, &bucket, y);
  if (op_ret < 0) {
    if (op_ret == -ENOENT) {
      notify_session_delete(this, bucket_id);
    }
    ldpp_dout(this, 1) << "ERROR: failed to load s3vector bucket " << bucket_id << ". error: " << op_ret << dendl;
    return;
  }

noted, will make the change.

@9401adarsh

9401adarsh commented May 26, 2026 •

Copy link
Copy Markdown
Contributor Author

@9401adarsh the vector bucket may be deleted by another RGW - and it would be nice to delete the session in such a case as well. please see calls to driver->load_vector_bucket() in rgw_rest_s3vector.cc we should probably add something like:

  op_ret = driver->load_vector_bucket(this, bucket_id, &bucket, y);
  if (op_ret < 0) {
    if (op_ret == -ENOENT) {
      notify_session_delete(this, bucket_id);
    }
    ldpp_dout(this, 1) << "ERROR: failed to load s3vector bucket " << bucket_id << ". error: " << op_ret << dendl;
    return;
  }

noted, will make the change.

local tests passing for this change, i have added similar blocks in all vector bucket ops except CreateVectorBucket.

@9401adarsh
9401adarsh force-pushed the wip-adashoka-session-cache-uptake branch 2 times, most recently from 1afe3a1 to 7b9fb75 Compare May 26, 2026 06:14
… in-flight bucket delete.

rgw/s3vector: remove log (nit)

rgw/s3vectors: add session delete for delete  vector bucket operation.

Signed-off-by: Adarsh <[email protected]>
@9401adarsh
9401adarsh force-pushed the wip-adashoka-session-cache-uptake branch from 7b9fb75 to 534f9f1 Compare May 26, 2026 06:24

@soumyakoduri soumyakoduri left a comment

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.

If multiple threads are racing for vector bucket deletion and creation, how are the corresponding session deletion/creation messages are handled? FIFO?

Also there are few more things which need to added/addressed -

  • SESSION_UPDATE: We might require a mechanism to even the update the session for every op (for e.g., to update custom registry with (driver, dpp) unique to that Op).
  • These updates need to be done real time (but not lazily) and hence we will need a mechanism to synchronize those updates across RGW threads (as the sessions will now be shared).

[Though 'driver' may remain constant for entire RGW process, dpp will be Op specific]

Comment thread src/rgw/rgw_s3vector.cc Resolved
Comment thread src/rgw/rgw_s3vector.cc Resolved
@yuvalif

yuvalif commented May 26, 2026

Copy link
Copy Markdown
Contributor

If multiple threads are racing for vector bucket deletion and creation, how are the corresponding session deletion/creation messages are handled? FIFO?

yes. note that, in the context of this PR, if a session does not exist, the only issue is performence of the queries. so, we are not too concerned about these races

Also there are few more things which need to added/addressed -

  • SESSION_UPDATE: We might require a mechanism to even the update the session for every op (for e.g., to update custom registry with (driver, dpp) unique to that Op).
  • These updates need to be done real time (but not lazily) and hence we will need a mechanism to synchronize those updates across RGW threads (as the sessions will now be shared).

[Though 'driver' may remain constant for entire RGW process, dpp will be Op specific]

given what you said, we should not use the session to store the dpp. we should probably ad it to the "write params". see this draft PR: lancedb/lancedb-c#24

regarding driver - we can assume it remains constant for the lifetime of the RGW (though, a realm reload will be an issue). we need to decide if we want the driver at session level or maybe aslo part of the write parameters?

@9401adarsh

Copy link
Copy Markdown
Contributor Author

@9401adarsh the vector bucket may be deleted by another RGW - and it would be nice to delete the session in such a case as well. please see calls to driver->load_vector_bucket() in rgw_rest_s3vector.cc we should probably add something like:

  op_ret = driver->load_vector_bucket(this, bucket_id, &bucket, y);
  if (op_ret < 0) {
    if (op_ret == -ENOENT) {
      notify_session_delete(this, bucket_id);
    }
    ldpp_dout(this, 1) << "ERROR: failed to load s3vector bucket " << bucket_id << ". error: " << op_ret << dendl;
    return;
  }

noted, will make the change.

local tests passing for this change, i have added similar blocks in all vector bucket ops except CreateVectorBucket.

@9401adarsh the vector bucket may be deleted by another RGW - and it would be nice to delete the session in such a case as well. please see calls to driver->load_vector_bucket() in rgw_rest_s3vector.cc we should probably add something like:

  op_ret = driver->load_vector_bucket(this, bucket_id, &bucket, y);
  if (op_ret < 0) {
    if (op_ret == -ENOENT) {
      notify_session_delete(this, bucket_id);
    }
    ldpp_dout(this, 1) << "ERROR: failed to load s3vector bucket " << bucket_id << ". error: " << op_ret << dendl;
    return;
  }

noted, will make the change.

local tests passing for this change, i have added similar blocks in all vector bucket ops except CreateVectorBucket.

note: this doesn't guarantee session cleanup in all cases. for example, let's say rgw1 and rgw2 have sessions for both a vector bucket B. If rgw1 issues a delete for bucket B, and rgw2 doesn't have any operation for the bucket B following this delete issued by rgw1, the session on rgw2 will continue to persist.

A fix would be to have a periodic cleanup of sessions for each rgw, where we go through the session map, and free sessions based on existence of a bucket.

@9401adarsh

Copy link
Copy Markdown
Contributor Author

jenkins test make check

@yuvalif
yuvalif requested a review from a team as a code owner May 28, 2026 17:34
@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 May 28, 2026

Copy link
Copy Markdown
Contributor

squashed and cherry-picked to wip-s3vector (see: 19a3bf4)

@9401adarsh followup work:

  • session cleanup based on session inactivity. for the case that vector bucket is deleted by another bucket, and bucket with the session does not see any ops related to the deleted vector bucket
  • add config options to set the size of the index and metadata cache of sessions
  • add admin apis for getting session status/stats and doing session deletion. note that we cannot use radosgw-admin here since the session is per RGW, and not stored at the backend

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.

5 participants