mirror of https://github.com/citusdata/citus.git
Don't create hash-table of zero size in TaskHashCreate().
hash_create(), called by TaskHashCreate(), doesn't work correctly for a zero sized hash table. This triggers valgrind errors, and could potentially cause crashes even without valgring. This currently happens for Jobs with 0 tasks. These probably should be optimized away before reaching TaskHashCreate(), but that's a bigger change.pull/834/head
parent
6d050bc9f8
commit
de32b7bbad
|
@ -519,6 +519,15 @@ TaskHashCreate(uint32 taskHashSize)
|
||||||
int hashFlags = 0;
|
int hashFlags = 0;
|
||||||
HTAB *taskHash = NULL;
|
HTAB *taskHash = NULL;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Can't create a hashtable of size 0. Normally that shouldn't happen, but
|
||||||
|
* shard pruning currently can lead to this (Job with 0 Tasks). See #833.
|
||||||
|
*/
|
||||||
|
if (taskHashSize == 0)
|
||||||
|
{
|
||||||
|
taskHashSize = 2;
|
||||||
|
}
|
||||||
|
|
||||||
memset(&info, 0, sizeof(info));
|
memset(&info, 0, sizeof(info));
|
||||||
info.keysize = sizeof(TaskMapKey);
|
info.keysize = sizeof(TaskMapKey);
|
||||||
info.entrysize = sizeof(TaskMapEntry);
|
info.entrysize = sizeof(TaskMapEntry);
|
||||||
|
|
Loading…
Reference in New Issue