Repository navigation
[#415] Implemented the translation and filtering - #508
Conversation
|
I will update the parsing function and the lookup functions as well to use the ART instead of linear solution and update the branch tomorrow. |
1fa3f77 to
adfa009
Compare
|
When it reached the part that I wanted to update, the Solution 1: Take the final result that will be shown to the user and start parsing and identifying the parts where oid/rel/etc appear and remove them from the string and update the string with the mapping. This solution had lots of edge cases that might pop up and will also be complex enough. Solution 2: Search through the function that generates the description attached with every resource manager (fortunately, they were all here) and update the parts that need to be updated. This solution is a lot easier but will require changes in multiple places. I decided to go with the second option because it is obvious what was added/removed and easy to catch the origins of the mistake if anything went wrong. It may not be the best option, but I wanted to explain my thought process also so that all of us are on the same page. |
|
You need to update the documentation |
|
I am on it. |
adfa009 to
6308e64
Compare
|
I updated the docs. |
|
@jesperpedersen @Jubilee101 @sh-soltanpour Can you provide any hints on which APIs I should use to fetch metadata from the server directly? I was searching in files like |
|
@Mohab96 I would just start simple and do new functions in Otherwise you can look at porting parts of |
6308e64 to
197938a
Compare
|
I pushed the patch @jesperpedersen @sh-soltanpour
I will finish the docs after getting approval on the feature itself so that I don't have to update the docs every time I update the feature. |
| } OidMapping; | ||
|
|
||
| extern OidMapping* oidMappings; | ||
| extern int mappings_size; |
There was a problem hiding this comment.
Could you clarify more?
There was a problem hiding this comment.
I think you wanted me to remove them from wal.h as they are not needed outside wal.c, right?
There was a problem hiding this comment.
You should use parameters instead - in and out
There was a problem hiding this comment.
Eventually I will need to make them global because I need the lookup functions in every resource manager to have access to this object which is available globally.
There was a problem hiding this comment.
Shared deque ? We are in-process so it is the same memory context...
@sh-soltanpour Ideas ?
|
I'll continue later |
75d7e23 to
c78adc1
Compare
|
I finished this feature and updated the docs, you can review them now if you want. @jesperpedersen |
|
See CI... You should do a Start with this, and I will circle back |
|
You can do the configuration split (common, main, walinfo) in a separate pull request as you want |
|
|
b896a7d to
41de97c
Compare
The way config files are configured in pgagroal is nice, but I think I will move this to another PR and focus in this PR on the main feature I need to deliver |
|
Currently, If so, this will save a lot of time, allowing me to filter out the configurations that are irrelevant to |
|
@Mohab96 Yes, there will be a minimal "common", a "main" and a "walinfo", and ... so like pgagroal |
|
I'll give it a shot. |
|
@sh-soltanpour What are you seeing ? |
|
I added these lines at the end of the function ptr += sizeof(transaction_id);
memcpy(&wrapper->data.v17.time, ptr, sizeof(pg_time_t));and this is the output before and after I added them |
|
not at the end, just at the order it appears in the struct defnition |
|
I kinda know what caused this problem. I will send a fix to it now in a separate PR, and please test that branch before merging. |
void
check_point_parse_v17(struct check_point* wrapper, void* rec)
{
char* ptr = (char*)rec;
memcpy(&wrapper->data.v17.redo, ptr, sizeof(xlog_rec_ptr));
ptr += sizeof(xlog_rec_ptr);
memcpy(&wrapper->data.v17.this_timeline_id, ptr, sizeof(uint32_t));
ptr += sizeof(uint32_t);
memcpy(&wrapper->data.v17.prev_timeline_id, ptr, sizeof(uint32_t));
ptr += sizeof(uint32_t);
memcpy(&wrapper->data.v17.full_page_writes, ptr, sizeof(bool));
ptr += sizeof(bool);
memcpy(&wrapper->data.v17.wal_level, ptr, sizeof(int));
ptr += sizeof(int);
memcpy(&wrapper->data.v17.next_xid, ptr, sizeof(struct full_transaction_id));
ptr += sizeof(struct full_transaction_id);
memcpy(&wrapper->data.v17.next_oid, ptr, sizeof(oid));
ptr += sizeof(oid);
memcpy(&wrapper->data.v17.next_multi, ptr, sizeof(multi_xact_id));
ptr += sizeof(multi_xact_id);
memcpy(&wrapper->data.v17.next_multi_offset, ptr, sizeof(multi_xact_offset));
ptr += sizeof(multi_xact_offset);
memcpy(&wrapper->data.v17.oldest_xid, ptr, sizeof(transaction_id));
ptr += sizeof(transaction_id);
memcpy(&wrapper->data.v17.oldest_xid_db, ptr, sizeof(oid));
ptr += sizeof(oid);
memcpy(&wrapper->data.v17.oldest_multi, ptr, sizeof(multi_xact_id));
ptr += sizeof(multi_xact_id);
memcpy(&wrapper->data.v17.oldest_multi_db, ptr, sizeof(oid));
ptr += sizeof(oid);
-> memcpy(&wrapper->data.v17.time, ptr, sizeof(pg_time_t));
-> ptr += sizeof(pg_time_t);
memcpy(&wrapper->data.v17.oldest_commit_ts_xid, ptr, sizeof(transaction_id));
ptr += sizeof(transaction_id);
memcpy(&wrapper->data.v17.newest_commit_ts_xid, ptr, sizeof(transaction_id));
ptr += sizeof(transaction_id);
memcpy(&wrapper->data.v17.oldest_active_xid, ptr, sizeof(transaction_id));
} |
|
@Mohab96 Can you look at the PCLMUL on Mac problem too ? Maybe just guard with |
I think the two headers I added should be guarded, that's it. I will send a patch in a moment. |
|
👍 just reuse the issue number |
|
I don't understand what the output of this file should be or what the problem is with it. Can you clarify? @jesperpedersen |
This is the expected output from |
|
This solution works, but at this point, I am not sure whether it is okay to use it for this situation. #include <stddef.h>
void
check_point_parse_v17(struct check_point* wrapper, void* rec)
{
char* ptr = (char*)rec;
// Copy each member using precise offset calculations
memcpy(&wrapper->data.v17.redo,
ptr + offsetof(struct check_point_v17, redo),
sizeof(xlog_rec_ptr));
memcpy(&wrapper->data.v17.this_timeline_id,
ptr + offsetof(struct check_point_v17, this_timeline_id),
sizeof(timeline_id));
memcpy(&wrapper->data.v17.prev_timeline_id,
ptr + offsetof(struct check_point_v17, prev_timeline_id),
sizeof(timeline_id));
memcpy(&wrapper->data.v17.full_page_writes,
ptr + offsetof(struct check_point_v17, full_page_writes),
sizeof(bool));
memcpy(&wrapper->data.v17.wal_level,
ptr + offsetof(struct check_point_v17, wal_level),
sizeof(int));
memcpy(&wrapper->data.v17.next_oid,
ptr + offsetof(struct check_point_v17, next_oid),
sizeof(oid));
memcpy(&wrapper->data.v17.next_multi,
ptr + offsetof(struct check_point_v17, next_multi),
sizeof(multi_xact_id));
memcpy(&wrapper->data.v17.next_multi_offset,
ptr + offsetof(struct check_point_v17, next_multi_offset),
sizeof(multi_xact_offset));
memcpy(&wrapper->data.v17.oldest_xid,
ptr + offsetof(struct check_point_v17, oldest_xid),
sizeof(transaction_id));
memcpy(&wrapper->data.v17.oldest_xid_db,
ptr + offsetof(struct check_point_v17, oldest_xid_db),
sizeof(oid));
memcpy(&wrapper->data.v17.oldest_multi,
ptr + offsetof(struct check_point_v17, oldest_multi),
sizeof(multi_xact_id));
memcpy(&wrapper->data.v17.oldest_multi_db,
ptr + offsetof(struct check_point_v17, oldest_multi_db),
sizeof(oid));
memcpy(&wrapper->data.v17.time,
ptr + offsetof(struct check_point_v17, time),
sizeof(pg_time_t));
memcpy(&wrapper->data.v17.oldest_commit_ts_xid,
ptr + offsetof(struct check_point_v17, oldest_commit_ts_xid),
sizeof(transaction_id));
memcpy(&wrapper->data.v17.newest_commit_ts_xid,
ptr + offsetof(struct check_point_v17, newest_commit_ts_xid),
sizeof(transaction_id));
memcpy(&wrapper->data.v17.oldest_active_xid,
ptr + offsetof(struct check_point_v17, oldest_active_xid),
sizeof(transaction_id));
memcpy(&wrapper->data.v17.next_xid,
ptr + offsetof(struct check_point_v17, next_xid),
sizeof(struct full_transaction_id));
} |
85955b3 to
0795de0
Compare
|
Is it okay to just do this for now? wrapper->data.v17 = *((struct check_point_v17*)rec);
return; |
|
@Mohab96 I think it would be ok Now, we just have to figure out the |
I like this one as well |
I think instead of blindly trying solutions that work in some situations, we should open another issue and find the root cause of the problem and try to solve it. For now, we just want to stay within the scope of this feature as much as possible. Do you agree with me? @sh-soltanpour @jesperpedersen |
0795de0 to
9c2627d
Compare
|
There's only one oid that is not translated, which is called oid and is called in two places only |
|
@Mohab96 I meant on a general pgbench run... But, we can take it separate if @sh-soltanpour agrees |
|
Is there anything else leftover in this PR? |
|
@Mohab96 We need a sign-off from @sh-soltanpour and then we can create issues for the stuff we have found |
9c2627d to
f864b6e
Compare
ok agreed |
|
Nice. This PR has been rebased and is ready to be approved. @jesperpedersen |
|
Merged. Thanks for your contribution ! |
Resolves #415
Now the user can type his OID mappings in json file and run this command to get the names of relations, databases, or tablespaces in the description of the XLOG records by running this command:
and if
--mappingwas missing it will use/etc/pgmoneta/pgmoneta_walinfo_conf.jsonby default.