-
-
Notifications
You must be signed in to change notification settings - Fork 5.6k
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
Adjust error for already locked db and prevent level db lock on malformed connstr #18923
Adjust error for already locked db and prevent level db lock on malformed connstr #18923
Conversation
…rmed connstr This PR adjusts the error returned when there is failure to lock the level db, and permits a connections to the same leveldb where there is a different connection string. Reference go-gitea#18921 Reference go-gitea#18917 Signed-off-by: Andrew Thornton <[email protected]>
is backportable |
db.name = append(db.name, connection) | ||
m.LevelDBConnections[connection] = db |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
db.name = append(db.name, connection) | |
m.LevelDBConnections[connection] = db |
If we run into this if
, then neither connection
nor uri
exists in the LevelDBConnections
.
But here the code only append the connection
to the name list, but no uri
, is it by purpose?
In my opinion:
- Either we keep consistent that we append both non-existing
connection
anduri
into the name list - Or append nothing (remove these 2 lines), because the logic is sill correct, no performance degrade, and more simple.
Since the old code works, this comment is not a blocker.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It prevents the repeated logging of the same message
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But it's not complete.
Current code It only prevents repeated logging for the new connection
, but not for the new uri
with the same directory. (that the case 1)
And I do not think there will be repeated loggings, the queues call GetLevelDB
for open the db
, there seems no repeated calls (so that why case 2 is also fine because there seems to be no repeated log messages)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes it absolutely does prevent repeated logging of the same message. The log message doesn't contain the inferred URI. The point is to tell the server user which strings in their configuration are incorrect.
There are multiple queues. Depending on the order of initialisation and state of the incorrect configuration without this you face repeatedly seeing the same warning message.
|
The error |
Signed-off-by: Andrew Thornton <[email protected]>
I've adjusted the CloseLevelDB to also look for the datadir too. |
make lgtm work |
…rmed connstr (go-gitea#18923) Backport go-gitea#18923 This PR adjusts the error returned when there is failure to lock the level db, and permits a connections to the same leveldb where there is a different connection string. Reference go-gitea#18921 Reference go-gitea#18917 Signed-off-by: Andrew Thornton <[email protected]>
* giteaofficial/main: Adjust error for already locked db and prevent level db lock on malformed connstr (go-gitea#18923) Avoid database lookups for `DescriptionHTML` (go-gitea#18924) Update go-org to v1.6.1 (go-gitea#18932) Fix trace log to show value instead of pointers (go-gitea#18926) Add announcement steps to release-howto (go-gitea#18896) Fix `<strong>` html in translation (go-gitea#18929)
…rmed connstr (#18923) (#18938) Backport #18923 This PR adjusts the error returned when there is failure to lock the level db, and permits a connections to the same leveldb where there is a different connection string. Reference #18921 Reference #18917 Signed-off-by: Andrew Thornton <[email protected]>
…rmed connstr (go-gitea#18923) This PR adjusts the error returned when there is failure to lock the level db, and permits a connections to the same leveldb where there is a different connection string. Reference go-gitea#18921 Reference go-gitea#18917 Signed-off-by: Andrew Thornton <[email protected]>
This PR adjusts the error returned when there is failure to lock the level db, and
permits a connections to the same leveldb where there is a different connection string.
Reference #18921
Reference #18917
Signed-off-by: Andrew Thornton [email protected]