tengiz wrote:[My interest, although strong, is purely theoretical since I cannot get too excited with key-range locking that appears to be the sate-of-the-art even today, 20 years after it was conceived. It's a clever idea, no doubt, but its dependency on having indexes diminishes its practicality in too many cases.
Стакан наполовину пустой или наполовину полный? Использование индексов для предикатных блокировок - один из замечательных примеров инженерного минимализма, когда одна и та же концепция работает для двух хоть и связанных, но совершенно разных целей - ускорение извлечения данных и изоляция транзакций. Учитывая практическую неприменимость сколько нибудь полезных баз данных без индексации, я думаю в практических же целях можно спокойно проигнорировать "неудобства" от небоходимости наличия тех же индексов ещё и для целей изоляции транзакций.
Well, minimalism is a good point but you create indexes when you want to improve performance. With key-range locking you'd want indexes on all possible predicate columns even though you know that full-table scan with a given predicate is preferable, These 'unnecessary' indexes will impact write performance for obvious reasons. But let's skip this one as the interesting stuff goes below:
tengiz wrote:Давайте всё же попробуем эти примеры ещё раз препарировать: vanilla Strict 2PL scheduler прекрасно позволяет провести анализ любых сценариев. Именно это я пытался сделать, подразумевая по умолчанию, что мы друг друга понимаем. Единственное уточнение - как я уже говорил - замените все упоминания data item/object на data set defined by a predicate во всех операциях (read, write, lock), обобщите понятие конфликта на наличие пересечения data sets defined by predicates, сведите SQL insert/delete/update к data set write / data set state change - больше ничего делать не нужно. Проблема аккуратного учёта фатномов волшебным образом испарится. Формальная часть с доказательствами корректности алгоритмов 2PL без циклов абсолютно не менятся при этой замене.
OK. Let's do it. I think you are treating the original serializability theory too liberally and I am not sure one can do that.
As I said before, the vocabulary contains 'r', 'w', 'precede', a conflict matrix and nothing more. 'r'/'w' should be atomic. Now, just a couple of problems with your extension:
1. Substituting subsets defined by predicates for data items. How do you propose to ensure atomicity for say a 'read' over a subset defined by a predicate ?
2. Generalizing data item conflicts to subset intersection.. Well, you surely can see that this leads directly to predicate locking, "a rose by any other name would smell as sweet" dont you agree, (p1&p2 == true) that's the very definition of a predicate conflict. When we have predicate locking we are gods. But we don't so we are not.
Please respond to these two questions/objections and I'll tackle other points later as they depend on your answer.
Thanks.