![]() ![]() ![]() I need the results immediately, not after sqlite decides to process the WAL journal. It's a tiny bit more advanced as the above, but that's basically it and it appears to have cured most issues.Įdit: might have misread your question, was it about the WAL journal mode? Yes the processes do commit the transactions they write. By doing that I can simply delay the reads for a bit when the GUI process tests to open the lock file and that appears to have cured most problems. This is done via a separate lock file that is opened exclusively before any write action and closed after the write. The 'database is locked' problem seemed to happen most while the daemon user is writing and the normal user is reading.įor the moment I added a patch to my apps whereby the applications handle the locking by itself at a slightly higher level as I got a bit tired of the problem. Yeah, they both can write, although almost all of the writes are done by the daemon process and the normal user (the GUI process) reads and processes the results. Of course it is possible I am still doing something wrong, but at this moment it doesn't look like the WAL journal mode is an option for my app.Ī pity as I expected -without WAL- to be able to read when another process is writing, well just a delayed read would be fine, but instead there's a -database is locked- error that pops up to the user. Even tried it with setting read_uncommitted to true, but that did not help either. For my use case that isn't an improvement as writes made by either user should be visible by the other user. So I tried it out this morning and found that any writes are invisible unless I restart the app to close the database. That by itself might be an uncommon scenario. One is a normal user, the other one is root for a daemon process. The database is only opened by 2 users on the same machine. So I read about WAL mode down here and cheered because it sounded like it would solve the occasional "database is locked" error that the app I am working on is bumping into. I'm betting against it being a Good Thing in the long run. To put it bluntly: systemd has neither the hacker nature nor the UNIX nature, and history has been unkind to OSs with neither. The systemd folks are falling into the Microsoft and Apple trap by trying to anticipate how their software will be used, instead of building it so it can easily be hacked upon for uses they themselves haven't dreamed of (which oddly seems to include 'servers'). That way they can be composed, filtered and transformed in ways not yet dreamed of by their creators. Systemd is in many respects a major departure from UNIX philosophy, and I predict it will mark an inflection point in the quality and usability of Linux distros that adopt it, hence my efforts to migrate my own systems to FreeBSD.įor those wondering what I'm banging on about, please read The Art of UNIX Programming, which should have been called The Philosophy of UNIX:Įdit: what I mean by fundamental is that it shouldn't matter whether the tools are intended for desktop or server use they should be designed to interoperate seamlessly using text protocols via pipes, sockets and files. If I only want to log certain data and disregard stderr, or if I can guarantee everything that gets written to stderr will be valid JSON, writing logs as JSON may be better.īut more fundamentally than the desktop / server focus, they either don't understand or don't value what makes UNIX great. Of course, it's a case-by-case, pragmatic decision. If I need to, I can then modify the PEG for that use case. Having a PEG for those cases means I can still get JSON for everything if I need to, even if the data in the log is unexpected. stderr is pretty much a catch-all log stream, and some 3rd party software insist on writing to it (most do however offer a way to override this behavior, e.g., chromium-headless, libxml2, &c). Most JSON libraries supports this.Īs for general logging: I prefer it to be structured text written to stderr, and have a PEG parsing it for me. Just parse objects incrementally, one at a time. ![]() Or any variations of common whitespace between the objects. However, requiring records to be line-delimited is a point of failure when accepting input from external sources. For certain tasks, I like to work on streams of JSON records too. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |