Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add HBA config file support, add hba reload logic. #442

Merged
merged 14 commits into from
Jul 4, 2022
Merged

Add HBA config file support, add hba reload logic. #442

merged 14 commits into from
Jul 4, 2022

Conversation

vadv
Copy link
Contributor

@vadv vadv commented Jun 28, 2022

add hba support, based on #276.

@vadv vadv changed the title master add hba support Jun 28, 2022
@chobostar
Copy link

Dear maintainers @reshke @usernamedt @x4m !

I wonder if you could take a look to this PR? If you have a time, of course.


Despite, it might be looks "ugly", but the implementation almost the same in pgbouncer:
https://github.com/pgbouncer/pgbouncer/blob/pgbouncer_1_17_0/src/client.c#L237-L241

The purpose of this PR:

  • the same feature as in pgbouncer, it could soften migration from pgbouncer to odyssey usage
  • consistent and clear way to support access to pooler

p.s. IMO the performance test with/without that feature would be a nice.

@@ -20,17 +20,23 @@ then
exit 1
fi

ody-stop
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Errr, does it work? I think we need to stop old instance, right?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Eithrer way we can remove stop at the end of the file :)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change is ok, ody-stop is called in every test

@reshke reshke changed the title add hba support Add HBA config file support, add hba reload logic. Jul 4, 2022
@reshke
Copy link
Contributor

reshke commented Jul 4, 2022

LGTM

Comment on lines +84 to +94
if (isalnum(*parser->pos)) {
token->type = OD_PARSER_KEYWORD;
token->line = parser->line;
token->value.string.pointer = parser->pos;
while (parser->pos < parser->end && *parser->pos != ',' &&
(isalnum(*parser->pos) || ispunct(*parser->pos)))
parser->pos++;
token->value.string.size =
parser->pos - token->value.string.pointer;
return token->type;
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

so this is keyword parsing, why is it differs from od_parser_next keyword parsing?

        /* keyword */
        if (isalpha(*parser->pos)) {
                token->type = OD_PARSER_KEYWORD;
                token->line = parser->line;
                token->value.string.pointer = parser->pos;
                while (parser->pos < parser->end &&
                       (*parser->pos == '_' || isalpha(*parser->pos) ||
                        isdigit(*parser->pos)))
                        parser->pos++;
                token->value.string.size =
                        parser->pos - token->value.string.pointer;
                return token->type;
        }

for (int i = 0; i < 16; ++i) {
uint8_t client_net_byte = rule_mask->sin6_addr.s6_addr[i] &
sin->sin6_addr.s6_addr[i];
if (client_net_byte ^ rule_addr->sin6_addr.s6_addr[i]) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Such a strange way to write x == y ?

@reshke reshke merged commit f9a1ec2 into yandex:master Jul 4, 2022
@reshke
Copy link
Contributor

reshke commented Jul 4, 2022

Thanks to @sanyabas for initial implementation and @vadv for putting effort on this to be merged, also thanks @chobostar for review

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants