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

mod_odbc_cdr could write whole INSERT on db failure #2376

Open
MartinJPaterson opened this issue Jan 31, 2024 · 1 comment · May be fixed by #2396
Open

mod_odbc_cdr could write whole INSERT on db failure #2376

MartinJPaterson opened this issue Jan 31, 2024 · 1 comment · May be fixed by #2396
Labels
enhancement New feature or request

Comments

@MartinJPaterson
Copy link
Contributor

mod_odbc_cdr has a useful feature that when writes to the database fail, the data is written to a CSV file. (It can also write every time to another CSV).

The snag is that only the data is written (the part of the SQL query after "VALUES"). As the number and order of fields varies for each insert, to put the data back into the database, you need to delve into the logs to find the rest of each SQL query.

It would be really useful if instead of just writing just the data to a CSV, the 'on failure' part wrote the whole INSERT query. That way after the failure is fixed, it is trivially replayed into the database.

The code to modify is in mod_odbc_cdr lines 342-370 (in v1.10.11), that code writes both the query and the CSV, so the information is right there.

For backwards compatibility the existing CSV behavior needs to be kept, so the new behaviour of writing SQL could be controlled by a new parameters along the lines of the existing CSV parameters: "write-sql" (with values as the CSV equivalent) and the path "sql-path-on-fail".

@MartinJPaterson MartinJPaterson added the enhancement New feature or request label Jan 31, 2024
@andywolk
Copy link
Contributor

I will be happy to review a Pull Request about this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants