On Mon, Feb 13, 2017 at 6:24 PM, Robert Haas <robertmhaas@gmail.com> wrote: > I don't think it's acceptable (or necessary) to move the DSA > definitions into postgres.h. Why do you think you need to do that, > vs. just including dsa.h in a few more places?
I need to access dsa_pointer in tidbitmap.h, which is included from FRONTEND as well. Now, problem is that dsa.h is including #include "port/atomics.h", but atomic.h can not be included if FRONTEND is defined.
#ifndef ATOMICS_H #define ATOMICS_H #ifdef FRONTEND #error "atomics.h may not be included from frontend code" #endif
Is there any other solution to this ?
How about creating another header file with the parallel changes
and include it only in necessary places?
Following are my observations, while going through the patch.
+#if SIZEOF_DSA_POINTER == 4
+typedef uint32 dsa_pointer;
+#else
+typedef uint64 dsa_pointer;
+#endif
I feel the declaration of the above typdef can be moved into the
section above if we going with the current move into postgres.h
file.
+/*
+ * tbm_alloc_shared
+ *
+ * Callback function for allocating the memory for hashtable elements.
+ * It allocates memory from DSA if tbm holds a reference to a dsa.