diff --git a/pgxn/neon/libpagestore.c b/pgxn/neon/libpagestore.c index e4847939a3..6d21e59961 100644 --- a/pgxn/neon/libpagestore.c +++ b/pgxn/neon/libpagestore.c @@ -213,14 +213,14 @@ get_shard_number(BufferTag* tag) #if PG_MAJORVERSION_NUM < 16 hash = murmurhash32(tag->rnode.spcNode); - hash_combine(hash, murmurhash32(tag->rnode.dbNode)); - hash_combine(hash, murmurhash32(tag->rnode.relNode)); - hash_combine(hash, murmurhash32(tag->blockNum/(MB/BLCKSZ)/stripe_size)); + hash = hash_combine(hash, murmurhash32(tag->rnode.dbNode)); + hash = hash_combine(hash, murmurhash32(tag->rnode.relNode)); + hash = hash_combine(hash, murmurhash32(tag->blockNum/(MB/BLCKSZ)/stripe_size)); #else hash = murmurhash32(tag->spcOid); - hash_combine(hash, murmurhash32(tag->dbOid)); - hash_combine(hash, murmurhash32(tag->relNumber)); - hash_combine(hash, murmurhash32(tag->blockNum/(MB/BLCKSZ)/stripe_size)); + hash = hash_combine(hash, murmurhash32(tag->dbOid)); + hash = hash_combine(hash, murmurhash32(tag->relNumber)); + hash = hash_combine(hash, murmurhash32(tag->blockNum/(MB/BLCKSZ)/stripe_size)); #endif return hash % n_shards; diff --git a/pgxn/neon/pagestore_smgr.c b/pgxn/neon/pagestore_smgr.c index 8238d0bd0c..aa2630c96f 100644 --- a/pgxn/neon/pagestore_smgr.c +++ b/pgxn/neon/pagestore_smgr.c @@ -951,6 +951,16 @@ page_server_request(void const *req) } shard_no = get_shard_number(&tag); + + /* + * TODO: temporary workarround - we stream all WAL only to shard 0 so metadata and forks other than main + * should be requested from shard 0. We still need to call get_shard_no() to check if shard map is up-to-date + */ + if (((NeonRequest *) req)->tag != T_NeonGetPageRequest || ((NeonGetPageRequest *) req)->forknum != MAIN_FORKNUM) + { + shard_no = 0; + } + do { while (!page_server->send(shard_no, (NeonRequest *) req) || !page_server->flush(shard_no));