From 4c176763c7619fb678ce38095e6b3e8fb9548186 Mon Sep 17 00:00:00 2001 From: Jimmy Yih Date: Mon, 19 Oct 2020 19:01:19 -0700 Subject: [PATCH] Hardcode missing cdblegacyhash_bpchar in isLegacyCdbHashFunction check Currently, when inserting into a table distributed by a bpchar using the legacy bpchar hash operator, the row goes through jump consistent hashing instead of lazy modular hashing. This is because the cdblegacyhash_bpchar funcid is missing from the isLegacyCdbHashFunction check function which determines if an attribute is using a legacy hash function or not. The funcids currently in that check function come from the auto-generated fmgroids.h header file which only creates a DEFINE for the pg_proc.prosrc field. Unfortunately, cdblegacyhash_bpchar is left out because its prosrc is cdblegacyhash_text. A proper fix would require a catalog change. To fix this issue in 6X_STABLE, we need to hardcode cdblegacyhash_bpchar funcid 6148 into the isLegacyCdbHashFunction check function. This should be fine since the GPDB 6X_STABLE catalog is frozen. This issue was reported by github user cobolbaby in the gpbackup repository while the user was migrating GPDB 5X tables to GPDB 6X: https://github.com/greenplum-db/gpbackup/issues/425 --- src/backend/cdb/cdblegacyhash.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/backend/cdb/cdblegacyhash.c b/src/backend/cdb/cdblegacyhash.c index e9466d63b9..09d63cb0eb 100644 --- a/src/backend/cdb/cdblegacyhash.c +++ b/src/backend/cdb/cdblegacyhash.c @@ -311,6 +311,7 @@ isLegacyCdbHashFunction(Oid funcid) case F_CDBLEGACYHASH_UUID: case F_CDBLEGACYHASH_COMPLEX: case F_CDBLEGACYHASH_ANYENUM: + case 6148: // cdblegacyhash_bpchar return true; default: -- GitLab