Skip to content

Comments

Stateless sync. Per db tables, indexes, schemas.#3139

Merged
khustup2 merged 3 commits intomainfrom
stateless-extension
Feb 14, 2026
Merged

Stateless sync. Per db tables, indexes, schemas.#3139
khustup2 merged 3 commits intomainfrom
stateless-extension

Conversation

@khustup2
Copy link
Contributor

🚀 🚀 Pull Request

Impact

  • Bug fix (non-breaking change which fixes expected existing functionality)
  • Enhancement/New feature (adds functionality without impacting existing logic)
  • Breaking change (fix or feature that would cause existing functionality to change)

Description

Things to be aware of

Things to worry about

Additional Context

@claude
Copy link

claude bot commented Feb 13, 2026

Claude finished @khustup2's task in 1m 59s —— View job


PR Review Complete

I've reviewed the stateless sync changes and left inline comments on the issues I found. The PR implements per-database catalog organization for stateless multi-instance sync with schemas and indexes support.

Key Changes:

  • Splits catalog into shared (cluster-wide: databases, meta) and per-database (tables, columns, indexes, schemas, meta)
  • Adds schema tracking and sync across instances
  • Adds index metadata persistence to shared catalog
  • Optimizes sync worker with parallel version checks across databases
  • Changes default sync interval from 2s to 500ms

Issues Found:

  1. Error handling in ensure_db_catalog() returns 0 on failure, which may be ambiguous
  2. Sync interval reduced 4x (500ms vs 2000ms) - verify this is intentional for production (increased S3 API costs)
  3. Parse function has potential issue with trailing commas (false alarm - already handled correctly)

Memory Management: ✅ Properly handles get_database_name() allocation/deallocation throughout

} catch (const std::exception& e) {
catalog_table_cache::instance().invalidate();
elog(ERROR, "Failed to ensure catalog at %s: %s", root_path.c_str(), e.what());
elog(ERROR, "Failed to ensure per-db catalog at %s/%s: %s", root_path.c_str(), db_name.c_str(), e.what());
Copy link

Choose a reason for hiding this comment

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

Error handling swallows exceptions and returns 0, but callers may interpret 0 as success. Consider returning -1 or throwing to distinguish errors from empty state.

Suggested change
elog(ERROR, "Failed to ensure per-db catalog at %s/%s: %s", root_path.c_str(), db_name.c_str(), e.what());
elog(ERROR, "Failed to ensure per-db catalog at %s/%s: %s", root_path.c_str(), db_name.c_str(), e.what());
throw;

current += c;
}
}
if (!current.empty()) {
Copy link

Choose a reason for hiding this comment

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

Trailing comma handling adds empty string to result. If column_names is "col1,col2,", this pushes "col1", "col2", then empty string from remainder after last comma.

Suggested change
if (!current.empty()) {
if (!current.empty()) {
result.push_back(current);
}
// Don't add empty strings from trailing commas
return result;

#include <algorithm>
#include <cstring>
#include <unordered_map>
#include <vector>
Copy link

Choose a reason for hiding this comment

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

Sync interval reduced from 2000ms to 500ms (4x more frequent). This increases S3 API calls and costs. Verify this is intentional for production workloads, especially with many databases.

@sonarqubecloud
Copy link

@khustup2 khustup2 merged commit 63ecadf into main Feb 14, 2026
13 of 16 checks passed
@khustup2 khustup2 deleted the stateless-extension branch February 14, 2026 19:54
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.

1 participant