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

File-system ID may be duplicated among databases located on different volumes [CORE6323] #6564

Closed
firebird-issue-importer opened this issue Jun 3, 2020 · 5 comments

Comments

@firebird-issue-importer
Copy link

firebird-issue-importer commented Jun 3, 2020

Submitted by: @dyemanov

Firebird uses file-system ID of the open database file to uniquely name its dependent shared memory files - lock table, event table, etc. File-system ID is retrieved using GetFileInformationByHandle() API and composed from the three fields (dwVolumeSerialNumber, nFileIndexHigh, nFileIndexLow) that are documented in MSDN as providing a unique combination:

https://docs.microsoft.com/ru-ru/windows/win32/api/fileapi/nf-fileapi-getfileinformationbyhandle

"You can compare the VolumeSerialNumber and FileIndex members returned in the BY_HANDLE_FILE_INFORMATION structure to determine if two paths map to the same target; for example, you can compare two file paths and determine if they map to the same directory."

The problem, however, is that Volume Serial Number (VSN) is not guaranteed to be unique. It's generated when then the volume is formatted and it's stored inside the volume's master boot record. But if the volume is cloned at the physical block level, or if a virtual (preformatted) drive is used, or if a volume snapshot (created by storage system like Dell EMC) is attached as a different logical drive, then VSN may duplicate an existing VSN. This may cause two different databases (located on different volumes) to share the same file-system ID thus sharing the same lock table, causing unexpected freezes and other undesired side-effects.

Commits: 9032a60 64bb799

@firebird-issue-importer
Copy link
Author

firebird-issue-importer commented Jun 3, 2020

Modified by: @dyemanov

assignee: Dmitry Yemanov [ dimitr ]

@firebird-issue-importer
Copy link
Author

firebird-issue-importer commented Jun 3, 2020

Commented by: Sean Leyne (seanleyne)

What change you are proposing to resolve this issue?

@firebird-issue-importer
Copy link
Author

firebird-issue-importer commented Jun 4, 2020

Commented by: @dyemanov

Use volume GUID (for local drives) or network share name (for remote drives) instead of the VSN. It's already committed.

@firebird-issue-importer
Copy link
Author

firebird-issue-importer commented Jun 4, 2020

Modified by: @dyemanov

status: Open [ 1 ] => Resolved [ 5 ]

resolution: Fixed [ 1 ]

Fix Version: 3.0.6 [ 10889 ]

Fix Version: 4.0 RC 1 [ 10930 ]

@firebird-issue-importer
Copy link
Author

firebird-issue-importer commented Jun 6, 2020

Modified by: @pavel-zotov

status: Resolved [ 5 ] => Resolved [ 5 ]

QA Status: No test => Cannot be tested

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