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

ALTER DATABASE command does not get replicated and gets OSecurityAccessException that always references 'writer' user #7295

Closed
dalegarv opened this issue Apr 3, 2017 · 14 comments
Assignees
Labels

Comments

@dalegarv
Copy link

dalegarv commented Apr 3, 2017

OrientDB Version: 2.2.17 Enterprise

Java Version: 1.8

OS: SLES

Expected behavior

Running OrientDB distributed with 2 nodes, an alter database command run from node1 with root or admin or any user with update database permissions should replicate to node2 without an error. For example ALTER DATABASE DATEFORMAT 'yyyy'

Actual behavior

The change is only made on node1 an exception like the following is thrown:
com.orientechnologies.orient.core.exception.OSecurityAccessException: User 'writer' does not have permission to execute the operation 'Update' against the resource: ResourceGeneric [name=DATABASE, legacyName=database].null DB name="Entitlements-BDD"

The exception references user 'writer' no matter what user is actually logged in to node1 and for some reason has ".null" as the database resource. The problem doesn't happen from node2 and it is currently only happening in one database and not others.

Steps to reproduce

  1. Setup OrientDB with 2 nodes
  2. Run node1 in single mode and use the import command to create a database
  3. Start node1 and 2 in distributed mode which will replicate the database
  4. Run an alter database command from node1
    We have 2 databases that were created this way, and only 1 has the problem and the problem only happens on node1 so it may not be easy to reproduce.
@lvca lvca assigned SDIPro and unassigned lvca Apr 7, 2017
@santo-it
Copy link

santo-it commented Apr 8, 2017

Hi,

Thanks for opening this issue. I have tried to reproduce it on Window 10, with a 4-nodes cluster but wasn't able.

I executed ALTER DATABASE DATEFORMAT 'yyyy' from node 1 and all other nodes shown correct value. Then I executed ALTER DATABASE DATEFORMAT 'yyyy-mm-dd' from node 4 and verified it replicated correctly to the other nodes. I was connected with the admin user.

I have created an empty database (instead of doing an import in single mode). We will try to test the scenario when an import from JSON is made.

If you have any additional details on how to reproduce this, please let us know.

Many thanks,

@dalegarv
Copy link
Author

dalegarv commented Apr 8, 2017

Thanks for researching this issue. The only other details I can think of is that after performing the import and restarting the cluster, we run a console script remotely connected with with a server user. The script removes the admin user from the database using DELETE from OUser where name = 'admin', and then it runs the ALTER commands. The script was successful one time, but then it started getting the exception the second time it ran. Once the exception started, we were no longer to run any ALTER commands on the database from node 1 with any user. We also tried removing the writer user completely from the database using node 2, and the exception still references a writer user even though none exists.

We've been able to successfully run this script multiple times against the same database using node 2, and also multiple times using node 1 against another database that was created using the same process with the same import JSON. So this appears to be a one off problem.

I was hoping that maybe you could tell from the code a condition that would cause this exception that always references the writer user even when there isn't one and has the database resource as .null If not, then I guess you can close the issue as not reproducible and we'll reopen if it happens again.

@dalegarv
Copy link
Author

We're now seeing this same error in another environment, but this time the error happens on both the nodes in the cluster so we cannot perform any alter database commands. Do you have any idea what could cause this problem?

@dalegarv
Copy link
Author

I found that I also get a ‘writer’ error when I try to add a property to a class on either node while logged in as the root user:

CREATE PROPERTY AuditEvent.deletedAt DATETIME (MANDATORY FALSE, NOTNULL FALSE, READONLY FALSE)

com.orientechnologies.orient.core.exception.OSecurityAccessException: User 'writer' does not have permission to execute the operation 'Update' against the resource: ResourceGeneric [name=CLUSTER, legacyName=database.cluster].internal DB name="Entitlements-IPE"

The property is added to the node where I run the command, but it’s not replicated. I’ve tried changing the writer role so that it has all the cluster and cluster.internal permissions on both nodes, but I still get the error.

@dalegarv
Copy link
Author

We have another database that has this problem. The first database now doesn't even show up in the list of databases even though the directory still exists.

@RAndrews137
Copy link

I believe this issue is no longer occurring. @dalegarv, can you please confirm. If so, can you please mark this ticket as closed?

@dalegarv
Copy link
Author

hi @RAndrews137, we've only seen this error on databases where we used the import work around where we imported in single mode and then restarted the cluster in distributed mode. We've stopped using the import all together and haven't seen the issue since. Do you still think we should close it?

@RAndrews137
Copy link

@dalegarv, I agree the import issue still likely exists. @SDIPro, this ticket is not urgent at this moment since we have a workaround. However, being able to perform an import into a clustered environment is still core functionality for most database systems and would still be a good area for OrientDB to improve upon for the future. Thanks

@santo-it
Copy link

santo-it commented Jul 3, 2017

Hi @RAndrews137,

Absolutely. There's an enhancement open already for this: Issue #7268 . I believe this one can now be closed - and Issue #7268 will remain open.

Thanks,

@dalegarv
Copy link
Author

dalegarv commented Jul 3, 2017

hi @santo-it, we actually saw this error again recently on a database that was not created using an import. The two nodes were running on the same VM in a test environment, and when we got the error we saw a socket exception preventing the nodes from replicating. When we restarted the nodes, the error went away. Could this be a case of a bad error message?

@santo-it
Copy link

Hi @dalegarv,

It could be. Frankly we haven't been able to reproduce this yet.

Thanks,

@lvca
Copy link
Member

lvca commented Jul 21, 2017

If there was a network error, it's absolutely possible that was the cause. WDYT if we close this issue and if you guys see this again you reopen it?

@dalegarv
Copy link
Author

dalegarv commented Jul 21, 2017 via email

@mxns
Copy link

mxns commented Dec 6, 2017

I am having a similar issue. In a two node scenario, a DELETE on one node yields the same error/debug message. The record seems to be deleted at the node where the delete is executed, but not on the other. If there was something wrong with the user permissions, that would mean the record should not get deleted at all, right?

A workaround is to use the "root" user, but I would ofc prefer to get the permissions right. Note that the database has not been imported.

The whole thing is described on this StackOverflow entry.

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

No branches or pull requests

8 participants