mirror of
https://github.com/FerretDB/documentdb.git
synced 2026-11-25 11:49:53 -05:00
Merged PR 1540011: [Add-node] More fixes for add-node scenarios
### Does this PR have any customer impact? Yes ### Type (Feature, Refactoring, Bugfix, DevOps, Testing, Perf, etc) Bugfix ### Does it involve schema level changes? (Table, Column, Index, UDF, etc level changes) No ### Are you introducing any new config? If yes, do you have tests with and without them being set? ### Release Note (Refer [Template](../docs/release_notes/pgmongo_template.md)) ### Description - Cluster Data was not replicated fully on add node (upgrades would fail) - Checks for index wasn't handled in add-node scenarios. (Create/Drop indexes would fail) - Get versions on the GW on MX of the added node reutrns NullRef - fix these. ---- #### AI description (iteration 1) #### PR Classification Bug fix for add-node scenarios. #### PR Summary This pull request addresses issues related to ensuring metadata tables are properly replicated during add-node operations. - `distributed_hooks.c`: Refactored `EnsureMetadataTableReplicatedCore` to return a boolean and added `ExecuteMetadataChecksForReferenceTables`. - `create_indexes_background.c`: Added checks to ensure metadata tables are replicated before starting index creation. - `cluster_operations.c`: Ensured `cluster_data` table is replicated on all nodes during cluster setup. - `api_hooks.c` and `api_hooks.h`: Modified `EnsureMetadataTableReplicated` to return a boolean indicating if replication occurred. - `ExtensionVersionExtensions.cs`: Added null checks for version strings before writing them.
This commit is contained in:
1 parent
d3a92030fa
commit
3b609ecd8f
6 files changed
+49
-14
No files matched your search
@@ -146,7 +146,7 @@ bool IsChangeStreamFeatureAvailableAndCompatible(void);
|
||||
/*
|
||||
* Ensure the given metadata catalog table is replicated.
|
||||
*/
|
||||
void EnsureMetadataTableReplicated(const char *tableName);
|
||||
bool EnsureMetadataTableReplicated(const char *tableName);
|
||||
|
||||
/*
|
||||
* The hook allows the extension to do any additional setup
|
||||
|
||||
@@ -156,7 +156,7 @@ extern GetDistributedApplicationName_HookType get_distributed_application_name_h
|
||||
typedef bool (*IsNtoReturnSupported_HookType)(void);
|
||||
extern IsNtoReturnSupported_HookType is_n_to_return_supported_hook;
|
||||
|
||||
typedef void (*EnsureMetadataTableReplicated_HookType)(const char *);
|
||||
typedef bool (*EnsureMetadataTableReplicated_HookType)(const char *);
|
||||
extern EnsureMetadataTableReplicated_HookType ensure_metadata_table_replicated_hook;
|
||||
|
||||
typedef void (*PostSetupCluster_HookType)(bool);
|
||||
|
||||
@@ -309,9 +309,10 @@ IsNtoReturnSupported(void)
|
||||
|
||||
/*
|
||||
* Ensure that the given metadata table is replicated on all nodes
|
||||
* as applicable
|
||||
* as applicable.
|
||||
* Returns true if something changed and was replicated.
|
||||
*/
|
||||
void
|
||||
bool
|
||||
EnsureMetadataTableReplicated(const char *tableName)
|
||||
{
|
||||
if (ensure_metadata_table_replicated_hook != NULL)
|
||||
@@ -320,6 +321,7 @@ EnsureMetadataTableReplicated(const char *tableName)
|
||||
}
|
||||
|
||||
/* Single node default - it's always replicated */
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -152,6 +152,17 @@ command_build_index_concurrently(PG_FUNCTION_ARGS)
|
||||
PG_RETURN_VOID();
|
||||
}
|
||||
|
||||
/* Before starting, ensure that tables are replicated
|
||||
* If this action did replicate tables, try again in the
|
||||
* next loop to ensure the transaction is committed.
|
||||
*/
|
||||
if (EnsureMetadataTableReplicated("collections"))
|
||||
{
|
||||
ereport(LOG, (errmsg(
|
||||
"Metadata tables were replicated. Retrying index checks in another round.")));
|
||||
PG_RETURN_VOID();
|
||||
}
|
||||
|
||||
List *excludeCollectionIds = NIL;
|
||||
uint64 *collectionIds = GetCollectionIdsForIndexBuild(
|
||||
CREATE_INDEX_COMMAND_TYPE, excludeCollectionIds);
|
||||
|
||||
Reference in new issue
Block a user