- Feature Articles
- CodeSOD
- Error'd
- Forums
-
Other Articles
- Random Article
- Other Series
- Alex's Soapbox
- Announcements
- Best of…
- Best of Email
- Best of the Sidebar
- Bring Your Own Code
- Coded Smorgasbord
- Mandatory Fun Day
- Off Topic
- Representative Line
- News Roundup
- Editor's Soapbox
- Software on the Rocks
- Souvenir Potpourri
- Sponsor Post
- Tales from the Interview
- The Daily WTF: Live
- Virtudyne
Admin
Developers like that should be kept away from a database as far as possible, and be discplined with a motivator (read: beaten with a stick).
Admin
Being a DBA, I do agree with you, especially on the motivator :-)
However, we managed to keep them away so well that now they're coming back with all sorts of new square wheels like all the nosql thingamajig.
There's no way to solve the problem: people don't like to study, they only want to pretend to be creative by re-doing everything from scratch.
The only way out is to be sure to be retired before someone asks us to cleanup the "eventual consistency" mess that will pile up (as if we don't have already tons of bad data...)
Admin
Admin
Using MySQL is not in your defense .. it goes showing that you are not a DBA and have a lot to learn in the field ;)
Seriously . MySQL was a WTF before InnoDB, and it's STILL a WTF even with InnoDB. It's not ACID compliant, most of the implemented features are half-implemented at the incorrect layer (like trying to make something reliable on top of an unreliable engine ...)
Anyone who uses MySQL and does not recognize that it is altogether a failure of a DBMS should not call themselves DBA.
F*ck MySQL, it's a noob webdev's toy, not a database.
Admin
Dude. you suck.
That way of doing things is retarded . like way retarded. but w/e .. if you want to reinvent the squared wheel, feel free to explain to everyone how to do it ...
Seriously, when you don't understand what you're doing, don't give any fricken advice !
Do you have any clue how much of an issue it is for noob devs coming later on and reading/believing your crap ???
Not necessarily. Update/Rollback ??? WHY DID YOU F****ING UPDATE IN THE FIRST PLACE YOU GODDAMN ... leprechaun (random word replace)
Yes.. because user A needs to be notified when he edits CI #226587 of table T -- that user B edited CI # 287675 ... Right ! put on the smartypants for victoryyy !
On the friggin table .. really. that makes so much sense I would personally cut your hands to prevent you from typing anything like that or touching anything like a database.
WTF ??? WHY ??? yes I would like two liters of additional conditions for my where clauses, thx dude.
A single sql rowcount .?? WHAT THE F*CK ???? WHY ? omg . you are so .. brilliant I should consider giving you a promotion.
Now ... back to WHAT you were trying to achieve ... you wish to handle some CC manually through users in order to avoid blind overwrite of states, i.e. S1->S3->S2 wtf-type.
The "transactions" from the human point of view are :
read S1 edit write S2
AND:
read S1 edit write S3
The only thing you need to do is to make sure currentstate=S1 just before you write S2 or S3.
As you provided your application with S1 info prior to the edit, you have a good basis for comparison.
Thus, when you send your 'write' instruction, you will simply verify that the stored state matches S1 (not with a query unless you know your types are perfect - much better off if you do it in your server-side code as type transformations through the SQL connector might not be failsafe).
Well, so you do this :
Read S1
Edit (manual human op)
Read CurrentState (write lock - select for update)
if(S1==CurrentState){ update }else{ alert('wtfhaxx : S1 =, CurrentState=') } release lock
Then if it failed, the user gets to keep his edited info, consult the CurrentState, makes changes he wants, posts it back with an S1 now equal to the last retrieved data (i.e. CurrentState).
Seriously . takes more time to write than to figure out --
Also, I do contracting work in case you need someone how actually knows what he's doing --
Admin
Capitalizing on your remark, I would like to offer the TDWTF troll community a new meme to replace "TRWTF is VB" which is not getting much love these days anyway ..
"TRWTF is MySQL" or "TRWTF is people who use MySQL" or "TRWTF is MySQL"
God bless the toy database for noob webdevs !
Admin
I think that "disciplined with a motivator" sounds too strict. How about "...encouraged to onboard the appropriate value-system through proactive reward-based coaching...". (Sorry - I sit within earshot of HR... :-).
Admin
Starting at the end, the only reason I can imagine to write an all-assembler OS is if you are doing microprocessor validation (which I was). In that case, you cannot trust the microprocessor to get everything right, and the lock instructions are complicated.
Now, you are correct that a normal queue is subject to the same sort of contention issues as any other access. If you have an ACID database, there is an easy enough solution to the problem. Working with memory, however, the "queue" is implemented as a series of bytes. Each thread gets a byte. Single-byte writes don't mess with their neighbors. As long as you can read all the bytes for all the threads at once, you can tell who has their hand raised. Turning that into a proper queue requires some additional paperwork, which, in the above list, which is maintained as part of the lock release.
If you can't read them all at one time, you nest. :-E
Admin
First, all I did was read the paper & adapt it. No congratulations needed. Second, I never advocated using such a solution for any particular problem. I was concerned that people reading the comments might believe that some of the proposed solutions were adequate, and wanted to set the record straight.
BY ALL MEANS, use builtins when you can. (And if you can't, try harder.) But if you insist on home-brew, the above will work.
Admin
Most probably the worst thing I have ever seen...
Admin
Transaction = do a bunch of work (while tracking what you relied on to do the work) in the hope that you can commit the result, then try to commit the result (and fail if you detect that something you relied on changed in the meantime).
Locks = get any lock/s needed to guarantee you can do the work, then do the work.
Of course there's no reason why you couldn't mix locks and transactions to get a hybrid scheme with the disadvantages of both techniques.
The transaction isolation levels look like a feeble attempt to avoid some of the overhead of "foolproof" (serializable) transactions by breaking consistency guarantees (and therefore creating something that aren't true transactions and don't meet ACID rules). The existence of isolation levels is an admission that "foolproof" (serializable) transactions suck for performance/scalability (and that the performance is so bad that the risks associated with allowing consistency guarantees to be broken/ignored are justified).
Admin
I think Junkyard Science was thrown by your use of the parenthetical "(Since we're talking databases, use an auto incrementing key.)" and missed the earlier "Such as when you are writing a memory manager for an all-assembly micro OS."
Admin
You turn off interrupts :-P
Admin
In db__locks, fill in the __ with "ol" and you will solve the puzzle.
Admin
If you ever should decide on not using transactions (where I don't see any reason at all for), you could as well write it good.
For example you can write your lock as:
It's definitely slower than transactions, and it only solves the locking issue and you can't rollback unless you build in something for that too. But at least this should work so you wouldn't need an "admin" tool.
Can I advice strongly against this approach? :-)
Admin
Admin
Complete moron code.
Admin
Depends on your definitions, I suppose, but off the top of my head I'd certainly list:
Von Neuman machines (stored program computers)
Assembly language
Compiled languages
On-line text editors
Structured programming
Object-oriented programming
Automated debuggers
Integrated development environments
Network Databases
Relational databases
Source code control
At a lower level I can think of things like:
"families" of microchips that share a common machine language
cross-assemblers and cross-compilers
I'm sure with a little thought one could come up with many similar meta-solutions in the IT world.
Admin
I'm hoping this is a joke.... if not...... TRWTF!
Admin
The humility of the story's first paragraph is overwrought. World hunger?! I posit that most of the world's hunger is caused by politics, not by technical means -- but set that aside. It's not even remotely possible that one person is going to "solve" a problem having literally billions of details. But thousands or millions of good people can each make tiny contributions that add up to immense improvement. This relates to ordinary programmers: you make a change to the way other people work; it's a little less costly or a little less error prone. Fewer resources are spent or lost by these others, leaving them more time or money (or stuff!) to do other things. The gain is all in the margins; you cannot trace it, but it's there and adds to the other gains made by others doing similar things. You CAN see the accumulation: the tools and methods of 1000 BCE could feed only a few million people, but the tools and methods today can feed a few billions. Rejoice in your part of that.
Admin
Admin
There, fixed it for ya. Now it is atomic .... transactions, trans-smack-tions. Now to write a database monitor to catch deadlocks. Then to write a monitor to look for orphaned locks. Maybe I need to add a un?x pid and SQL pid to the db__Locks table? Then we need to add rollback vs. commit logic. What else? Maybe clustering, raid, and striping would be a good thing (TM) to add? This could get good, keep ya in work for a long time. What a brilliant developer, Robert Rossney should thank him profusely!
:-p
Admin
I think the wikipedia topic he was looking for was 'semaphore'. Also, why in the world would you try to implement an asynchronous process management system in a query language (especially when it already has Transactions built in behind the scenes)?
captcha: "ideo" ideo killed the adio star!