[Bucardo-general] Patch to Enable Filtering in bucardo_add_delta functions
Ben Allen
bsa at lanl.gov
Fri Mar 27 17:07:08 UTC 2009
I never got any input on this patch from anyone. Is this useful to
anyone else, or should I just keep these changes local?
Thanks,
Ben
On Mar 12, 2009, at 3:47 PM, Benjamin Allen wrote:
> Hello Everyone,
>
> To solve the problem Meg and I were having with being able to filter
> out data from a table (goat) from being synced I've added a
> goatfilter table to the bucardo database and modified the
> validate_sync function. The table has an id, status, FK to the goat
> table, and a src_code column. The src_code column is used to store
> the source code of the bucardo_add_delta function for whichever goat
> you're working with. Our example is attached, so the goatfilter
> table would be populated like so:
>
> INSERT INTO goatfilter VALUES ( DEFAULT, 12, $$
> SOURCE_CODE GOES HERE
> $$ );
>
> Where 12 is the goat.id of the goat you're working with.
>
> Limitations as of right now:
>
> - The src_code of goatfilter totally replaces the default function
> source code if it exists. This is a bit clunky as you have to store
> the entire function in the src_code column.
> - Maybe instead of writing out the entire function, we could insert
> just a chunk of code into the already existing code. If you look at
> the example function you can see we only added code at the beginning
> of the function.
>
> - Even though the data we want filtered is not added to the
> bucardo_delta table the sync is still kicked when filtered data is
> touched in the database.
> - Fixing this would involve doing filtering in the
> bucardo_triggerkick function.
>
> - Current modifications to the validate_sync method takes just the
> first row from the select statement on the goatfilter table for a
> given goat.id. There's no validation that only one entry is created
> in the goatfilter table per goat.
>
> I'm wondering if anyone can think up a better way or place of doing
> filtering of data. I've explored using PostgreSQL Views and Bucardo
> customcode and found no real logical way of doing it. By filtering
> it at the bucardo_add_delta function its eliminating any additional
> network traffic and processing from Bucardo. Thoughts?
>
> Regards,
>
> Ben Allen
>
>
>
> <bucardo_filter.patch><bucardo_add_delta_custom.sql>
>
>
> _______________________________________________
> Bucardo-general mailing list
> Bucardo-general at bucardo.org
> https://mail.endcrypt.com/mailman/listinfo/bucardo-general
More information about the Bucardo-general
mailing list