Repository navigation
feat: Enhance relpath error handling and validation - #505
Conversation
|
@sh-soltanpour Can you take a look ? @7amo10 You need |
|
There is something up... leave out any changes that you didn't change; I mean files |
|
yeah @7amo10 please remove unwanted changes and squash your commits based on this guide and I'll take a look |
aaf22cf to
cd0f579
Compare
|
@sh-soltanpour |
|
@7amo10 Take a look at your patch, and remove unneeded changes. |
cd0f579 to
c437603
Compare
|
I’ve updated the commit with the changes to Could you clarify if there’s anything else you’d like me to adjust or improve? |
|
Apply those comments over the entire patch |
c437603 to
1546660
Compare
|
@jesperpedersen
Please review and let me know if any further adjustments are needed. Thanks for your guidance! |
| char* | ||
| pgmoneta_wal_get_catalog_version_number(void) | ||
| { | ||
| if (!server_config || server_config->version < MIN_PG_VERSION || |
There was a problem hiding this comment.
Everything other than !server_config is already handled in the switch case
| error: | ||
| if (result) | ||
| { | ||
| free(result); |
There was a problem hiding this comment.
if is not needed, free(NULL)
If ptr is a null pointer, the function does nothing.
| error: | ||
| if (path) | ||
| { | ||
| free(path); |
| free(version_directory); | ||
| } | ||
|
|
||
| if (!path) |
There was a problem hiding this comment.
why do we need the if here?
| goto error; | ||
| } | ||
|
|
||
| catalog_version = pgmoneta_wal_get_catalog_version_number(); |
There was a problem hiding this comment.
you're already handling this in pgmoneta_wal_get_catalog_version_number
1546660 to
37f7864
Compare
| spcNode, version_directory, | ||
| dbNode, backendId, relNode); | ||
| } | ||
| path = pgmoneta_format_and_append(path, |
There was a problem hiding this comment.
IMO the if and else approach is easier to read. WDYT? @jesperpedersen
There was a problem hiding this comment.
You both agreed that the if and else approach is easier to read. Just to confirm, are you suggesting restructuring the function to improve readability while keeping the same logic? Or do you mean that we should avoid refactoring it further since it's already structured with if-else? Let me know how you'd like me to proceed!
|
@7amo10 Can you rebase, and fix the above ? |
37f7864 to
6a10a22
Compare
| return forkNumber >= MAIN_FORKNUM && forkNumber <= INIT_FORKNUM; | ||
| } | ||
|
|
||
| static const char* const FORK_NAMES[] = { |
| goto error; | ||
| } | ||
|
|
||
| path = pgmoneta_format_and_append(path, |
| path = pgmoneta_format_and_append(path, "base/%u/%u", | ||
| dbNode, relNode); | ||
| } | ||
| path = pgmoneta_format_and_append(path, |
| path = pgmoneta_format_and_append(path, "base/%u/t%d_%u", | ||
| dbNode, backendId, relNode); | ||
| } | ||
| path = pgmoneta_format_and_append(path, |
| spcNode, version_directory, | ||
| dbNode, backendId, relNode); | ||
| } | ||
| path = pgmoneta_format_and_append(path, |
27fcd01 to
7e89605
Compare
| path = pgmoneta_format_and_append(path, "base/%u/%u", | ||
| dbNode, relNode); | ||
| } | ||
| path = pgmoneta_format_and_append(path, |
| path = pgmoneta_format_and_append(path, "base/%u/t%d_%u", | ||
| dbNode, backendId, relNode); | ||
| } | ||
| path = pgmoneta_format_and_append(path, |
| spcNode, version_directory, | ||
| dbNode, backendId, relNode); | ||
| } | ||
| path = pgmoneta_format_and_append(path, |
|
You need to fix the |
7e89605 to
2a24b7a
Compare
|
You need to reference the issue number in the commit subject -- see the git log for examples |
2a24b7a to
0f40eb1
Compare
0f40eb1 to
1bd64e2
Compare
Please review the this and merge whenever you have time. |
|
Merged. Thanks for your contribution ! |
Changes
Technical Details
is_valid_fork_number()validation helperMIN_PG_VERSIONandMAX_PG_VERSIONconstantserrnocodes