Hello Today I've read this post:
http://blog.2ndquadrant.com/code-coverage/ I think its great and that everyone in this mailing list should familiarize themselves with it. Reading the coverage report, I discovered that some code is never executed. Sometimes its OK (error reporting in out-of-memory cases), sometimes its not (not enough tests). But there are also cases I'm not sure about. For instance there are two flags - HASH_SEGMENT and HASH_FFACTOR that are in fact never used (see attachment). I wonder whether we should keep code like this or not. What do you think? -- Best regards, Aleksander Alekseev http://eax.me/
diff --git a/src/backend/utils/hash/dynahash.c b/src/backend/utils/hash/dynahash.c index 1a9f70c..9b32ceb 100644 --- a/src/backend/utils/hash/dynahash.c +++ b/src/backend/utils/hash/dynahash.c @@ -452,16 +452,6 @@ hash_create(const char *tabname, long nelem, HASHCTL *info, int flags) hctl->num_partitions = info->num_partitions; } - if (flags & HASH_SEGMENT) - { - hctl->ssize = info->ssize; - hctl->sshift = my_log2(info->ssize); - /* ssize had better be a power of 2 */ - Assert(hctl->ssize == (1L << hctl->sshift)); - } - if (flags & HASH_FFACTOR) - hctl->ffactor = info->ffactor; - /* * SHM hash tables have fixed directory size passed by the caller. */ diff --git a/src/include/utils/hsearch.h b/src/include/utils/hsearch.h index 007ba2c..0646a72 100644 --- a/src/include/utils/hsearch.h +++ b/src/include/utils/hsearch.h @@ -81,9 +81,7 @@ typedef struct HASHCTL /* Flags to indicate which parameters are supplied */ #define HASH_PARTITION 0x0001 /* Hashtable is used w/partitioned locking */ -#define HASH_SEGMENT 0x0002 /* Set segment size */ #define HASH_DIRSIZE 0x0004 /* Set directory size (initial and max) */ -#define HASH_FFACTOR 0x0008 /* Set fill factor */ #define HASH_ELEM 0x0010 /* Set keysize and entrysize */ #define HASH_BLOBS 0x0020 /* Select support functions for binary keys */ #define HASH_FUNCTION 0x0040 /* Set user defined hash function */
-- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers