Skip to content

rgw/s3vectors: skeleton for background process - #67849

Closed
yuvalif wants to merge 0 commit into
ceph:wip-s3vectorfrom
yuvalif:wip-background-skeleton
Closed

yuvalif wants to merge 0 commit into
ceph:wip-s3vectorfrom
yuvalif:wip-background-skeleton

Conversation

@yuvalif

@yuvalif yuvalif commented Mar 17, 2026

Copy link
Copy Markdown
Contributor

No description provided.

@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-background-skeleton branch from f520f3b to 13c788a Compare April 14, 2026 14:29
Comment thread src/rgw/rgw_appmain.cc Resolved
@yuvalif

yuvalif commented Apr 15, 2026

Copy link
Copy Markdown
Contributor Author

jenkins test make check

Comment thread src/rgw/rgw_appmain.cc Resolved
@yuvalif
yuvalif force-pushed the wip-background-skeleton branch from 13c788a to 401e5de Compare April 15, 2026 17:35
Comment thread src/rgw/rgw_appmain.cc Resolved
@yuvalif
yuvalif force-pushed the wip-background-skeleton branch from 401e5de to 5c740ca Compare April 15, 2026 18:26
tokens_waiter tw(this);
for (const auto& table_name : tables_to_process) {
// start processing a table
tokens_waiter::token token(&tw);

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 token flow looks wrong.

the token is defined outside the lambda, thus it immediately decrease the counter(pending token) after the spawn.
the pending token gets zero(by token destructor), the waiter signal for complete, while task is on work.

pending token does not reflect the amount of task-on-work

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.

you are right. i should move the token into the lambda as in here: https://github.com/ceph/ceph/blob/main/src/rgw/driver/rados/rgw_notify.cc#L500

it should be created before the lambda, so that we are guaranteed to wait on it even if no coroutine was scheduled.

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.

fixed in: 2cb7ce2

boost::asio::executor_work_guard<Executor> work_guard;
std::vector<std::thread> workers;
rgw::sal::Driver* const driver;
std::unordered_map<table_name_t, ceph::coarse_real_time, boost::hash<table_name_t>> tables;

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.

note: the variable tables (map) keeps growing, slowly. entries are not deleted.

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.

right. i would need to have "table deletion" notes to the queue

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.

fixed in: 2cb7ce2

// TODO: check if processing is needed based on unindexed rows stats and skip if not needed
// TODO: check if processign already started for the table and skip if yes
// TODO: implement actual lancedb table processing logic here
// for PoC just sleep for some time to simulate processing

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.

a note : upon this function is called per table-modification ( put / delete ),
it needs to check the index-state (number of un-indexed-rows) , that is a lance-db call to fetch table meta-data.

in case it met the threshold it need to rebuild the index.

the workload to consider is a burst of vectors (concurrent requests),
it need to limit the calls to get-table-metadata (window time limitation).

const auto now = ceph::coarse_real_clock::now();
const auto time_since_last_process = now - it->second;
if (time_since_last_process > std::chrono::milliseconds(5000)) {
ldpp_dout(this, 20) << "INFO: will try to process table: " << table_name.first << "." << table_name.second <<

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.

note: pushing a task (for the same table) only if enough time had passed.
workload : burst of table-modifications(put/delete) requests.

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 burst is mitigated in 2 ways:

  1. the queue may have multiple entries for the same table. but since "tables" is a set, it will be inserted only once per queue processing
  2. we check the time difference since lance processing

@yuvalif
yuvalif requested a review from a team as a April 26, 2026 06:23
@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 Apr 26, 2026

Copy link
Copy Markdown
Contributor Author

backround process commits merged into: #66066

@yuvalif yuvalif closed this Apr 26, 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.

the graceful shutdown not clear whether it works correctly.

the std::async launch a thread that is blocked until the worker is joined.
if the worker had joined(in less than 1 sec), that's ok, moving to the next worker.
if not , future is waiting for 1sec -> io_context.stop() -> worker.join (line 207) and another worker.join (line 200)

it may cause a double worker.join

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.

addressed here: #68623

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.

@yuvalif
the consume_all pop the messages, create unique_ptr on the poped-message (thus it deleted).
upon shutdown, the consume_all is skipped, thus .. the messages in queue are never deleted (notify-index -> shutdown).

destructor should drain the queue.

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.

addressed in above PR

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