Skip to content

[fix #183] add lazy start for sqlite transaction#184

Open
Tangruilin wants to merge 1 commit intoduckdb:mainfrom
Tangruilin:fix#183
Open

[fix #183] add lazy start for sqlite transaction#184
Tangruilin wants to merge 1 commit intoduckdb:mainfrom
Tangruilin:fix#183

Conversation

@Tangruilin
Copy link
Copy Markdown

No description provided.

@Tangruilin
Copy link
Copy Markdown
Author

fix: #183

@Tangruilin
Copy link
Copy Markdown
Author

brefore:
image
after:
image

Signed-off-by: reilly <tang.ruilin@foxmail.com>
}

// Slow path: need to open database (on-disk only, with mutex protection)
lock_guard<mutex> guard(db_mutex);
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added mutex in GetDB() to prevent race condition when multiple threads concurrently open the database file - fast path remains lock-free via atomic check. Any alternative suggestions? Or
should we consider not fixing this issue?

@staticlibs
Copy link
Copy Markdown
Collaborator

Hi, thanks for the PR! I will take a look at it.

Copy link
Copy Markdown
Collaborator

@staticlibs staticlibs left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Tangruilin

Hi! I think this implementation may work, but not sure if it goes into the right direction.

I wonder, if instead of delaying opening the DB file even more, we instead can open the file eagerly when ATTACH is called? And keep it open on that catalog instance. Basically to implement the suggestion from this comment.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants