mirror of https://github.com/citusdata/citus.git
commit
1910a93b9a
|
@ -1419,11 +1419,9 @@ ErrorIfUnstableCreateOrAlterExtensionStmt(Node *parsetree)
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
* No version was specified, so PostgreSQL will use the default_version
|
* No version was specified, so PostgreSQL will use the default_version
|
||||||
* from the citus.control file. In case a new default is available, we
|
* from the citus.control file.
|
||||||
* will force a compatibility check of the latest available version.
|
|
||||||
*/
|
*/
|
||||||
citusVersionKnownCompatible = false;
|
CheckAvailableVersion(ERROR);
|
||||||
CheckCitusVersion(ERROR);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -106,7 +106,7 @@ static Oid workerHashFunctionId = InvalidOid;
|
||||||
/* Citus extension version variables */
|
/* Citus extension version variables */
|
||||||
bool EnableVersionChecks = true; /* version checks are enabled */
|
bool EnableVersionChecks = true; /* version checks are enabled */
|
||||||
|
|
||||||
bool citusVersionKnownCompatible = false;
|
static bool citusVersionKnownCompatible = false;
|
||||||
|
|
||||||
/* Hash table for informations about each partition */
|
/* Hash table for informations about each partition */
|
||||||
static HTAB *DistTableCacheHash = NULL;
|
static HTAB *DistTableCacheHash = NULL;
|
||||||
|
@ -143,7 +143,6 @@ static bool HasUniformHashDistribution(ShardInterval **shardIntervalArray,
|
||||||
static bool HasUninitializedShardInterval(ShardInterval **sortedShardIntervalArray,
|
static bool HasUninitializedShardInterval(ShardInterval **sortedShardIntervalArray,
|
||||||
int shardCount);
|
int shardCount);
|
||||||
static bool CheckInstalledVersion(int elevel);
|
static bool CheckInstalledVersion(int elevel);
|
||||||
static bool CheckAvailableVersion(int elevel);
|
|
||||||
static char * AvailableExtensionVersion(void);
|
static char * AvailableExtensionVersion(void);
|
||||||
static char * InstalledExtensionVersion(void);
|
static char * InstalledExtensionVersion(void);
|
||||||
static bool HasOverlappingShardInterval(ShardInterval **shardIntervalArray,
|
static bool HasOverlappingShardInterval(ShardInterval **shardIntervalArray,
|
||||||
|
@ -512,6 +511,11 @@ LookupDistTableCacheEntry(Oid relationId)
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (DistTableCacheHash == NULL)
|
||||||
|
{
|
||||||
|
InitializeDistTableCache();
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* If the version is not known to be compatible, perform thorough check,
|
* If the version is not known to be compatible, perform thorough check,
|
||||||
* unless such checks are disabled.
|
* unless such checks are disabled.
|
||||||
|
@ -539,11 +543,6 @@ LookupDistTableCacheEntry(Oid relationId)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (DistTableCacheHash == NULL)
|
|
||||||
{
|
|
||||||
InitializeDistTableCache();
|
|
||||||
}
|
|
||||||
|
|
||||||
cacheEntry = hash_search(DistTableCacheHash, hashKey, HASH_ENTER, &foundInCache);
|
cacheEntry = hash_search(DistTableCacheHash, hashKey, HASH_ENTER, &foundInCache);
|
||||||
|
|
||||||
/* return valid matches */
|
/* return valid matches */
|
||||||
|
@ -1181,13 +1180,15 @@ CheckCitusVersion(int elevel)
|
||||||
* this function logs an error with the specified elevel and returns false,
|
* this function logs an error with the specified elevel and returns false,
|
||||||
* otherwise it returns true.
|
* otherwise it returns true.
|
||||||
*/
|
*/
|
||||||
static bool
|
bool
|
||||||
CheckAvailableVersion(int elevel)
|
CheckAvailableVersion(int elevel)
|
||||||
{
|
{
|
||||||
char *availableVersion = NULL;
|
char *availableVersion = NULL;
|
||||||
|
|
||||||
Assert(CitusHasBeenLoaded());
|
if (!EnableVersionChecks)
|
||||||
Assert(EnableVersionChecks);
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
availableVersion = AvailableExtensionVersion();
|
availableVersion = AvailableExtensionVersion();
|
||||||
|
|
||||||
|
|
|
@ -18,7 +18,6 @@
|
||||||
#include "utils/hsearch.h"
|
#include "utils/hsearch.h"
|
||||||
|
|
||||||
extern bool EnableVersionChecks;
|
extern bool EnableVersionChecks;
|
||||||
extern bool citusVersionKnownCompatible;
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Representation of a table's metadata that is frequently used for
|
* Representation of a table's metadata that is frequently used for
|
||||||
|
@ -80,6 +79,7 @@ extern void CitusInvalidateRelcacheByShardId(int64 shardId);
|
||||||
|
|
||||||
extern bool CitusHasBeenLoaded(void);
|
extern bool CitusHasBeenLoaded(void);
|
||||||
extern bool CheckCitusVersion(int elevel);
|
extern bool CheckCitusVersion(int elevel);
|
||||||
|
extern bool CheckAvailableVersion(int elevel);
|
||||||
bool MajorVersionsCompatible(char *leftVersion, char *rightVersion);
|
bool MajorVersionsCompatible(char *leftVersion, char *rightVersion);
|
||||||
|
|
||||||
/* access WorkerNodeHash */
|
/* access WorkerNodeHash */
|
||||||
|
|
|
@ -169,7 +169,31 @@ SET citus.enable_version_checks TO 'true';
|
||||||
DROP FUNCTION citus_table_size(regclass);
|
DROP FUNCTION citus_table_size(regclass);
|
||||||
SET citus.enable_version_checks TO 'false';
|
SET citus.enable_version_checks TO 'false';
|
||||||
ALTER EXTENSION citus UPDATE TO '6.2-2';
|
ALTER EXTENSION citus UPDATE TO '6.2-2';
|
||||||
|
-- Test updating to the latest version without specifying the version number
|
||||||
|
ALTER EXTENSION citus UPDATE;
|
||||||
-- re-create in newest version
|
-- re-create in newest version
|
||||||
DROP EXTENSION citus;
|
DROP EXTENSION citus;
|
||||||
\c
|
\c
|
||||||
CREATE EXTENSION citus;
|
CREATE EXTENSION citus;
|
||||||
|
-- test cache invalidation in workers
|
||||||
|
\c - - - :worker_1_port
|
||||||
|
-- this will initialize the cache
|
||||||
|
\d
|
||||||
|
List of relations
|
||||||
|
Schema | Name | Type | Owner
|
||||||
|
--------+------+------+-------
|
||||||
|
(0 rows)
|
||||||
|
|
||||||
|
DROP EXTENSION citus;
|
||||||
|
SET citus.enable_version_checks TO 'false';
|
||||||
|
CREATE EXTENSION citus VERSION '5.2-4';
|
||||||
|
SET citus.enable_version_checks TO 'true';
|
||||||
|
-- during ALTER EXTENSION, we should invalidate the cache
|
||||||
|
ALTER EXTENSION citus UPDATE;
|
||||||
|
-- if cache is invalidated succesfull, this \d should work without any problem
|
||||||
|
\d
|
||||||
|
List of relations
|
||||||
|
Schema | Name | Type | Owner
|
||||||
|
--------+------+------+-------
|
||||||
|
(0 rows)
|
||||||
|
|
||||||
|
|
|
@ -153,7 +153,25 @@ DROP FUNCTION citus_table_size(regclass);
|
||||||
SET citus.enable_version_checks TO 'false';
|
SET citus.enable_version_checks TO 'false';
|
||||||
ALTER EXTENSION citus UPDATE TO '6.2-2';
|
ALTER EXTENSION citus UPDATE TO '6.2-2';
|
||||||
|
|
||||||
|
-- Test updating to the latest version without specifying the version number
|
||||||
|
ALTER EXTENSION citus UPDATE;
|
||||||
|
|
||||||
-- re-create in newest version
|
-- re-create in newest version
|
||||||
DROP EXTENSION citus;
|
DROP EXTENSION citus;
|
||||||
\c
|
\c
|
||||||
CREATE EXTENSION citus;
|
CREATE EXTENSION citus;
|
||||||
|
|
||||||
|
-- test cache invalidation in workers
|
||||||
|
\c - - - :worker_1_port
|
||||||
|
|
||||||
|
-- this will initialize the cache
|
||||||
|
\d
|
||||||
|
DROP EXTENSION citus;
|
||||||
|
SET citus.enable_version_checks TO 'false';
|
||||||
|
CREATE EXTENSION citus VERSION '5.2-4';
|
||||||
|
SET citus.enable_version_checks TO 'true';
|
||||||
|
-- during ALTER EXTENSION, we should invalidate the cache
|
||||||
|
ALTER EXTENSION citus UPDATE;
|
||||||
|
|
||||||
|
-- if cache is invalidated succesfull, this \d should work without any problem
|
||||||
|
\d
|
||||||
|
|
Loading…
Reference in New Issue