Sep 13, 2019 18:09
This is an interesting paper relevant to the problem: "Calvin: fast distributed transactions for partitioned database systems"
https://blog.acolyer.org/2019/03/29/calvin-fast-distributed-transactions-for-partitioned-database-systems/amp/

"The big idea: minimise the contention window

The thing that gets you into scalability problems with distributed transactions is holding locks while coordinating with remote nodes to check everyone is in agreement. This makes a large contention window during which other transactions can get backed up waiting for locks on the same items (or in optimistic s
Sep 13, 2019 17:48
Thanks, will do. I just thought it would be more useful as a comment closely associated with the answer than a separate answer. I appreciate all the links to policies, etc.
Sep 12, 2019 21:50
I know you were the author, I wasn't posting it for you, because it wasn't posted in a chat with you. It was posted as a comment on an answer, to add to it, because it adds useful information about how an update statement locks. In particular, the read/lock phase does not overlap with the update phase. The comments were deleted from the post, and re-created here.
Sep 4, 2019 07:59
Wow, some other commenter from Microsoft was really sour when I informed it its answer was wrong. I explained that 'use sp_getapplock', which I'm quite familiar with, is not a solution, because it does nothing to avoid the page lock issue. Unless it was suggesting I serialize all reservations by having them all take literally the same lock, which is nuts because it would kill scalability of the app. Reservations for disjoint sets of objects ids should run concurrently and should not interfere with one another at all. That must be why it down-voted this and deleted its answer. Too bad.
Sep 4, 2019 07:59
It is trivial, and I already supplied what you asked for, in a single line, in the comment before you questioned whether it was trivial. BEGIN TRAN; update GlobalInventory set [Count] = [Count] + @QuantityToReserve where ObjectID = @object_id. That's the query to update global inventory. If it doesn't use row locks, it could inadvertently lock pages with other ObjectIDs, invalidating the algorithm, because lock order couldn't be guaranteed. So, row locks are required. It seems like the people trying to answer this so far are not understanding the question or don't have the expertise.
Sep 4, 2019 07:59
Suppose... is a synonym for 'given that'. There's nothing precluding a concrete example following such a statement. You're literally trying to start an argument by making such obtuse claims. Suppose I'm running SQL Server 2016 and I execute a 'select' statement on a table with a single column... that's pretty concrete, because I can easily do that. Claiming it's not concrete is playing dumb.
Sep 4, 2019 07:59
It's a terrible answer. It suggests a slower mechanism that's not comparable to row-locks. It also contradicts an established premise, so it's dead wrong. It's also makes a bogus assertion about performance of an update statement that wasn't even relevant to the question. This requires an expert in SQL Server locking behavior. All others should walk away.
Sep 4, 2019 07:59
This isn't a hypothetical. The information provided is very specific, and describes the exact operations involved. It describes the precise structure of the two sole tables involves and the sole indexes and their keys involved. 1. Start a transaction. Update the target rows in one table. 2. Update the target row in the second table. Finally, commit the transaction. Exclusive row locks are used for the updates. Anyone who can't understand that probably isn't capable of answering the question.
Sep 4, 2019 07:59
Meanwhile, row locks on different existing rows never conflict. I've also seen replication interfere with this a really nasty way, where this kind of very specific locking causing 'versioned ghost records' to pile up on a table, but was never able to completely understand why or whether it would resolve itself eventually.
Sep 4, 2019 07:59
FWIW, I have seen deadlock occur, and I have seen the expected row locks not taken out properly as a result of, for example, having more than one index on the table. I also mentioned that selecting a non-existing row with an exclusive row locks consumes such a slot exclusively, such that if one transaction takes out an exclusive row lock on non-existing row 'A', another transaction will not only NOT be able to take out a lock on row 'A', but it won't be able to take out a lock on ANY other non-existing row. It's like locking a non-existing row is some kind of singleton lock bucket.
Sep 4, 2019 07:59
This is a question that requires expertise in SQL Server locking. It has a definite answer, so it's not relevant whether I am or am not experiencing deadlock. Based on the information provided, the question is whether deadlock is possible without forcing the use of row locks. Logically, deadlock would be possible without guaranteeing row-level locks, so this is a question about SQL server specifically and how row-level locking functions. SQL Server 2019 is simply the latest version of SQL Server that we'll be using.
Sep 4, 2019 07:59
Then again, another comment there says lock escalation can be disabled by using: "ALTER TABLE tableName SET (LOCK_ESCALATION=DISABLE).
Sep 4, 2019 07:59
This does not give me hope: stackoverflow.com/questions/3114826/… Although, part of what I mentioned is that it's important that there's is only a single index on the table, because it may take out locks on 'index keys' rather than 'rows'. This is a non-issue when an index key and a row are equivalent as a result of only having a single primary key index. Another interesting facet of this I found from experiments is when taking an exclusive row lock on a non-existent row; only one such lock can be held, regardless of the key used.
 

 The Comms Room

ServerFault's lobby
May 12, 2011 21:34
What are you voting to close?
May 12, 2011 21:32
A side effect of everyone generating EM waves would be that corps couldn't use them to transmit info reliably, and a side effect of everyone copying information is businesses trying to impose artificial scarcity on virtual resources will fail to make money.
May 12, 2011 21:32
@Chris S: Do you think you can stop people from copying music and software? Of course not, so making a law against it is strange and pointless. Giving someone ownership over something that's not real... an interpreted, imagined pattern, like information, makes no sense, and if people were as apt to generate EM fields as they are to copy data, the same problem would arise.
May 12, 2011 21:14
@Chris: We are an EM field.
May 12, 2011 21:13
Well, that's debatable. I'm sure there are some people who could figure out how to generate EM waves without knowing how far they'd reach or what barriers they may or may not pass though.
May 12, 2011 21:12
If I could control them... wouldn't it be strange to outlaw a thought?
May 12, 2011 21:11
My brain puts off EM waves...
May 12, 2011 21:11
@Chris S: The wind determines the direction of the smoke, not the person. Similarly, physics determines that an EM pulse travels outward in all directions... not the person making the pulse.
May 12, 2011 21:10
Exactly. Rules are strange.
May 12, 2011 21:09
and it travels into your house. Can u outlaw that? Did your neighbor decide the direction of the wind that day?
May 12, 2011 21:09
It's like... if your neighbor is smoking and has a window open...
May 12, 2011 21:08
@Chris S: What gives anyone the right to dictate how the EM field should look, when it's something that penetrates virtually everything. If I want to disrupt the field in my house; I cannot help that the waves will travel outward and into someone else's house, and may cause a pattern of fluctuation that they cannot interpret as they'd like.
May 12, 2011 20:58
It's interpreted from an EM fluctuation, the same way an image is interpretted from a JPG bit stream.
May 12, 2011 20:58
There's no such thing as an EM frequency though.
May 12, 2011 20:57
Even though, with two very different computational transformations may turn either stream of bits into a very similar image.
May 12, 2011 20:57
Ok, consider two images. One compressed with JPEG, and one as BMP. The sequence of bits is entirely different.
May 12, 2011 20:54
It's like copyright. Pointless.
May 12, 2011 20:52
An EM frequency is no more a limited resource, than is a zero or a one.
May 12, 2011 20:50
It's strange like... outlawing clouds that happen to arrange themselves into the shape of a corporate logo.
May 12, 2011 20:47
It's useful to have a rule that says "don't emit EM waves at this frequency, it will interfere with the stuff we're doing", but it's strange because of the nature of the medium. It's not a lone frequency, it's a detected pattern, and therefore not real.
May 12, 2011 20:38
It's strange because.... at any given point in space, there's this pattern of EM fluctuation... and it's a superimposed results of fluctionations everywhere, and it's interpreted by achieving resonance at a particular frequency. I just think it's strange because there's all these different frequencies present, like a sound wave.
May 12, 2011 20:36
It's not a location, it's a energy fluctuation rate.
May 12, 2011 20:32
Reminds me of what I say about DRM... wait til the day when you buy a pair of shoes and license them for walking, and have to buy an additional license to run in them. If they detect that you're running, they'll self-destruct or play an irritating noise, haha.
May 12, 2011 20:31
It's strange, because it's a behavior... not a location. It's like telling people they can walk at speeds up to 1.6MPH, and above 4mph, but they'll be fined if they walk between 1.6 and 4mph, lol.
May 12, 2011 20:29
@Chris S. atac.com.tw/index.php/product/8-video/115-dvnet (Send computer display over wifi/ethernet to box... with DVI output.
May 12, 2011 20:17
You can vibrate at this frequency... but not this one
May 12, 2011 20:17
It's also funny that certain frequencies in the electro-mag spectrum are reserved, lol.
May 12, 2011 20:16
That's an awesome question. I hate that large-range communication infrastructure is controlled by large corporations. Is there a technology that could it back in our hands?
May 12, 2011 16:25
Proliferation of guns have nothing to do with gun crime rates, except to create a theoretical maximum based on number of guns/ammo available, firing rate, population density, shooter mobility, number of shooters, number of potential victims, etc.
May 12, 2011 16:22
There are more atoms per cubic millimeter in a neutron star than there are in our sun.
May 12, 2011 15:45
I'd never turn off relational integrity, especially on a system like this that's constantly adding/removing stuff.
May 12, 2011 15:43
~13 million votes, nice.
May 12, 2011 15:39
Yeah, I saw the schema, but was interested in how the tables are related.
May 12, 2011 15:38
Nice. I love SQL Server 2008 :)
May 12, 2011 15:37
@Zypher and @TiZon: Do you know where I could find a database diagram or what database engine these sites are based on so I could (possibly) extract the relations myself?
May 12, 2011 15:30
Scaling and architecture are codependent. Some architectures scale well, and depending on your scaling needs, that can dictate your architecture.
May 12, 2011 15:29
@Chris S: It's worked out great so far. For example, I've auto-generated MSIL Regex constraint functions to the SQL CLR, and it's capable of validating 1.5 million rows of nvarchar(4000) data in under 15 seconds! Depending on the scale, if it was any different that what I'm working with.. it may be completely inappropriate.