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

Policy_rules rows are not deleted in database #2912

Open
maigl opened this issue Nov 19, 2024 · 3 comments
Open

Policy_rules rows are not deleted in database #2912

maigl opened this issue Nov 19, 2024 · 3 comments

Comments

@maigl
Copy link

maigl commented Nov 19, 2024

Describe the problem

I noticed that for every policy I get one entry in the policies table and one entry in the policy_rules table. If I delete the policy, the entry from the policies table is removed, but not from the policy_rules table. As I create and delete many many policies I have a table that grows and grows.

To Reproduce

  1. create a policy
  2. check size of policies table, it grows by 1
  3. check size of policy_rules table, it grows by 1
  4. delete policy
  5. check size of policies table, it shrinks by 1
  6. check size of policy_rules table, it NOT shrinks by 1

Expected behavior

I expect to not have a table that grows forever.

Are you using NetBird Cloud?

no

NetBird version

0.32.0

@mlsmaycon
Copy link
Collaborator

@bcmmbaga what do you think might be causing that?

@bcmmbaga
Copy link
Contributor

The issue is likely caused by SQLite not enforcing foreign key constraints.

You can check if foreign key enforcement is enabled in your SQLite database:

PRAGMA foreign_keys;

If the result is 0, foreign key constraints are not being enforced.

@maigl
Copy link
Author

maigl commented Nov 20, 2024

.. right

/var/lib/netbird $ sqlite3 store.db 
SQLite version 3.45.3 2024-04-15 13:34:05
Enter ".help" for usage hints.
sqlite> PRAGMA foreign_keys;
0

should I need to change sqlite settings myself? Can I just safely do that? I thought maybe there is some other good reasons why the policy_rules are kept?!

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

No branches or pull requests

4 participants