-
Notifications
You must be signed in to change notification settings - Fork 8
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
feat(pgq): Add first version of queue validator #7
Conversation
Hi @syordanov94, in a first place, thank you for your contribution. Your idea is compatible with us for sure, because we already do some limited table check here: Lines 292 to 345 in 25e98a5
If you could modify the function and add the type check, please. And about the |
Hey @prochac Oh, I didn't see this function 😅 It basically does the same as the Do you want validation to be mandatory? This is because I added an optional parameter in the config to enable validation. But given that it already validates it in prod, I guess it doesn't make sense to add optional validation now 😅 Also regarding the Thanks for answering. Once I get some time I will try and "re-write" my proposal 👍 |
First of all, merry christmas! I hope you guys are enjoying your holidays. I have made some updates to your Feel free to check it out and let me know if you find it useful. Best Regards |
@syordanov94 I do have some pending review, but it's hard to find some concentration in these pesky times 😄 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Finally, I reserved some time. Sorry it took so long. Holidays + tasks stacked during holidays 😬
Here are some cheap change requests. Now I will dive deeper into the other things.
Please, rebase your code. I tried and there is just a small conflict at consumerConfig struct
in comsumer.go
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The use of array_to_string
has some limits:
DROP TABLE IF EXISTS "stupid_table";
CREATE TABLE "stupid_table"
(
"foo,bar" INT NOT NULL,
"baz" INT NOT NULL
);
CREATE INDEX "stupid_table_foo,bar_baz" ON "stupid_table" ("foo,bar", "baz");
SELECT
i.relname as index_name,
array_to_string(array_agg(a.attname), ', ') as column_names
FROM
pg_class t,
pg_class i,
pg_index ix,
pg_attribute a
WHERE
t.oid = ix.indrelid
and i.oid = ix.indexrelid
and a.attrelid = t.oid
and a.attnum = ANY(ix.indkey)
and t.relkind = 'r'
and t.relname = 'stupid_table'
GROUP BY
t.relname,
i.relname
ORDER BY
t.relname,
i.relname;
865ba0d
to
7fa3f7b
Compare
Hey @prochac! Thanks for the detailed review! I have made all the mentioned changes you suggested. Please feel free to re-review! I ran the tests locally and everything seems ok |
The tests are not passing. Is necessary to have validator in separate package and having it exported? |
Hey @prochac Sorry, I was missing an import in the Regarding the package where the validator should be located, yes it can reside in the pgq package. I added it to the validator package just because I like to split these types of features per package (maybe something more "me" 😆) because, if you have multiple validation methods (maybe some manual validation or use some external library or something) it's easier to integrate it. But pgq package works fine, I have added it! Can you re-review? And re run the tests? btw, the duplication of the |
@syordanov94 |
Thank you @syordanov94 for contribution. If you use |
Hello all
I met @kedlas at Golab 2023 and, after some talking, I proposed that maybe having some queue validations would be useful to assure that the user does not use "invalid" queue schemas.
In this PR you will find a first version of this queue validator that includes the following:
You will see that I have left some TODOs for future additions like index validations, more precise error msgs when validating, etc.. feel free to implement any of these (maybe if I have more free time I might do some of them as well 😄)
I would appreciate any comment and suggestion you might have. I hope you find my proposal interesting ❤️
Thanks and great job on this project, it's very cool!