while I try to remove group from casbin, only the data in memory is deleted, it still exist in mysql
yu-hailong opened this issue · comments
yu-hailong commented
casbin-bot commented
yu-hailong commented
-
create policy , it is normal : I can find it in memory and mysql
-
I try to remove them using
enforcer.removeFilteredNamedPolicy(pType,0,e);
enforcer.removeGroupingPolicy(id, parentId);
remove p and g policy, but I found the data in memory is removed, but the data in mysql is still there -
version info:
<dependency>
<groupId>org.casbin</groupId>
<artifactId>jcasbin</artifactId>
<version>1.21.0</version>
</dependency>
<dependency>
<groupId>org.casbin</groupId>
<artifactId>jdbc-adapter</artifactId>
<version>2.2.1</version>
<exclusions>
<exclusion>
<groupId>org.postgresql</groupId>
<artifactId>postgresql</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.casbin</groupId>
<artifactId>jcasbin-redis-watcher</artifactId>
<version>1.4.1</version>
</dependency>
Eric Luo commented
nohup commented
The reason is that the retry mechanism used by addPolicy()
in jdbc-adapter-2.2.1
turned off the autocommit
of the connection and forgot to reopen it, resulting in no automatic commit in removePolicy
.
It's has been fixed in jcasbin/jdbc-adapter#50. Try jdbc-adapter
lastest version.