mirror of
https://github.com/scylladb/scylladb.git
synced 2026-04-20 16:40:35 +00:00
1466 lines
132 KiB
HTML
1466 lines
132 KiB
HTML
|
||
|
||
<!DOCTYPE html>
|
||
<html class="no-js" lang="en" style="visibility: hidden;">
|
||
|
||
|
||
|
||
<head>
|
||
<meta charset="utf-8" />
|
||
<meta name="viewport" content="width=device-width initial-scale=1" />
|
||
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
|
||
<title>
|
||
Lightweight Transactions | ScyllaDB Docs
|
||
</title>
|
||
<meta name="description" content="ScyllaDB is an Apache Cassandra-compatible NoSQL data store that can handle 1 million transactions per second on a single server." />
|
||
<link rel="icon" href="../_static/img/favicon.ico" type="image/x-icon" />
|
||
<link rel="icon" href="../_static/img/favicon-32x32.png" sizes="32x32" />
|
||
<link rel="icon" href="../_static/img/favicon-228x228.png" sizes="192x192" />
|
||
<link rel="apple-touch-icon" href="../_static/img/favicon-228x228.png" />
|
||
<meta name="msapplication-TileImage" href="../_static/img/favicon-228x228.png" />
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
<link rel="canonical" href="https://opensource.docs.scylladb.com/stable/features/lwt.html"/>
|
||
|
||
|
||
<link rel="author" href="mailto:info@scylladb.com" />
|
||
|
||
|
||
|
||
|
||
|
||
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
|
||
<link rel="preload" as="style"
|
||
href="https://fonts.googleapis.com/css2?family=Roboto:ital,wght@0,400;0,500;0,700;1,400&display=swap" />
|
||
|
||
<!-- async CSS -->
|
||
<link rel="stylesheet" media="print" onload="this.onload=null;this.removeAttribute('media');"
|
||
href="https://fonts.googleapis.com/css2?family=Roboto:ital,wght@0,400;0,500;0,700;1,400&display=swap" />
|
||
|
||
<!-- no-JS fallback -->
|
||
<noscript>
|
||
<link rel="stylesheet"
|
||
href="https://fonts.googleapis.com/css2?family=Roboto:ital,wght@0,400;0,500;0,700;1,400&display=swap" />
|
||
</noscript>
|
||
|
||
|
||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/biel-search@latest/dist/biel-search/biel-search.css">
|
||
<script type="module" src="https://cdn.jsdelivr.net/npm/biel-search@latest/dist/biel-search/biel-search.esm.js"></script>
|
||
|
||
|
||
|
||
|
||
<link rel="stylesheet" type="text/css" href="../_static/pygments.css?v=03e43079" />
|
||
|
||
|
||
|
||
<link rel="stylesheet" type="text/css" href="../_static/css/main.css?v=041c0933" />
|
||
|
||
|
||
|
||
<link rel="stylesheet" type="text/css" href="../_static/sphinx_collapse.css?v=226d88b4" />
|
||
|
||
|
||
|
||
<link rel="stylesheet" type="text/css" href="../_static/copybutton.css?v=76b2166b" />
|
||
|
||
|
||
|
||
<link rel="stylesheet" type="text/css" href="../_static/css/custom.css?v=5a6d8084" />
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
<meta name="robots" content="noindex">
|
||
|
||
|
||
|
||
<script type="text/javascript" src="../_static/js/runtime.bundle.js"></script>
|
||
<script type="text/javascript" src="../_static/js/main.bundle.js"></script>
|
||
|
||
|
||
<script src="../_static/documentation_options.js?v=5929fcd5"></script>
|
||
|
||
|
||
|
||
<script src="../_static/doctools.js?v=fd6eb6e6"></script>
|
||
|
||
|
||
|
||
<script src="../_static/sphinx_highlight.js?v=6ffebe34"></script>
|
||
|
||
|
||
|
||
<script src="../_static/clipboard.min.js?v=a7894cd8"></script>
|
||
|
||
|
||
|
||
<script src="../_static/copybutton.js?v=f281be69"></script>
|
||
|
||
|
||
|
||
|
||
<!-- Local meta tags -->
|
||
|
||
|
||
<!-- Google Tag Manager docs -->
|
||
<script>
|
||
(function (w, d, s, l, i) {
|
||
w[l] = w[l] || [];
|
||
w[l].push({
|
||
"gtm.start": new Date().getTime(),
|
||
event: "gtm.js"
|
||
});
|
||
var f = d.getElementsByTagName(s)[0],
|
||
j = d.createElement(s),
|
||
dl = l != "dataLayer" ? "&l=" + l : "";
|
||
j.async = true;
|
||
j.src = "https://www.googletagmanager.com/gtm.js?id=" + i + dl;
|
||
f.parentNode.insertBefore(j, f);
|
||
})(window, document, "script", "dataLayer", "GTM-54NWVS4");
|
||
</script>
|
||
<!-- End Google Tag Manager -->
|
||
|
||
<!-- Google Tag Manager global -->
|
||
<script>
|
||
(function (w, d, s, l, i) {
|
||
w[l] = w[l] || [];
|
||
w[l].push({
|
||
"gtm.start": new Date().getTime(),
|
||
event: "gtm.js"
|
||
});
|
||
var f = d.getElementsByTagName(s)[0],
|
||
j = d.createElement(s),
|
||
dl = l != "dataLayer" ? "&l=" + l : "";
|
||
j.async = true;
|
||
j.src = "https://www.googletagmanager.com/gtm.js?id=" + i + dl;
|
||
f.parentNode.insertBefore(j, f);
|
||
})(window, document, "script", "dataLayer", "GTM-T8P2JP");
|
||
</script>
|
||
<!-- End Google Tag Manager -->
|
||
|
||
<!-- Expertrec -->
|
||
|
||
<!-- End Expertrec -->
|
||
|
||
|
||
|
||
</head>
|
||
|
||
<body class="brand-open-source">
|
||
<section class="promo-banner promo-banner--hide" style="display: none;">
|
||
<div class="promo-banner-wrapper">
|
||
<div class="promo-banner__content">
|
||
|
||
<div class="promo-banner__title">ScyllaDB University LIVE, FREE Virtual Training Event | March 21</div>
|
||
<a class="promo-banner__button button button--reverse" href="https://lp.scylladb.com/university-live-2023-03-registration?siteplacement=docs"
|
||
target="_blank" rel="noopener noreferrer">Register for Free</a>
|
||
</div>
|
||
<button class="promo-banner__close">
|
||
<i class="icon-cancel"></i>
|
||
</button>
|
||
</div>
|
||
</section>
|
||
<header class="header">
|
||
<div class="header-logo">
|
||
<a class="header-logo__img" href="https://scylladb.com/">
|
||
<img src="../_static/img/scylladb-logo-horizontal.svg" alt="ScyllaDB Documentation Logo" />
|
||
</a>
|
||
<span class="header-logo__bar"></span>
|
||
<a class="header-logo__text" href="https://docs.scylladb.com/">
|
||
Documentation
|
||
</a>
|
||
</div>
|
||
<div class="header-navigation">
|
||
<ul class="dropdown menu scylla-dropdown scylla-dropdown--header" data-dropdown-menu>
|
||
<li class="scylla-dropdown__item">
|
||
<a href="#" class="scylla-dropdown__title">Deployments <i class="chevron icon-arrow-dropdown"></i></a>
|
||
<ul class="menu scylla-dropdown__content">
|
||
<li>
|
||
<a href="https://docs.scylladb.com/scylla-cloud/">
|
||
<i class="icon-docs-cloud"></i>Cloud</a>
|
||
</li>
|
||
<li>
|
||
<a href="https://docs.scylladb.com/manual/">
|
||
<i class="icon-server"></i>Server</a>
|
||
</li>
|
||
</ul>
|
||
</li>
|
||
<li class="scylla-dropdown__item">
|
||
<a href="#" class="scylla-dropdown__title">Tools <i class="chevron icon-arrow-dropdown"></i></a>
|
||
<ul class="menu scylla-dropdown__content">
|
||
<li>
|
||
<a href="https://manager.docs.scylladb.com/">
|
||
<i class="icon-docs-manager"></i>ScyllaDB Manager</a>
|
||
</li>
|
||
<li>
|
||
<a href="https://monitoring.docs.scylladb.com/">
|
||
<i class="icon-docs-monitoring"></i>ScyllaDB
|
||
Monitoring Stack</a>
|
||
</li>
|
||
<li>
|
||
<a href="https://operator.docs.scylladb.com/">
|
||
<i class="icon-docs-operator"></i>ScyllaDB Operator
|
||
</a>
|
||
</li>
|
||
</ul>
|
||
</li>
|
||
<li class="scylla-dropdown__item">
|
||
<a href="#" class="scylla-dropdown__title">Drivers <i class="chevron icon-arrow-dropdown"></i></a>
|
||
<ul class="menu scylla-dropdown__content">
|
||
<li>
|
||
<a href="https://docs.scylladb.com/stable/drivers/cql-drivers">
|
||
<i class="icon-docs-nsql-guides"></i>CQL Drivers
|
||
</a>
|
||
</li>
|
||
<li>
|
||
<a href="https://docs.scylladb.com/stable/drivers/dynamo-drivers">
|
||
<i class="icon-docs-alternator"></i>DynamoDB Drivers
|
||
</a>
|
||
|
||
<li>
|
||
<a href="https://docs.scylladb.com/stable/versioning/driver-support">
|
||
<i class="icon-docs-blog"></i>Supported Driver Versions
|
||
</a>
|
||
</li>
|
||
</li>
|
||
</ul>
|
||
</li>
|
||
<li class="scylla-dropdown__item">
|
||
<a href="#" class="scylla-dropdown__title">Resources
|
||
<i class="chevron icon-arrow-dropdown"></i></a>
|
||
<ul class="menu scylla-dropdown__content">
|
||
<li>
|
||
<a href="https://university.scylladb.com">
|
||
<i class="icon-university"></i>
|
||
ScyllaDB University
|
||
</a>
|
||
</li>
|
||
<li>
|
||
<a href="https://forum.scylladb.com">
|
||
<i class="icon-docs-community"></i>
|
||
Community Forum
|
||
</a>
|
||
</li>
|
||
<li>
|
||
<a href="https://docs.scylladb.com/stable/get-started/develop-with-scylladb/tutorials-example-projects.html">
|
||
<i class="icon-docs-training"></i>
|
||
Tutorials
|
||
</a>
|
||
</li>
|
||
</ul>
|
||
</li>
|
||
</ul>
|
||
<div class="header-button">
|
||
<a href="https://docs.scylladb.com/manual/stable/getting-started/install-scylla/index.html" class="button"><i class="icon-download me-2"></i> Install</a>
|
||
</div>
|
||
</div>
|
||
<div class="header-search-box">
|
||
<i class="dark-theme-toggler icon-theme"></i>
|
||
|
||
<biel-search-button
|
||
project="ddfdo8m94k"
|
||
button-style="rounded"
|
||
hide-filters="false"
|
||
header-title="ScyllaDB chatbot (beta)"
|
||
modal-position="top-center">
|
||
Search
|
||
</biel-search-button>
|
||
|
||
<biel-button class="header-ask-ai" project="ddfdo8m94k"
|
||
header-title="ScyllaDB chatbot (beta)"
|
||
button-position="default"
|
||
modal-position="sidebar-right"
|
||
button-style="dark">
|
||
Ask AI
|
||
</biel-button>
|
||
|
||
|
||
</div>
|
||
<div class="side-nav-toggle">
|
||
<i class="dark-theme-toggler icon-theme"></i>
|
||
<div class="side-nav-toggle__button" data-toggle="side-nav">
|
||
<i class="icon-menu"></i>
|
||
</div>
|
||
</div>
|
||
</header>
|
||
<div class="title"></div>
|
||
<section
|
||
class="layout layout--sidebar layout--has-secondary-sidebar ">
|
||
<div class="content large-order-2">
|
||
|
||
<div class="pre-content">
|
||
<div class="breadcrumbs">
|
||
<span class="bread__item">
|
||
<a href="https://docs.scylladb.com"
|
||
class="bread__highlight">
|
||
<i class="icon-home"></i> ScyllaDB Docs
|
||
</a>
|
||
</span>
|
||
<span class="bread__item">
|
||
<a href="../index.html"
|
||
class="bread__highlight">
|
||
ScyllaDB Open Source
|
||
</a>
|
||
</span>
|
||
|
||
<span class="bread__item">
|
||
<a href="index.html" class="bread__highlight">
|
||
Features
|
||
</a>
|
||
</span>
|
||
|
||
<span class="bread__item bread__item--last">Lightweight Transactions</span>
|
||
</div>
|
||
</div>
|
||
|
||
|
||
<div class="sidebar-right-layout">
|
||
<div class="body-container">
|
||
|
||
|
||
<div class="content-body"
|
||
|
||
data-view-source-url="https://github.com/scylladb/scylladb/blob/master/docs/features/lwt.rst"
|
||
>
|
||
|
||
|
||
<div class="admonition caution">
|
||
<p class="admonition-title">Caution</p>
|
||
<p>
|
||
You're viewing documentation for a previous version.
|
||
<a href="https://docs.scylladb.com/manual/">Switch to the latest stable version.</a>
|
||
</p>
|
||
</div>
|
||
|
||
|
||
|
||
<section id="lightweight-transactions">
|
||
<h1>Lightweight Transactions<a class="headerlink" href="#lightweight-transactions" title="Link to this heading">¶</a></h1>
|
||
<div class="admonition note">
|
||
<p class="admonition-title">Note</p>
|
||
<p>The LWT feature is not supported in keyspaces with <a class="reference internal" href="../architecture/tablets.html"><span class="doc">tablets</span></a> enabled.</p>
|
||
</div>
|
||
<p>There are cases when it is necessary to modify data based on its current state: that is, to perform an update that is executed only if a row does not exist or contains a certain value.
|
||
<abbr title="lightweight transactions">LWTs</abbr> provide this functionality by only allowing changes to data to occur if the condition provided evaluates as true.
|
||
The conditional statements provide linearizable semantics thus allowing data to remain consistent.</p>
|
||
<p>A basic rule of thumb is that any statement with an IF clause is a conditional statement.
|
||
A batch that has at least one conditional statement is a conditional batch.
|
||
Conditional statements and conditional batches are executed atomically, as a Lightweight Transaction (LWT) For example:</p>
|
||
<div class="highlight-cql notranslate"><div class="highlight"><pre><span></span><span class="k">UPDATE</span> <span class="n">employees</span> <span class="k">SET</span> <span class="n">join_date</span> <span class="o">=</span> <span class="s1">'2018-05-19'</span> <span class="k">WHERE</span>
|
||
<span class="n">firstname</span> <span class="o">=</span> <span class="s1">'John'</span> <span class="k">AND</span> <span class="n">lastname</span> <span class="o">=</span> <span class="s1">'Doe'</span>
|
||
<span class="k">IF</span> <span class="n">join_date</span> <span class="o">!=</span> <span class="k">null</span><span class="p">;</span>
|
||
</pre></div>
|
||
</div>
|
||
<p>The example above updates the employee John Doe’s start date if John Doe has a record in the employees table.</p>
|
||
<section id="the-if-clause">
|
||
<h2>The IF clause<a class="headerlink" href="#the-if-clause" title="Link to this heading">¶</a></h2>
|
||
<p>Creating a conditional statement with an IF clause can include a query of individual cells and or collection elements.
|
||
It can use IN clauses or comparison operators, such as <code class="docutils literal notranslate"><span class="pre"><</span></code>, <code class="docutils literal notranslate"><span class="pre">></span></code>, <code class="docutils literal notranslate"><span class="pre">>=</span></code>, <code class="docutils literal notranslate"><span class="pre"><=</span></code>, <code class="docutils literal notranslate"><span class="pre">==</span></code>, and <code class="docutils literal notranslate"><span class="pre">!=</span></code>.
|
||
The important part to keep in mind is that in order to initiate the transaction, the condition must evaluate to true and if there are several different elements in the conditional statement, each part must evaluate to true.
|
||
If any part evaluates to false the transaction does not complete.</p>
|
||
<p>The IF condition can be created from any of the following CQL components: <code class="docutils literal notranslate"><span class="pre">IF</span> <span class="pre">EXISTS</span></code>, <code class="docutils literal notranslate"><span class="pre">IF</span> <span class="pre">NOT</span> <span class="pre">EXISTS</span></code>, or one or more predicates on the existing row.</p>
|
||
</section>
|
||
<section id="what-row-does-if-clause-apply-to">
|
||
<h2>What row does IF clause apply to?<a class="headerlink" href="#what-row-does-if-clause-apply-to" title="Link to this heading">¶</a></h2>
|
||
<p>Conditional statements which evaluate or assign non-static columns
|
||
must specify both the clustering key and the partition key.
|
||
Such statements are said to apply to regular rows; statements
|
||
which only restrict the partition key must use only static columns
|
||
and are said to apply to the static row of the partition.</p>
|
||
<p>A regular row exists if at least one regular cell <strong>or</strong> the
|
||
clustering key is assigned. For example, consider the following
|
||
table:</p>
|
||
<div class="highlight-cql notranslate"><div class="highlight"><pre><span></span><span class="k">CREATE</span> <span class="k">TABLE</span> <span class="n">t</span> <span class="p">(</span>
|
||
<span class="n">p</span> <span class="nb">INT</span><span class="p">,</span>
|
||
<span class="n">c</span> <span class="nb">INT</span><span class="p">,</span>
|
||
<span class="n">r</span> <span class="nb">INT</span><span class="p">,</span>
|
||
<span class="n">s</span> <span class="nb">INT</span> <span class="k">STATIC</span><span class="p">,</span>
|
||
<span class="k">PRIMARY</span> <span class="k">KEY</span><span class="p">(</span><span class="n">p</span><span class="p">,</span> <span class="n">c</span><span class="p">));</span>
|
||
</pre></div>
|
||
</div>
|
||
<p>It has a partition key <code class="docutils literal notranslate"><span class="pre">p</span></code>, a clustering key <code class="docutils literal notranslate"><span class="pre">c</span></code>, a regular
|
||
cell <code class="docutils literal notranslate"><span class="pre">r</span></code> and a static cell <code class="docutils literal notranslate"><span class="pre">s</span></code>.</p>
|
||
<p>To materialize a regular row, it’s sufficient to assign any of
|
||
<code class="docutils literal notranslate"><span class="pre">c</span></code> or <code class="docutils literal notranslate"><span class="pre">r</span></code>:</p>
|
||
<div class="highlight-cql notranslate"><div class="highlight"><pre><span></span><span class="o">></span> <span class="k">INSERT</span> <span class="k">INTO</span> <span class="n">t</span> <span class="p">(</span><span class="n">p</span><span class="p">,</span> <span class="n">c</span><span class="p">,</span> <span class="n">r</span><span class="p">)</span> <span class="k">VALUES</span> <span class="p">(</span><span class="mf">1</span><span class="p">,</span><span class="mf">1</span><span class="p">,</span><span class="k">NULL</span><span class="p">)</span> <span class="k">IF</span> <span class="k">NOT</span> <span class="k">EXISTS</span><span class="p">;</span>
|
||
<span class="o">+-------------+------+------+------+------+</span>
|
||
<span class="o">|</span> <span class="p">[</span><span class="n">applied</span><span class="p">]</span> <span class="o">|</span> <span class="n">p</span> <span class="o">|</span> <span class="n">c</span> <span class="o">|</span> <span class="n">s</span> <span class="o">|</span> <span class="n">r</span> <span class="o">|</span>
|
||
<span class="o">|-------------+------+------+------+------|</span>
|
||
<span class="o">|</span> <span class="n">True</span> <span class="o">|</span> <span class="k">null</span> <span class="o">|</span> <span class="k">null</span> <span class="o">|</span> <span class="k">null</span> <span class="o">|</span> <span class="k">null</span> <span class="o">|</span>
|
||
<span class="o">+-------------+------+------+------+------+</span>
|
||
<span class="o">></span> <span class="k">INSERT</span> <span class="k">INTO</span> <span class="n">t</span> <span class="p">(</span><span class="n">p</span><span class="p">,</span> <span class="n">c</span><span class="p">,</span> <span class="n">r</span><span class="p">)</span> <span class="k">VALUES</span> <span class="p">(</span><span class="mf">1</span><span class="p">,</span><span class="mf">1</span><span class="p">,</span><span class="k">NULL</span><span class="p">)</span> <span class="k">IF</span> <span class="k">NOT</span> <span class="k">EXISTS</span><span class="p">;</span>
|
||
<span class="o">+-------------+-----+-----+------+------+</span>
|
||
<span class="o">|</span> <span class="p">[</span><span class="n">applied</span><span class="p">]</span> <span class="o">|</span> <span class="n">p</span> <span class="o">|</span> <span class="n">c</span> <span class="o">|</span> <span class="n">s</span> <span class="o">|</span> <span class="n">r</span> <span class="o">|</span>
|
||
<span class="o">|-------------+-----+-----+------+------|</span>
|
||
<span class="o">|</span> <span class="n">False</span> <span class="o">|</span> <span class="mf">1</span> <span class="o">|</span> <span class="mf">1</span> <span class="o">|</span> <span class="k">null</span> <span class="o">|</span> <span class="k">null</span> <span class="o">|</span>
|
||
<span class="o">+-------------+-----+-----+------+------+</span>
|
||
</pre></div>
|
||
</div>
|
||
<p>To materialize a static row, one must explicitly assign
|
||
at least one static cell: otherwise the static row is not
|
||
considered present:</p>
|
||
<div class="highlight-cql notranslate"><div class="highlight"><pre><span></span><span class="o">></span> <span class="k">INSERT</span> <span class="k">INTO</span> <span class="n">t</span> <span class="p">(</span><span class="n">p</span><span class="p">,</span> <span class="n">s</span><span class="p">)</span> <span class="k">VALUES</span> <span class="p">(</span><span class="mf">1</span><span class="p">,</span><span class="k">NULL</span><span class="p">)</span> <span class="k">IF</span> <span class="k">NOT</span> <span class="k">EXISTS</span><span class="p">;</span>
|
||
<span class="o">+-------------+-----+------+------+------+</span>
|
||
<span class="o">|</span> <span class="p">[</span><span class="n">applied</span><span class="p">]</span> <span class="o">|</span> <span class="n">p</span> <span class="o">|</span> <span class="n">c</span> <span class="o">|</span> <span class="n">s</span> <span class="o">|</span> <span class="n">r</span> <span class="o">|</span>
|
||
<span class="o">|-------------+-----+------+------+------|</span>
|
||
<span class="o">|</span> <span class="n">True</span> <span class="o">|</span> <span class="mf">1</span> <span class="o">|</span> <span class="k">null</span> <span class="o">|</span> <span class="k">null</span> <span class="o">|</span> <span class="k">null</span> <span class="o">|</span>
|
||
<span class="o">+-------------+-----+------+------+------+</span>
|
||
<span class="o">></span> <span class="k">INSERT</span> <span class="k">INTO</span> <span class="n">t</span> <span class="p">(</span><span class="n">p</span><span class="p">,</span> <span class="n">s</span><span class="p">)</span> <span class="k">VALUES</span> <span class="p">(</span><span class="mf">1</span><span class="p">,</span><span class="k">NULL</span><span class="p">)</span> <span class="k">IF</span> <span class="k">NOT</span> <span class="k">EXISTS</span><span class="p">;</span>
|
||
<span class="o">+-------------+-----+------+------+------+</span>
|
||
<span class="o">|</span> <span class="p">[</span><span class="n">applied</span><span class="p">]</span> <span class="o">|</span> <span class="n">p</span> <span class="o">|</span> <span class="n">c</span> <span class="o">|</span> <span class="n">s</span> <span class="o">|</span> <span class="n">r</span> <span class="o">|</span>
|
||
<span class="o">|-------------+-----+------+------+------|</span>
|
||
<span class="o">|</span> <span class="n">True</span> <span class="o">|</span> <span class="mf">1</span> <span class="o">|</span> <span class="k">null</span> <span class="o">|</span> <span class="k">null</span> <span class="o">|</span> <span class="k">null</span> <span class="o">|</span>
|
||
<span class="o">+-------------+-----+------+------+------+</span>
|
||
</pre></div>
|
||
</div>
|
||
<p>It is OK to us a comparison with <code class="docutils literal notranslate"><span class="pre">NULL</span></code> in a condition.
|
||
But since <code class="docutils literal notranslate"><span class="pre">NULL</span></code> value and missing value in ScyllaDB are
|
||
indistinguishable, conditions which compare with <code class="docutils literal notranslate"><span class="pre">NULL</span></code>
|
||
will return the same result when applied to both
|
||
missing rows or existing rows with <code class="docutils literal notranslate"><span class="pre">NULL</span></code> cells:</p>
|
||
<div class="highlight-cql notranslate"><div class="highlight"><pre><span></span><span class="o">></span> <span class="k">UPDATE</span> <span class="n">t</span> <span class="k">SET</span> <span class="n">s</span><span class="o">=</span><span class="mf">2</span> <span class="k">WHERE</span> <span class="n">p</span><span class="o">=</span><span class="mf">1</span> <span class="k">IF</span> <span class="n">s</span> <span class="o">=</span> <span class="k">NULL</span><span class="p">;</span>
|
||
<span class="o">+-------------+------+</span>
|
||
<span class="o">|</span> <span class="p">[</span><span class="n">applied</span><span class="p">]</span> <span class="o">|</span> <span class="n">s</span> <span class="o">|</span>
|
||
<span class="o">|-------------+------|</span>
|
||
<span class="o">|</span> <span class="n">True</span> <span class="o">|</span> <span class="k">null</span> <span class="o">|</span>
|
||
<span class="o">+-------------+------+</span>
|
||
</pre></div>
|
||
</div>
|
||
<p>If a regular row is missing, but the static row cells are
|
||
assigned, the static cells will be present in the row used to
|
||
evaluate the condition of the “missing” regular row:</p>
|
||
<div class="highlight-cql notranslate"><div class="highlight"><pre><span></span><span class="o">></span> <span class="k">UPDATE</span> <span class="n">t</span> <span class="k">SET</span> <span class="n">r</span><span class="o">=</span><span class="mf">2</span> <span class="k">WHERE</span> <span class="n">p</span><span class="o">=</span><span class="mf">1</span> <span class="k">AND</span> <span class="n">c</span><span class="o">=</span><span class="mf">2</span> <span class="k">IF</span> <span class="n">s</span> <span class="o">=</span> <span class="mf">2</span><span class="p">;</span>
|
||
<span class="o">+-------------+-----+</span>
|
||
<span class="o">|</span> <span class="p">[</span><span class="n">applied</span><span class="p">]</span> <span class="o">|</span> <span class="n">s</span> <span class="o">|</span>
|
||
<span class="o">|-------------+-----|</span>
|
||
<span class="o">|</span> <span class="n">True</span> <span class="o">|</span> <span class="mf">2</span> <span class="o">|</span>
|
||
<span class="o">+-------------+-----+</span>
|
||
</pre></div>
|
||
</div>
|
||
</section>
|
||
<section id="scylladb-paxos">
|
||
<h2>ScyllaDB Paxos<a class="headerlink" href="#scylladb-paxos" title="Link to this heading">¶</a></h2>
|
||
<p>The statements with an <code class="docutils literal notranslate"><span class="pre">IF</span></code> clause use a different write path, employing the Paxos consensus algorithm (see <a class="reference internal" href="#figure">figure</a>) to ensure linearizability of the execution history.</p>
|
||
<figure class="align-default" id="figure">
|
||
<a class="reference internal image-reference" href="../_images/lwt.png"><img alt="../_images/lwt.png" src="../_images/lwt.png" style="width: 400pt;" />
|
||
</a>
|
||
</figure>
|
||
<p>In Paxos, in order to persist a change a coordinator first must
|
||
create a unique time-based identifier, called a ballot, and send
|
||
it to replicas. Upon receiving a ballot, replicas respond with
|
||
a promise to accept a change associated with it.</p>
|
||
<p>A replica refuses to promise a ballot if it has already promised
|
||
a newer one – this locks out concurrent modification attempts and
|
||
allows the coordinator to proceed with reading and updating a row
|
||
without interference. The state of the protocol is persisted in
|
||
system.paxos table, which is local to each replica.</p>
|
||
<p>Unlike Cassandra, ScyllaDB piggy-backs the old version of the row on
|
||
response to “Prepare” request, so reading a row doesn’t require
|
||
a separate message exchange.</p>
|
||
<p>Once the coordinator gets a majority of promises from replicas,
|
||
it evaluates the <code class="docutils literal notranslate"><span class="pre">IF</span></code> conditions, and if the result is true,
|
||
sends an updated mutation to replicas.
|
||
Replicas store the new row in system.paxos and acknowledge
|
||
accepting it.</p>
|
||
<p>Having a majority of replicas accept the row satisfies the
|
||
“quorum intersection” rule: as long as at least a majority of
|
||
nodes are up, each conceivable new quorum contains at least
|
||
one node which accepted the previous row and is thus aware of the
|
||
change.</p>
|
||
<p>After the coordinator has received the majority of accepts, Paxos
|
||
protocol round is complete, and it is safe to update the base
|
||
table with the new row. This is done in “Learn” round.</p>
|
||
<p>If the base table update is successful, the coordinator responds
|
||
to the client. It’s also safe to prune the state of the protocol
|
||
from system.paxos.</p>
|
||
<p>The size of the quorum impacts how many acknowledgements the
|
||
coordinator must get before proceeding to the next round or
|
||
responding to the client. For Prepare and Accept, it is configured
|
||
with <code class="docutils literal notranslate"><span class="pre">SERIAL</span> <span class="pre">CONSISTENCY</span></code> setting. For Learn, ScyllaDB’s eventual
|
||
<code class="docutils literal notranslate"><span class="pre">CONSISTENCY</span></code> is used. Pruning is done in the background.</p>
|
||
<p>Key differences between ScyllaDB and Cassandra Paxos implementations
|
||
are in collapsing prepare and read actions into a single round, and
|
||
also introducing an extra asynchronous “prune” round, which keeps
|
||
system.paxos table small and thus reduces write amplification
|
||
when it’s compacted.</p>
|
||
<div class="admonition note">
|
||
<p class="admonition-title">Note</p>
|
||
<p>TTL on records in system.paxos table is set with the <code class="docutils literal notranslate"><span class="pre">paxos_grace_seconds</span></code> value.
|
||
If this value is not set, the value from <code class="docutils literal notranslate"><span class="pre">gc_grace_seconds</span></code> is used.
|
||
The default for <code class="docutils literal notranslate"><span class="pre">gc_grace_seconds</span></code> and <code class="docutils literal notranslate"><span class="pre">paxos_grace_seconds</span></code> are both the same (10 days).
|
||
You can have two different settings for <code class="docutils literal notranslate"><span class="pre">paxos_grace_seconds</span></code> and <code class="docutils literal notranslate"><span class="pre">gc_grace_seconds</span></code>.
|
||
You can change the <code class="docutils literal notranslate"><span class="pre">paxos_grace_seconds</span></code> value by altering the system.paxos table.</p>
|
||
</div>
|
||
</section>
|
||
<section id="batch-statements">
|
||
<h2>Batch statements<a class="headerlink" href="#batch-statements" title="Link to this heading">¶</a></h2>
|
||
<p><code class="docutils literal notranslate"><span class="pre">BATCH</span></code> statements may contain one or more conditional statements and as such, these batches are called conditional batches.
|
||
The entire conditional batch has an isolated view of the database and is executed using all-or-nothing principle. In many ways, conditional batches are similar to ACID transactions in relational databases, with the exception that a batch is executed only if <strong>all conditions</strong> in <strong>all statements</strong> are <strong>true</strong>, if not it does nothing.</p>
|
||
</section>
|
||
<section id="reading-with-paxos">
|
||
<h2>Reading with Paxos<a class="headerlink" href="#reading-with-paxos" title="Link to this heading">¶</a></h2>
|
||
<p>For queries against a single partition, it’s possible to use Paxos
|
||
for reading. Paxos reads are useful if it’s necessary to retrieve
|
||
the most up to date version of a row: a simple QUORUM read may not
|
||
see a value that is currently being updated by a conditional
|
||
write. In order to ensure a read is serial, set <code class="docutils literal notranslate"><span class="pre">CONSISTENCY</span></code> to
|
||
<code class="docutils literal notranslate"><span class="pre">SERIAL</span></code> in <em>cqlsh</em> or prepared statement properties.</p>
|
||
<div class="highlight-cql notranslate"><div class="highlight"><pre><span></span><span class="k">SELECT</span> <span class="o">*</span> <span class="k">FROM</span> <span class="n">employees</span> <span class="k">WHERE</span> <span class="n">firstname</span> <span class="o">=</span> <span class="s1">'John'</span> <span class="k">AND</span> <span class="n">lastname</span> <span class="o">=</span> <span class="s1">'Doe'</span>
|
||
</pre></div>
|
||
</div>
|
||
</section>
|
||
<section id="cql-examples-with-lightweight-transactions">
|
||
<h2>CQL examples with lightweight transactions<a class="headerlink" href="#cql-examples-with-lightweight-transactions" title="Link to this heading">¶</a></h2>
|
||
<section id="add-values-to-a-table-with-lwt">
|
||
<h3>Add values to a table with LWT<a class="headerlink" href="#add-values-to-a-table-with-lwt" title="Link to this heading">¶</a></h3>
|
||
<p>Suppose you have a company which advertises movies playing in the cinema.
|
||
The application allows customers to search for a movie, and to buy a ticket.
|
||
You can use lightweight transactions for any of the following activities:</p>
|
||
<ul class="simple">
|
||
<li><p>Change the existing movie’s offering by adding a new movie screening time (and not changing the other data for the movie)</p></li>
|
||
<li><p>Remove a movie which is no longer playing</p></li>
|
||
<li><p>Add a new movie to the New Releases page (as long as it isn’t already there)</p></li>
|
||
</ul>
|
||
<ol class="arabic">
|
||
<li><p>Create a Keyspace</p>
|
||
<div class="highlight-cql notranslate"><div class="highlight"><pre><span></span><span class="k">CREATE</span> <span class="k">KEYSPACE</span> <span class="n">movies</span>
|
||
<span class="k">WITH</span> <span class="n">replication</span> <span class="o">=</span>
|
||
<span class="p">{</span><span class="s1">'class'</span><span class="p">:</span> <span class="s1">'NetworkTopologyStrategy'</span><span class="p">,</span> <span class="s1">'replication_factor'</span> <span class="p">:</span> <span class="mf">3</span><span class="p">};</span>
|
||
</pre></div>
|
||
</div>
|
||
</li>
|
||
<li><p>Create a table</p>
|
||
<div class="highlight-cql notranslate"><div class="highlight"><pre><span></span><span class="k">CREATE</span> <span class="k">TABLE</span> <span class="n">movies</span><span class="mf">.</span><span class="n">nowshowing</span> <span class="p">(</span>
|
||
<span class="n">movie</span> <span class="nb">TEXT</span><span class="p">,</span>
|
||
<span class="n">director</span> <span class="nb">TEXT</span> <span class="k">static</span><span class="p">,</span>
|
||
<span class="n">main_actor</span> <span class="nb">TEXT</span> <span class="k">static</span><span class="p">,</span>
|
||
<span class="n">released</span> <span class="nb">DATE</span> <span class="k">static</span><span class="p">,</span>
|
||
<span class="n">location</span> <span class="nb">TEXT</span><span class="p">,</span>
|
||
<span class="n">run_day</span> <span class="nb">TEXT</span><span class="p">,</span>
|
||
<span class="n">run_time</span> <span class="nb">TIME</span><span class="p">,</span>
|
||
<span class="n">theater</span> <span class="nb">TEXT</span><span class="p">,</span>
|
||
<span class="k">PRIMARY</span> <span class="k">KEY</span> <span class="p">(</span><span class="n">movie</span><span class="p">,</span> <span class="n">location</span><span class="p">,</span> <span class="n">run_day</span><span class="p">,</span> <span class="n">run_time</span><span class="p">)</span>
|
||
<span class="p">);</span>
|
||
</pre></div>
|
||
</div>
|
||
</li>
|
||
<li><p>Insert values into the table using LWT:</p>
|
||
<div class="highlight-cql notranslate"><div class="highlight"><pre><span></span><span class="k">INSERT</span> <span class="k">INTO</span> <span class="n">movies</span><span class="mf">.</span><span class="n">nowshowing</span> <span class="p">(</span><span class="n">movie</span><span class="p">,</span> <span class="n">director</span><span class="p">,</span> <span class="n">main_actor</span><span class="p">,</span> <span class="n">released</span><span class="p">)</span>
|
||
<span class="k">VALUES</span> <span class="p">(</span><span class="s1">'Sonic the Hedgehog'</span><span class="p">,</span> <span class="s1">'Jeff Fowler'</span><span class="p">,</span> <span class="s1">'Ben Schwartz'</span><span class="p">,</span> <span class="s1">'2020-14-02'</span><span class="p">)</span>
|
||
<span class="k">IF</span> <span class="k">NOT</span> <span class="k">EXISTS</span><span class="p">;</span>
|
||
</pre></div>
|
||
</div>
|
||
<div class="highlight-cql notranslate"><div class="highlight"><pre><span></span><span class="k">INSERT</span> <span class="k">INTO</span> <span class="n">movies</span><span class="mf">.</span><span class="n">nowshowing</span> <span class="p">(</span><span class="n">movie</span><span class="p">,</span> <span class="n">director</span><span class="p">,</span> <span class="n">main_actor</span><span class="p">,</span> <span class="n">released</span><span class="p">)</span>
|
||
<span class="k">VALUES</span> <span class="p">(</span><span class="s1">'Invisible Man'</span><span class="p">,</span> <span class="s1">'Leigh Whannell'</span><span class="p">,</span> <span class="s1">'Elisabeth Moss'</span><span class="p">,</span> <span class="s1">'2020-28-02'</span><span class="p">)</span>
|
||
<span class="k">IF</span> <span class="k">NOT</span> <span class="k">EXISTS</span><span class="p">;</span>
|
||
</pre></div>
|
||
</div>
|
||
</li>
|
||
<li><p>Show the current table</p>
|
||
<div class="highlight-cql notranslate"><div class="highlight"><pre><span></span><span class="k">SELECT</span> <span class="o">*</span> <span class="k">FROM</span> <span class="n">movies</span><span class="mf">.</span><span class="n">nowshowing</span><span class="p">;</span>
|
||
|
||
|
||
<span class="n">movie</span> <span class="o">|</span> <span class="n">location</span> <span class="o">|</span> <span class="n">run_day</span> <span class="o">|</span> <span class="n">run_time</span> <span class="o">|</span> <span class="n">director</span> <span class="o">|</span> <span class="n">main_actor</span> <span class="o">|</span> <span class="n">released</span> <span class="o">|</span> <span class="n">theater</span>
|
||
<span class="c1">--------------------+----------+---------+----------+----------------+----------------+------------+---------</span>
|
||
<span class="n">Sonic</span> <span class="n">the</span> <span class="n">Hedgehog</span> <span class="o">|</span> <span class="k">null</span> <span class="o">|</span> <span class="k">null</span> <span class="o">|</span> <span class="k">null</span> <span class="o">|</span> <span class="n">Jeff</span> <span class="n">Fowler</span> <span class="o">|</span> <span class="n">Ben</span> <span class="n">Schwartz</span> <span class="o">|</span> <span class="mf">2021</span><span class="o">-</span><span class="mf">02</span><span class="o">-</span><span class="mf">02</span> <span class="o">|</span> <span class="k">null</span>
|
||
<span class="n">Invisible</span> <span class="n">Man</span> <span class="o">|</span> <span class="k">null</span> <span class="o">|</span> <span class="k">null</span> <span class="o">|</span> <span class="k">null</span> <span class="o">|</span> <span class="n">Leigh</span> <span class="n">Whannell</span> <span class="o">|</span> <span class="n">Elisabeth</span> <span class="n">Moss</span> <span class="o">|</span> <span class="mf">2022</span><span class="o">-</span><span class="mf">04</span><span class="o">-</span><span class="mf">06</span> <span class="o">|</span> <span class="k">null</span>
|
||
|
||
<span class="p">(</span><span class="mf">2</span> <span class="n">rows</span><span class="p">)</span>
|
||
</pre></div>
|
||
</div>
|
||
</li>
|
||
<li><p>Add more information to the table</p>
|
||
<div class="highlight-cql notranslate"><div class="highlight"><pre><span></span><span class="k">INSERT</span> <span class="k">INTO</span> <span class="n">movies</span><span class="mf">.</span><span class="n">nowshowing</span> <span class="p">(</span><span class="n">movie</span><span class="p">,</span> <span class="n">location</span><span class="p">,</span> <span class="n">theater</span><span class="p">,</span> <span class="n">run_day</span><span class="p">,</span> <span class="n">run_time</span><span class="p">)</span>
|
||
<span class="k">VALUES</span> <span class="p">(</span><span class="s1">'Sonic the Hedgehog'</span><span class="p">,</span> <span class="s1">'Times Square'</span><span class="p">,</span> <span class="s1">'AMC Empire 25'</span><span class="p">,</span> <span class="s1">'Saturday'</span><span class="p">,</span> <span class="s1">'21:00:00'</span><span class="p">)</span>
|
||
<span class="k">IF</span> <span class="k">NOT</span> <span class="k">EXISTS</span><span class="p">;</span>
|
||
</pre></div>
|
||
</div>
|
||
<div class="highlight-cql notranslate"><div class="highlight"><pre><span></span><span class="k">INSERT</span> <span class="k">INTO</span> <span class="n">movies</span><span class="mf">.</span><span class="n">nowshowing</span> <span class="p">(</span><span class="n">movie</span><span class="p">,</span> <span class="n">location</span><span class="p">,</span> <span class="n">theater</span><span class="p">,</span> <span class="n">run_day</span><span class="p">,</span> <span class="n">run_time</span><span class="p">)</span>
|
||
<span class="k">VALUES</span> <span class="p">(</span><span class="s1">'Sonic the Hedgehog'</span><span class="p">,</span> <span class="s1">'Penn Station'</span><span class="p">,</span> <span class="s1">'AMC 34th Street 14'</span><span class="p">,</span> <span class="s1">'Sunday'</span><span class="p">,</span> <span class="s1">'14:00:00'</span><span class="p">)</span>
|
||
<span class="k">IF</span> <span class="k">NOT</span> <span class="k">EXISTS</span><span class="p">;</span>
|
||
</pre></div>
|
||
</div>
|
||
<div class="highlight-cql notranslate"><div class="highlight"><pre><span></span><span class="k">INSERT</span> <span class="k">INTO</span> <span class="n">movies</span><span class="mf">.</span><span class="n">nowshowing</span> <span class="p">(</span><span class="n">movie</span><span class="p">,</span> <span class="n">location</span><span class="p">,</span> <span class="n">theater</span><span class="p">,</span> <span class="n">run_day</span><span class="p">,</span> <span class="n">run_time</span><span class="p">)</span>
|
||
<span class="k">VALUES</span> <span class="p">(</span><span class="s1">'Sonic the Hedgehog'</span><span class="p">,</span> <span class="s1">'Times Square'</span><span class="p">,</span> <span class="s1">'AMC Empire 25'</span><span class="p">,</span> <span class="s1">'Saturday'</span><span class="p">,</span> <span class="s1">'14:00:00'</span><span class="p">)</span>
|
||
<span class="k">IF</span> <span class="k">NOT</span> <span class="k">EXISTS</span><span class="p">;</span>
|
||
</pre></div>
|
||
</div>
|
||
<div class="highlight-cql notranslate"><div class="highlight"><pre><span></span><span class="k">INSERT</span> <span class="k">INTO</span> <span class="n">movies</span><span class="mf">.</span><span class="n">nowshowing</span> <span class="p">(</span><span class="n">movie</span><span class="p">,</span> <span class="n">location</span><span class="p">,</span> <span class="n">theater</span><span class="p">,</span> <span class="n">run_day</span><span class="p">,</span> <span class="n">run_time</span><span class="p">)</span>
|
||
<span class="k">VALUES</span> <span class="p">(</span><span class="s1">'Sonic the Hedgehog'</span><span class="p">,</span> <span class="s1">'Penn Station'</span><span class="p">,</span> <span class="s1">'AMC 34th Street 14'</span><span class="p">,</span> <span class="s1">'Sunday'</span><span class="p">,</span> <span class="s1">'21:00:00'</span><span class="p">)</span>
|
||
<span class="k">IF</span> <span class="k">NOT</span> <span class="k">EXISTS</span><span class="p">;</span>
|
||
</pre></div>
|
||
</div>
|
||
<div class="highlight-cql notranslate"><div class="highlight"><pre><span></span><span class="k">INSERT</span> <span class="k">INTO</span> <span class="n">movies</span><span class="mf">.</span><span class="n">nowshowing</span> <span class="p">(</span><span class="n">movie</span><span class="p">,</span> <span class="n">location</span><span class="p">,</span> <span class="n">theater</span><span class="p">,</span> <span class="n">run_day</span><span class="p">,</span> <span class="n">run_time</span><span class="p">)</span>
|
||
<span class="k">VALUES</span> <span class="p">(</span><span class="s1">'Invisible Man'</span><span class="p">,</span> <span class="s1">'Penn Station'</span><span class="p">,</span> <span class="s1">'AMC 34th Street 14'</span><span class="p">,</span> <span class="s1">'Sunday'</span><span class="p">,</span> <span class="s1">'22:00:00'</span><span class="p">)</span>
|
||
<span class="k">IF</span> <span class="k">NOT</span> <span class="k">EXISTS</span><span class="p">;</span>
|
||
</pre></div>
|
||
</div>
|
||
<div class="highlight-cql notranslate"><div class="highlight"><pre><span></span><span class="k">INSERT</span> <span class="k">INTO</span> <span class="n">movies</span><span class="mf">.</span><span class="n">nowshowing</span> <span class="p">(</span><span class="n">movie</span><span class="p">,</span> <span class="n">location</span><span class="p">,</span> <span class="n">theater</span><span class="p">,</span> <span class="n">run_day</span><span class="p">,</span> <span class="n">run_time</span><span class="p">)</span>
|
||
<span class="k">VALUES</span> <span class="p">(</span><span class="s1">'Invisible Man'</span><span class="p">,</span> <span class="s1">'Times Square'</span><span class="p">,</span> <span class="s1">'AMC Empire 25'</span><span class="p">,</span> <span class="s1">'Saturday'</span><span class="p">,</span> <span class="s1">'22:00:00'</span><span class="p">)</span>
|
||
<span class="k">IF</span> <span class="k">NOT</span> <span class="k">EXISTS</span><span class="p">;</span>
|
||
</pre></div>
|
||
</div>
|
||
</li>
|
||
<li><p>Show the current table</p>
|
||
<div class="highlight-cql notranslate"><div class="highlight"><pre><span></span><span class="k">SELECT</span> <span class="o">*</span> <span class="k">FROM</span> <span class="n">movies</span><span class="mf">.</span><span class="n">nowshowing</span><span class="p">;</span>
|
||
|
||
|
||
<span class="n">movie</span> <span class="o">|</span> <span class="n">location</span> <span class="o">|</span> <span class="n">run_day</span> <span class="o">|</span> <span class="n">run_time</span> <span class="o">|</span> <span class="n">director</span> <span class="o">|</span> <span class="n">main_actor</span> <span class="o">|</span> <span class="n">released</span> <span class="o">|</span> <span class="n">theater</span>
|
||
<span class="c1">--------------------+--------------+----------+--------------------+----------------+----------------+------------+--------------------</span>
|
||
<span class="n">Sonic</span> <span class="n">the</span> <span class="n">Hedgehog</span> <span class="o">|</span> <span class="n">Penn</span> <span class="n">Station</span> <span class="o">|</span> <span class="n">Sunday</span> <span class="o">|</span> <span class="mf">14</span><span class="p">:</span><span class="mf">00</span><span class="p">:</span><span class="mf">00.000000000</span> <span class="o">|</span> <span class="n">Jeff</span> <span class="n">Fowler</span> <span class="o">|</span> <span class="n">Ben</span> <span class="n">Schwartz</span> <span class="o">|</span> <span class="mf">2021</span><span class="o">-</span><span class="mf">02</span><span class="o">-</span><span class="mf">02</span> <span class="o">|</span> <span class="n">AMC</span> <span class="mf">34</span><span class="n">th</span> <span class="n">Street</span> <span class="mf">14</span>
|
||
<span class="n">Sonic</span> <span class="n">the</span> <span class="n">Hedgehog</span> <span class="o">|</span> <span class="n">Penn</span> <span class="n">Station</span> <span class="o">|</span> <span class="n">Sunday</span> <span class="o">|</span> <span class="mf">21</span><span class="p">:</span><span class="mf">00</span><span class="p">:</span><span class="mf">00.000000000</span> <span class="o">|</span> <span class="n">Jeff</span> <span class="n">Fowler</span> <span class="o">|</span> <span class="n">Ben</span> <span class="n">Schwartz</span> <span class="o">|</span> <span class="mf">2021</span><span class="o">-</span><span class="mf">02</span><span class="o">-</span><span class="mf">02</span> <span class="o">|</span> <span class="n">AMC</span> <span class="mf">34</span><span class="n">th</span> <span class="n">Street</span> <span class="mf">14</span>
|
||
<span class="n">Sonic</span> <span class="n">the</span> <span class="n">Hedgehog</span> <span class="o">|</span> <span class="n">Times</span> <span class="n">Square</span> <span class="o">|</span> <span class="n">Saturday</span> <span class="o">|</span> <span class="mf">14</span><span class="p">:</span><span class="mf">00</span><span class="p">:</span><span class="mf">00.000000000</span> <span class="o">|</span> <span class="n">Jeff</span> <span class="n">Fowler</span> <span class="o">|</span> <span class="n">Ben</span> <span class="n">Schwartz</span> <span class="o">|</span> <span class="mf">2021</span><span class="o">-</span><span class="mf">02</span><span class="o">-</span><span class="mf">02</span> <span class="o">|</span> <span class="n">AMC</span> <span class="n">Empire</span> <span class="mf">25</span>
|
||
<span class="n">Sonic</span> <span class="n">the</span> <span class="n">Hedgehog</span> <span class="o">|</span> <span class="n">Times</span> <span class="n">Square</span> <span class="o">|</span> <span class="n">Saturday</span> <span class="o">|</span> <span class="mf">21</span><span class="p">:</span><span class="mf">00</span><span class="p">:</span><span class="mf">00.000000000</span> <span class="o">|</span> <span class="n">Jeff</span> <span class="n">Fowler</span> <span class="o">|</span> <span class="n">Ben</span> <span class="n">Schwartz</span> <span class="o">|</span> <span class="mf">2021</span><span class="o">-</span><span class="mf">02</span><span class="o">-</span><span class="mf">02</span> <span class="o">|</span> <span class="n">AMC</span> <span class="n">Empire</span> <span class="mf">25</span>
|
||
<span class="n">Invisible</span> <span class="n">Man</span> <span class="o">|</span> <span class="n">Penn</span> <span class="n">Station</span> <span class="o">|</span> <span class="n">Sunday</span> <span class="o">|</span> <span class="mf">18</span><span class="p">:</span><span class="mf">00</span><span class="p">:</span><span class="mf">00.000000000</span> <span class="o">|</span> <span class="n">Leigh</span> <span class="n">Whannell</span> <span class="o">|</span> <span class="n">Elisabeth</span> <span class="n">Moss</span> <span class="o">|</span> <span class="mf">2022</span><span class="o">-</span><span class="mf">04</span><span class="o">-</span><span class="mf">06</span> <span class="o">|</span> <span class="n">AMC</span> <span class="mf">34</span><span class="n">th</span> <span class="n">Street</span> <span class="mf">14</span>
|
||
<span class="n">Invisible</span> <span class="n">Man</span> <span class="o">|</span> <span class="n">Penn</span> <span class="n">Station</span> <span class="o">|</span> <span class="n">Sunday</span> <span class="o">|</span> <span class="mf">22</span><span class="p">:</span><span class="mf">00</span><span class="p">:</span><span class="mf">00.000000000</span> <span class="o">|</span> <span class="n">Leigh</span> <span class="n">Whannell</span> <span class="o">|</span> <span class="n">Elisabeth</span> <span class="n">Moss</span> <span class="o">|</span> <span class="mf">2022</span><span class="o">-</span><span class="mf">04</span><span class="o">-</span><span class="mf">06</span> <span class="o">|</span> <span class="n">AMC</span> <span class="mf">34</span><span class="n">th</span> <span class="n">Street</span> <span class="mf">14</span>
|
||
<span class="n">Invisible</span> <span class="n">Man</span> <span class="o">|</span> <span class="n">Times</span> <span class="n">Square</span> <span class="o">|</span> <span class="n">Friday</span> <span class="o">|</span> <span class="mf">21</span><span class="p">:</span><span class="mf">00</span><span class="p">:</span><span class="mf">00.000000000</span> <span class="o">|</span> <span class="n">Leigh</span> <span class="n">Whannell</span> <span class="o">|</span> <span class="n">Elisabeth</span> <span class="n">Moss</span> <span class="o">|</span> <span class="mf">2022</span><span class="o">-</span><span class="mf">04</span><span class="o">-</span><span class="mf">06</span> <span class="o">|</span> <span class="n">AMC</span> <span class="n">Empire</span> <span class="mf">25</span>
|
||
<span class="n">Invisible</span> <span class="n">Man</span> <span class="o">|</span> <span class="n">Times</span> <span class="n">Square</span> <span class="o">|</span> <span class="n">Saturday</span> <span class="o">|</span> <span class="mf">22</span><span class="p">:</span><span class="mf">00</span><span class="p">:</span><span class="mf">00.000000000</span> <span class="o">|</span> <span class="n">Leigh</span> <span class="n">Whannell</span> <span class="o">|</span> <span class="n">Elisabeth</span> <span class="n">Moss</span> <span class="o">|</span> <span class="mf">2022</span><span class="o">-</span><span class="mf">04</span><span class="o">-</span><span class="mf">06</span> <span class="o">|</span> <span class="n">AMC</span> <span class="n">Empire</span> <span class="mf">25</span>
|
||
|
||
<span class="p">(</span><span class="mf">8</span> <span class="n">rows</span><span class="p">)</span>
|
||
</pre></div>
|
||
</div>
|
||
</li>
|
||
</ol>
|
||
</section>
|
||
<section id="update-a-table-using-a-lwt">
|
||
<h3>Update a table using a LWT<a class="headerlink" href="#update-a-table-using-a-lwt" title="Link to this heading">¶</a></h3>
|
||
<p>In this example the Times Square AMC theater needs to change the
|
||
theater name from AMC Empire 25 to AMC Empire. It can be done
|
||
using a conditional UPDATE, as shown here:</p>
|
||
<ol class="arabic">
|
||
<li><p>Update the table:</p>
|
||
<div class="highlight-cql notranslate"><div class="highlight"><pre><span></span><span class="k">UPDATE</span> <span class="n">movies</span><span class="mf">.</span><span class="n">nowshowing</span> <span class="k">SET</span> <span class="n">theater</span> <span class="o">=</span> <span class="s1">'AMC Empire'</span>
|
||
<span class="k">WHERE</span> <span class="n">location</span> <span class="o">=</span> <span class="s1">'Times Square'</span>
|
||
<span class="k">AND</span> <span class="n">run_day</span> <span class="o">=</span> <span class="s1">'Saturday'</span> <span class="k">AND</span> <span class="n">run_time</span> <span class="o">=</span><span class="s1">'14:00:00'</span>
|
||
<span class="k">AND</span> <span class="n">Movie</span> <span class="o">=</span> <span class="s1">'Sonic the Hedgehog'</span>
|
||
<span class="k">IF</span> <span class="k">EXISTS</span><span class="p">;</span>
|
||
|
||
<span class="p">[</span><span class="n">applied</span><span class="p">]</span> <span class="o">|</span> <span class="n">movie</span> <span class="o">|</span> <span class="n">location</span> <span class="o">|</span> <span class="n">run_day</span> <span class="o">|</span> <span class="n">run_time</span> <span class="o">|</span> <span class="n">director</span> <span class="o">|</span> <span class="n">main_actor</span> <span class="o">|</span> <span class="n">released</span> <span class="o">|</span> <span class="n">theater</span>
|
||
<span class="c1">-----------+--------------------+--------------+----------+--------------------+-------------+--------------+------------+---------------</span>
|
||
<span class="n">True</span> <span class="o">|</span> <span class="n">Sonic</span> <span class="n">the</span> <span class="n">Hedgehog</span> <span class="o">|</span> <span class="n">Times</span> <span class="n">Square</span> <span class="o">|</span> <span class="n">Saturday</span> <span class="o">|</span> <span class="mf">14</span><span class="p">:</span><span class="mf">00</span><span class="p">:</span><span class="mf">00.000000000</span> <span class="o">|</span> <span class="n">Jeff</span> <span class="n">Fowler</span> <span class="o">|</span> <span class="n">Ben</span> <span class="n">Schwartz</span> <span class="o">|</span> <span class="mf">2021</span><span class="o">-</span><span class="mf">02</span><span class="o">-</span><span class="mf">02</span> <span class="o">|</span> <span class="n">AMC</span> <span class="n">Empire</span> <span class="mf">25</span>
|
||
</pre></div>
|
||
</div>
|
||
</li>
|
||
<li><p>Show the current table, note the third line where the theater is now AMC Empire.</p>
|
||
<div class="highlight-cql notranslate"><div class="highlight"><pre><span></span><span class="k">SELECT</span> <span class="o">*</span> <span class="k">FROM</span> <span class="n">movies</span><span class="mf">.</span><span class="n">nowshowing</span><span class="p">;</span>
|
||
|
||
<span class="n">movie</span> <span class="o">|</span> <span class="n">location</span> <span class="o">|</span> <span class="n">run_day</span> <span class="o">|</span> <span class="n">run_time</span> <span class="o">|</span> <span class="n">director</span> <span class="o">|</span> <span class="n">main_actor</span> <span class="o">|</span> <span class="n">released</span> <span class="o">|</span> <span class="n">theater</span>
|
||
<span class="c1">--------------------+--------------+----------+--------------------+----------------+----------------+------------+--------------------</span>
|
||
<span class="n">Sonic</span> <span class="n">the</span> <span class="n">Hedgehog</span> <span class="o">|</span> <span class="n">Penn</span> <span class="n">Station</span> <span class="o">|</span> <span class="n">Sunday</span> <span class="o">|</span> <span class="mf">14</span><span class="p">:</span><span class="mf">00</span><span class="p">:</span><span class="mf">00.000000000</span> <span class="o">|</span> <span class="n">Jeff</span> <span class="n">Fowler</span> <span class="o">|</span> <span class="n">Ben</span> <span class="n">Schwartz</span> <span class="o">|</span> <span class="mf">2021</span><span class="o">-</span><span class="mf">02</span><span class="o">-</span><span class="mf">02</span> <span class="o">|</span> <span class="n">AMC</span> <span class="mf">34</span><span class="n">th</span> <span class="n">Street</span> <span class="mf">14</span>
|
||
<span class="n">Sonic</span> <span class="n">the</span> <span class="n">Hedgehog</span> <span class="o">|</span> <span class="n">Penn</span> <span class="n">Station</span> <span class="o">|</span> <span class="n">Sunday</span> <span class="o">|</span> <span class="mf">21</span><span class="p">:</span><span class="mf">00</span><span class="p">:</span><span class="mf">00.000000000</span> <span class="o">|</span> <span class="n">Jeff</span> <span class="n">Fowler</span> <span class="o">|</span> <span class="n">Ben</span> <span class="n">Schwartz</span> <span class="o">|</span> <span class="mf">2021</span><span class="o">-</span><span class="mf">02</span><span class="o">-</span><span class="mf">02</span> <span class="o">|</span> <span class="n">AMC</span> <span class="mf">34</span><span class="n">th</span> <span class="n">Street</span> <span class="mf">14</span>
|
||
<span class="n">Sonic</span> <span class="n">the</span> <span class="n">Hedgehog</span> <span class="o">|</span> <span class="n">Times</span> <span class="n">Square</span> <span class="o">|</span> <span class="n">Saturday</span> <span class="o">|</span> <span class="mf">14</span><span class="p">:</span><span class="mf">00</span><span class="p">:</span><span class="mf">00.000000000</span> <span class="o">|</span> <span class="n">Jeff</span> <span class="n">Fowler</span> <span class="o">|</span> <span class="n">Ben</span> <span class="n">Schwartz</span> <span class="o">|</span> <span class="mf">2021</span><span class="o">-</span><span class="mf">02</span><span class="o">-</span><span class="mf">02</span> <span class="o">|</span> <span class="n">AMC</span> <span class="n">Empire</span>
|
||
<span class="n">Sonic</span> <span class="n">the</span> <span class="n">Hedgehog</span> <span class="o">|</span> <span class="n">Times</span> <span class="n">Square</span> <span class="o">|</span> <span class="n">Saturday</span> <span class="o">|</span> <span class="mf">21</span><span class="p">:</span><span class="mf">00</span><span class="p">:</span><span class="mf">00.000000000</span> <span class="o">|</span> <span class="n">Jeff</span> <span class="n">Fowler</span> <span class="o">|</span> <span class="n">Ben</span> <span class="n">Schwartz</span> <span class="o">|</span> <span class="mf">2021</span><span class="o">-</span><span class="mf">02</span><span class="o">-</span><span class="mf">02</span> <span class="o">|</span> <span class="n">AMC</span> <span class="n">Empire</span> <span class="mf">25</span>
|
||
<span class="n">Invisible</span> <span class="n">Man</span> <span class="o">|</span> <span class="n">Penn</span> <span class="n">Station</span> <span class="o">|</span> <span class="n">Sunday</span> <span class="o">|</span> <span class="mf">18</span><span class="p">:</span><span class="mf">00</span><span class="p">:</span><span class="mf">00.000000000</span> <span class="o">|</span> <span class="n">Leigh</span> <span class="n">Whannell</span> <span class="o">|</span> <span class="n">Elisabeth</span> <span class="n">Moss</span> <span class="o">|</span> <span class="mf">2022</span><span class="o">-</span><span class="mf">04</span><span class="o">-</span><span class="mf">06</span> <span class="o">|</span> <span class="n">AMC</span> <span class="mf">34</span><span class="n">th</span> <span class="n">Street</span> <span class="mf">14</span>
|
||
<span class="n">Invisible</span> <span class="n">Man</span> <span class="o">|</span> <span class="n">Penn</span> <span class="n">Station</span> <span class="o">|</span> <span class="n">Sunday</span> <span class="o">|</span> <span class="mf">22</span><span class="p">:</span><span class="mf">00</span><span class="p">:</span><span class="mf">00.000000000</span> <span class="o">|</span> <span class="n">Leigh</span> <span class="n">Whannell</span> <span class="o">|</span> <span class="n">Elisabeth</span> <span class="n">Moss</span> <span class="o">|</span> <span class="mf">2022</span><span class="o">-</span><span class="mf">04</span><span class="o">-</span><span class="mf">06</span> <span class="o">|</span> <span class="n">AMC</span> <span class="mf">34</span><span class="n">th</span> <span class="n">Street</span> <span class="mf">14</span>
|
||
<span class="n">Invisible</span> <span class="n">Man</span> <span class="o">|</span> <span class="n">Times</span> <span class="n">Square</span> <span class="o">|</span> <span class="n">Friday</span> <span class="o">|</span> <span class="mf">21</span><span class="p">:</span><span class="mf">00</span><span class="p">:</span><span class="mf">00.000000000</span> <span class="o">|</span> <span class="n">Leigh</span> <span class="n">Whannell</span> <span class="o">|</span> <span class="n">Elisabeth</span> <span class="n">Moss</span> <span class="o">|</span> <span class="mf">2022</span><span class="o">-</span><span class="mf">04</span><span class="o">-</span><span class="mf">06</span> <span class="o">|</span> <span class="n">AMC</span> <span class="n">Empire</span> <span class="mf">25</span>
|
||
<span class="n">Invisible</span> <span class="n">Man</span> <span class="o">|</span> <span class="n">Times</span> <span class="n">Square</span> <span class="o">|</span> <span class="n">Saturday</span> <span class="o">|</span> <span class="mf">22</span><span class="p">:</span><span class="mf">00</span><span class="p">:</span><span class="mf">00.000000000</span> <span class="o">|</span> <span class="n">Leigh</span> <span class="n">Whannell</span> <span class="o">|</span> <span class="n">Elisabeth</span> <span class="n">Moss</span> <span class="o">|</span> <span class="mf">2022</span><span class="o">-</span><span class="mf">04</span><span class="o">-</span><span class="mf">06</span> <span class="o">|</span> <span class="n">AMC</span> <span class="n">Empire</span> <span class="mf">25</span>
|
||
|
||
<span class="p">(</span><span class="mf">8</span> <span class="n">rows</span><span class="p">)</span>
|
||
</pre></div>
|
||
</div>
|
||
</li>
|
||
</ol>
|
||
</section>
|
||
<section id="update-a-table-using-a-conditional-batch">
|
||
<h3>Update a table using a conditional batch<a class="headerlink" href="#update-a-table-using-a-conditional-batch" title="Link to this heading">¶</a></h3>
|
||
<p>Suppose you want to update the run time of a movie at a certain
|
||
location. As the run time is part of the primary key, you cannot modify it.
|
||
However, you can remove and re-insert the record.</p>
|
||
<ol class="arabic">
|
||
<li><p>Run a batch job which removes and inserts a record:</p>
|
||
<div class="highlight-cql notranslate"><div class="highlight"><pre><span></span><span class="k">BEGIN</span> <span class="k">BATCH</span>
|
||
<span class="k">DELETE</span> <span class="k">FROM</span> <span class="n">movies</span><span class="mf">.</span><span class="n">nowshowing</span>
|
||
<span class="k">WHERE</span> <span class="n">movie</span> <span class="o">=</span> <span class="s1">'Sonic the Hedgehog'</span> <span class="k">AND</span> <span class="n">location</span> <span class="o">=</span> <span class="s1">'Times Square'</span>
|
||
<span class="k">AND</span> <span class="n">run_day</span> <span class="o">=</span> <span class="s1">'Saturday'</span> <span class="k">AND</span> <span class="n">run_time</span> <span class="o">=</span> <span class="s1">'21:00:00'</span>
|
||
<span class="k">IF</span> <span class="k">EXISTS</span>
|
||
|
||
<span class="k">INSERT</span> <span class="k">INTO</span> <span class="n">movies</span><span class="mf">.</span><span class="n">nowshowing</span> <span class="p">(</span><span class="n">movie</span><span class="p">,</span> <span class="n">location</span><span class="p">,</span> <span class="n">theater</span><span class="p">,</span> <span class="n">run_day</span><span class="p">,</span> <span class="n">run_time</span><span class="p">)</span>
|
||
<span class="k">VALUES</span> <span class="p">(</span><span class="s1">'Sonic the Hedgehog'</span><span class="p">,</span> <span class="s1">'Times Square'</span><span class="p">,</span> <span class="s1">'AMC Empire 25'</span><span class="p">,</span> <span class="s1">'Saturday'</span><span class="p">,</span> <span class="s1">'23:00:00'</span><span class="p">)</span>
|
||
<span class="k">APPLY</span> <span class="k">BATCH</span><span class="p">;</span>
|
||
</pre></div>
|
||
</div>
|
||
</li>
|
||
<li><p>Show the current table</p>
|
||
<div class="highlight-cql notranslate"><div class="highlight"><pre><span></span><span class="k">SELECT</span> <span class="o">*</span> <span class="k">FROM</span> <span class="n">movies</span><span class="mf">.</span><span class="n">nowshowing</span><span class="p">;</span>
|
||
</pre></div>
|
||
</div>
|
||
</li>
|
||
</ol>
|
||
</section>
|
||
<section id="delete-a-partition-using-a-conditional-batch">
|
||
<h3>Delete a partition using a conditional batch<a class="headerlink" href="#delete-a-partition-using-a-conditional-batch" title="Link to this heading">¶</a></h3>
|
||
<p>The movie, “Invisible Man” is no longer being played so the theater wants to delete it.
|
||
This involves creating a batch job which will:</p>
|
||
<ul class="simple">
|
||
<li><p>Mark the batch as conditional to make it atomic</p></li>
|
||
<li><p>Delete the entire partition</p></li>
|
||
</ul>
|
||
<ol class="arabic">
|
||
<li><p>Run the following:</p>
|
||
<div class="highlight-cql notranslate"><div class="highlight"><pre><span></span><span class="k">BEGIN</span> <span class="k">BATCH</span>
|
||
<span class="k">UPDATE</span> <span class="n">movies</span><span class="mf">.</span><span class="n">nowshowing</span> <span class="k">SET</span> <span class="n">released</span> <span class="o">=</span> <span class="k">NULL</span> <span class="k">WHERE</span> <span class="n">movie</span> <span class="o">=</span> <span class="s1">'Invisible Man'</span> <span class="k">IF</span> <span class="k">EXISTS</span>
|
||
<span class="k">DELETE</span> <span class="k">FROM</span> <span class="n">movies</span><span class="mf">.</span><span class="n">nowshowing</span> <span class="k">WHERE</span> <span class="n">movie</span> <span class="o">=</span> <span class="s1">'Invisible Man'</span>
|
||
<span class="k">APPLY</span> <span class="k">BATCH</span><span class="p">;</span>
|
||
</pre></div>
|
||
</div>
|
||
</li>
|
||
</ol>
|
||
</section>
|
||
</section>
|
||
<section id="how-is-if-different-from-where">
|
||
<h2>How is IF different from WHERE?<a class="headerlink" href="#how-is-if-different-from-where" title="Link to this heading">¶</a></h2>
|
||
<p>One may think that IF clause should be used in place of WHERE - and this is true to a large extent, both accept expressions and are applied to the searched row.</p>
|
||
<p>Unlike the WHERE clause, IF conditions never use a secondary index; as the rows are fetched before a condition is evaluated.</p>
|
||
<p>Keep in mind that the IF condition applies <strong>only</strong> to a fully qualified row, meaning you must specify the partition key and in many cases the clustering key as well.
|
||
In the WHERE clause you would use <code class="docutils literal notranslate"><span class="pre">DELETE</span></code> or <code class="docutils literal notranslate"><span class="pre">UPDATE</span></code> or in <code class="docutils literal notranslate"><span class="pre">SET</span></code>. When using <code class="docutils literal notranslate"><span class="pre">UPDATE</span></code> and <code class="docutils literal notranslate"><span class="pre">INSERT</span></code> with <code class="docutils literal notranslate"><span class="pre">WHERE</span></code> you would also need the <code class="docutils literal notranslate"><span class="pre">VALUES</span></code> clause.</p>
|
||
<p>If your data selection fetches multiple rows, your <code class="docutils literal notranslate"><span class="pre">IF</span></code> condition <strong>cannot</strong> be ambiguous, meaning it can not evaluate to <code class="docutils literal notranslate"><span class="pre">TRUE</span></code> for one row and to <code class="docutils literal notranslate"><span class="pre">FALSE</span></code> for another.
|
||
This includes statements which restrict only the partition key, and not the clustering key, or the partition key and multiple
|
||
clustering keys (pk = ? and ck IN (?, ?, ?). In these instances, only the conditions on static cells are accepted.</p>
|
||
</section>
|
||
<section id="working-with-conditional-statement-result-set">
|
||
<h2>Working with conditional statement result set<a class="headerlink" href="#working-with-conditional-statement-result-set" title="Link to this heading">¶</a></h2>
|
||
<p>A conditional statement always returns a result set. The result
|
||
set’s first column <code class="docutils literal notranslate"><span class="pre">[applied]</span></code> is special: it indicates whether
|
||
the statement was applied or not. Following the <code class="docutils literal notranslate"><span class="pre">[applied]</span></code>
|
||
column are the primary key columns
|
||
and then the columns used in the conditional expression. The result set
|
||
contains previous (old) values for these columns. If condition is
|
||
<code class="docutils literal notranslate"><span class="pre">IF</span> <span class="pre">EXISTS</span></code> or <code class="docutils literal notranslate"><span class="pre">IF</span> <span class="pre">NOT</span> <span class="pre">EXISTS</span></code> all columns of the column
|
||
family become part of the result set.
|
||
If the statement inserts a new row so previous values did not exist, the result will contain
|
||
NULLs.</p>
|
||
<p>A batch statement may contain multiple conditional statements. Each conditional statement
|
||
of a batch yields a row of the result set, and these rows are returned in statement order.
|
||
Non-conditional statements may be present in a conditional batch, but do not contribute
|
||
to the result set. The set of columns of conditional batch result set is a set union
|
||
of all columns used in conditional expressions of all conditional statements of the batch.</p>
|
||
<div class="highlight-cql notranslate"><div class="highlight"><pre><span></span><span class="k">BEGIN</span> <span class="k">BATCH</span>
|
||
<span class="k">UPDATE</span> <span class="n">movies</span><span class="mf">.</span><span class="n">nowshowing</span> <span class="k">SET</span> <span class="n">main_actor</span> <span class="o">=</span> <span class="s1">'Aldis Hodge'</span> <span class="k">WHERE</span> <span class="n">movie</span> <span class="o">=</span> <span class="s1">'Invisible Man'</span> <span class="k">IF</span> <span class="n">main_actor</span> <span class="o">=</span> <span class="s1">'Elisabeth Moss'</span>
|
||
<span class="k">UPDATE</span> <span class="n">movies</span><span class="mf">.</span><span class="n">nowshowing</span> <span class="k">SET</span> <span class="n">director</span> <span class="o">=</span> <span class="s1">'Mr Saw '</span> <span class="k">WHERE</span> <span class="n">movie</span> <span class="o">=</span> <span class="s1">'Invisible Man'</span> <span class="k">IF</span> <span class="n">director</span> <span class="o">=</span> <span class="s1">'Leigh Whannell'</span>
|
||
<span class="k">APPLY</span> <span class="k">BATCH</span><span class="p">;</span>
|
||
|
||
<span class="p">[</span><span class="n">applied</span><span class="p">]</span> <span class="o">|</span> <span class="n">movie</span> <span class="o">|</span> <span class="n">location</span> <span class="o">|</span> <span class="n">run_day</span> <span class="o">|</span> <span class="n">run_time</span> <span class="o">|</span> <span class="n">director</span> <span class="o">|</span> <span class="n">main_actor</span>
|
||
<span class="c1">-----------+---------------+----------+---------+----------+----------------+----------------</span>
|
||
<span class="n">True</span> <span class="o">|</span> <span class="n">Invisible</span> <span class="n">Man</span> <span class="o">|</span> <span class="k">null</span> <span class="o">|</span> <span class="k">null</span> <span class="o">|</span> <span class="k">null</span> <span class="o">|</span> <span class="n">Leigh</span> <span class="n">Whannell</span> <span class="o">|</span> <span class="n">Elisabeth</span> <span class="n">Moss</span>
|
||
<span class="n">True</span> <span class="o">|</span> <span class="n">Invisible</span> <span class="n">Man</span> <span class="o">|</span> <span class="k">null</span> <span class="o">|</span> <span class="k">null</span> <span class="o">|</span> <span class="k">null</span> <span class="o">|</span> <span class="n">Leigh</span> <span class="n">Whannell</span> <span class="o">|</span> <span class="n">Elisabeth</span> <span class="n">Moss</span>
|
||
</pre></div>
|
||
</div>
|
||
</section>
|
||
<section id="error-handling">
|
||
<h2>Error handling<a class="headerlink" href="#error-handling" title="Link to this heading">¶</a></h2>
|
||
<p>Error executing a conditional statement (LWT) does
|
||
not necessarily mean it failed. In addition to standard causes for failure such as
|
||
client-side timeouts, server overload, memory allocation error, Paxos has its own scenarios
|
||
leading to uncertainty:</p>
|
||
<ul class="simple">
|
||
<li><p>An update started by one node is allowed to be overtaken and completed by another node.</p></li>
|
||
<li><p>The coordinator may fail or timeout after a write has succeeded at the majority of the participants and thus has de-facto committed.</p></li>
|
||
</ul>
|
||
<p>To know for sure, a client must read the value back or retry the operation until it succeeds.
|
||
Retrying should be done only if the failure is transient. It would be useless to retry in case of, e.g., a syntax
|
||
error. Let’s consider some transient errors in more detail.</p>
|
||
<table class="docutils align-default">
|
||
<thead>
|
||
<tr class="row-odd"><th class="head"><p>Error</p></th>
|
||
<th class="head"><p>Description</p></th>
|
||
</tr>
|
||
</thead>
|
||
<tbody>
|
||
<tr class="row-even"><td><p>Unavailable exception</p></td>
|
||
<td><p>Indicates that the coordinator is unable to contact the number of
|
||
replicas required by the statement consistency level.
|
||
This can happen because one or more nodes are down.
|
||
Alternatively, the ring simply may not have enough replicas
|
||
to satisfy the keyspace replication factor.
|
||
The coordinator performs availability checks independently for Paxos
|
||
COMMIT and LEARN steps to satisfy <code class="docutils literal notranslate"><span class="pre">SERIAL</span> <span class="pre">CONSISTENCY</span></code> and
|
||
<code class="docutils literal notranslate"><span class="pre">CONSISTENCY</span></code> settings respectively.
|
||
Is a transient failure, unless the cluster is misconfigured.
|
||
The step at which availability error had happened can be determined
|
||
by the returned consistency level. If CL is <code class="docutils literal notranslate"><span class="pre">SERIAL</span></code> or
|
||
<code class="docutils literal notranslate"><span class="pre">LOCAL_SERIAL</span></code> the failure happened before the statement could have
|
||
any effect. Failures during LEARN,
|
||
on the contrary, happen after the statement had already been committed
|
||
by Paxos. CL for such failures would be <code class="docutils literal notranslate"><span class="pre">ONE</span></code>, <code class="docutils literal notranslate"><span class="pre">QUORUM</span></code> or
|
||
similar.</p></td>
|
||
</tr>
|
||
<tr class="row-odd"><td><p>Write timeout</p></td>
|
||
<td><p>A write timeout can happen at any step of Paxos. If it happens after
|
||
the majority of the nodes has received the write, the write will be
|
||
committed despite the failure.</p></td>
|
||
</tr>
|
||
<tr class="row-even"><td><p>Read timeout</p></td>
|
||
<td><p>Has the same meaning as Write timeout, but is returned for SELECTs.
|
||
Internally, conditional updates may perform reads, but timeouts
|
||
during these are still returned as write timeouts.</p></td>
|
||
</tr>
|
||
</tbody>
|
||
</table>
|
||
</section>
|
||
<section id="limitations">
|
||
<h2>Limitations<a class="headerlink" href="#limitations" title="Link to this heading">¶</a></h2>
|
||
<p>The following limitations apply:</p>
|
||
<ul class="simple">
|
||
<li><p>You cannot use conditional batches to modify multiple partitions</p></li>
|
||
<li><p>You cannot use LWT with tables which use counters</p></li>
|
||
<li><p>When using user-supplied timestamps, you must make sure that the timestamp is assigned by the transaction coordinator. If not, it will not be possible to guarantee consistency.</p></li>
|
||
<li><p>It is not recommended to use conditional (LWT) and non-conditional statements with the same data set as it is not possible to ensure that conditional statements are consistent in this case. In short, all LWT data sets should not use write operations that are not LWT in structure.</p></li>
|
||
</ul>
|
||
<p>Other limitations are more minor:</p>
|
||
<ul class="simple">
|
||
<li><p>While a non-LWT batch can be UNLOGGED, a conditional batch cannot;</p></li>
|
||
<li><p>IF conditions must be a perfect conjunct (… AND … AND …);</p></li>
|
||
<li><p>Conditional batches are always logged in system.paxos table, so UNLOGGED keyword is silently ignored for them.</p></li>
|
||
</ul>
|
||
</section>
|
||
<section id="additional-information">
|
||
<h2>Additional Information<a class="headerlink" href="#additional-information" title="Link to this heading">¶</a></h2>
|
||
<ul class="simple">
|
||
<li><p><a class="reference internal" href="../kb/lwt-differences.html"><span class="doc">How does ScyllaDB LWT Differ from Apache Cassandra ?</span></a> - How does ScyllaDB’s implementation of lightweight transactions differ from Apache Cassandra?</p></li>
|
||
<li><p><a class="reference internal" href="../kb/gc-grace-seconds.html"><span class="doc">How to Change gc_grace_seconds for a Table</span></a> - How to change the <code class="docutils literal notranslate"><span class="pre">gc_grace_seconds</span></code> parameter for a table</p></li>
|
||
</ul>
|
||
</section>
|
||
</section>
|
||
|
||
</div>
|
||
|
||
<div class="post-content">
|
||
|
||
<div class="feedback-container">
|
||
<p class="feedback-container__title">Was this page helpful?</p>
|
||
<span data-tooltip tabindex="1" title="Yes" data-position="top">
|
||
<button class="feedback-container__button" id="feedback-positive">
|
||
<i class="feedback-container__icon icon-docs-thumbs-up"></i>
|
||
</button>
|
||
</span>
|
||
<span data-tooltip tabindex="1" title="No" data-position="top">
|
||
<button class="feedback-container__button" id="feedback-negative">
|
||
<i class="feedback-container__icon icon-docs-thumbs-down"></i>
|
||
</button>
|
||
</span>
|
||
<div class="feedback-container__message" id="feedback-message"></div>
|
||
</div>
|
||
|
||
<script>
|
||
function resetFeedbackButtonActive() {
|
||
const feedbackButtons = document.getElementsByClassName('feedback-container__button');
|
||
for (let i = 0; i < feedbackButtons.length; i++) {
|
||
feedbackButtons[i].classList.remove('active');
|
||
}
|
||
}
|
||
|
||
function showMessage(liked) {
|
||
const feedbackMessage = document.getElementById('feedback-message');
|
||
const themeGithubRepository = true;
|
||
let message = 'Great! Thanks for your feedback.';
|
||
if (themeGithubRepository && !liked) {
|
||
message = "Thanks for your feedback! Please don't hesitate to <a href='https://github.com/scylladb/scylladb/issues/new?title=docs:%20Issue on page Lightweight Transactions&&body=I%20would%20like%20to%20report%20an%20issue%20on%20page%20https://opensource.docs.scylladb.com/branch-6.2/features/lwt%0A%0A%23%23%23%20Problem%0A%0A%23%23%23%20%20Suggest%20a%20fix&labels=documentation'>create an issue</a> if you have any suggestions on how we can improve.";
|
||
}
|
||
feedbackMessage.innerHTML = message;
|
||
}
|
||
|
||
function sendGaEvent(liked) {
|
||
const event_label = liked ? "positive" : "negative";
|
||
const event = "feedback_" + event_label;
|
||
window.dataLayer = window.dataLayer || [];
|
||
window.dataLayer.push({
|
||
'event': event,
|
||
});
|
||
}
|
||
|
||
const positiveFeebackButton = document.getElementById('feedback-positive');
|
||
const negativeFeedbackButton = document.getElementById('feedback-negative');
|
||
|
||
positiveFeebackButton.addEventListener('click', function() {
|
||
resetFeedbackButtonActive();
|
||
sendGaEvent(true);
|
||
showMessage(true);
|
||
positiveFeebackButton.classList.add('active');
|
||
});
|
||
|
||
negativeFeedbackButton.addEventListener('click', function() {
|
||
resetFeedbackButtonActive();
|
||
sendGaEvent(false);
|
||
showMessage(false);
|
||
negativeFeedbackButton.classList.add('active');
|
||
});
|
||
</script>
|
||
|
||
<div class="content-navigation">
|
||
<div class="navigation navigation--prev">
|
||
|
||
<a class="navigation__link" href="index.html">
|
||
<button class="navigation__button">
|
||
<i class="icon-chevron-left"></i>
|
||
</button>
|
||
<div class="navigation__title">
|
||
<span class="colored">PREVIOUS</span> <br />Features
|
||
</div>
|
||
</a>
|
||
|
||
</div>
|
||
<div class="navigation navigation--next">
|
||
|
||
<a class="navigation__link" href="secondary-indexes.html">
|
||
<div class="navigation__title">
|
||
<span class="colored">NEXT</span> <br />Global Secondary Indexes
|
||
</div>
|
||
<button class="navigation__button">
|
||
<i class="icon-chevron-right"></i>
|
||
</button>
|
||
</a>
|
||
|
||
</div>
|
||
</div>
|
||
<!-- Post content text -->
|
||
</div>
|
||
|
||
|
||
|
||
</div>
|
||
<div class="sidebar-right large-order-3">
|
||
<div class="secondary-side-nav custom-scroll-bar">
|
||
|
||
<ul class="contribute">
|
||
<li class="contribute__item">
|
||
<a class="button button-sm" href="https://github.com/scylladb/scylladb/issues/new?title=docs:%20Issue on page Lightweight Transactions&&body=I%20would%20like%20to%20report%20an%20issue%20on%20page%20https://opensource.docs.scylladb.com/branch-6.2/features/lwt%0A%0A%23%23%23%20Problem%0A%0A%23%23%23%20%20Suggest%20a%20fix&labels=documentation"
|
||
target="_blank">
|
||
<i class="icon-github" aria-hidden="true"></i>Create an issue
|
||
</a>
|
||
</li>
|
||
|
||
<li class="contribute__item">
|
||
<a class="button button-sm" href="https://github.com/scylladb/scylladb/edit/master/docs/features/lwt.rst"
|
||
target="_blank">
|
||
<i class="icon-edit" aria-hidden="true"></i>Edit this page
|
||
</a>
|
||
</li>
|
||
|
||
</ul>
|
||
|
||
|
||
<div class="secondary-side-nav__content">
|
||
<p class="topic-title">On this page</p>
|
||
<ul>
|
||
<li><a class="reference internal" href="#">Lightweight Transactions</a><ul>
|
||
<li><a class="reference internal" href="#the-if-clause">The IF clause</a></li>
|
||
<li><a class="reference internal" href="#what-row-does-if-clause-apply-to">What row does IF clause apply to?</a></li>
|
||
<li><a class="reference internal" href="#scylladb-paxos">ScyllaDB Paxos</a></li>
|
||
<li><a class="reference internal" href="#batch-statements">Batch statements</a></li>
|
||
<li><a class="reference internal" href="#reading-with-paxos">Reading with Paxos</a></li>
|
||
<li><a class="reference internal" href="#cql-examples-with-lightweight-transactions">CQL examples with lightweight transactions</a><ul>
|
||
<li><a class="reference internal" href="#add-values-to-a-table-with-lwt">Add values to a table with LWT</a></li>
|
||
<li><a class="reference internal" href="#update-a-table-using-a-lwt">Update a table using a LWT</a></li>
|
||
<li><a class="reference internal" href="#update-a-table-using-a-conditional-batch">Update a table using a conditional batch</a></li>
|
||
<li><a class="reference internal" href="#delete-a-partition-using-a-conditional-batch">Delete a partition using a conditional batch</a></li>
|
||
</ul>
|
||
</li>
|
||
<li><a class="reference internal" href="#how-is-if-different-from-where">How is IF different from WHERE?</a></li>
|
||
<li><a class="reference internal" href="#working-with-conditional-statement-result-set">Working with conditional statement result set</a></li>
|
||
<li><a class="reference internal" href="#error-handling">Error handling</a></li>
|
||
<li><a class="reference internal" href="#limitations">Limitations</a></li>
|
||
<li><a class="reference internal" href="#additional-information">Additional Information</a></li>
|
||
</ul>
|
||
</li>
|
||
</ul>
|
||
|
||
</div>
|
||
|
||
</div>
|
||
</div>
|
||
</div>
|
||
|
||
</div>
|
||
<div class="sidebar-left large-order-1">
|
||
|
||
|
||
<div id="side-nav" class="side-nav custom-scroll-bar" data-closable data-toggler=".show">
|
||
<button class="collapsible-button">
|
||
<i class="icon-docs-menu-collapse"></i>
|
||
</button>
|
||
<div class="side-nav-content custom-scroll-bar">
|
||
<div class="side-nav__title">
|
||
<a href="../index.html">ScyllaDB Open Source</a>
|
||
</div>
|
||
<div class="side-nav__search">
|
||
|
||
<biel-search-button
|
||
project="ddfdo8m94k"
|
||
button-style="rounded"
|
||
hide-filters="false"
|
||
hide-ctrl-k="true"
|
||
header-title="ScyllaDB chatbot (beta)"
|
||
modal-position="top-center">
|
||
Search
|
||
</biel-search-button>
|
||
|
||
<biel-button class="side-nav__ask-ai" project="ddfdo8m94k"
|
||
header-title="ScyllaDB chatbot (beta)"
|
||
button-position="default"
|
||
modal-position="sidebar-right"
|
||
button-style="dark">
|
||
Ask AI
|
||
</biel-button>
|
||
|
||
|
||
</div>
|
||
<div class="side-nav__versions"><ul class="dropdown menu scylla-dropdown scylla-dropdown--versions" data-dropdown-menu>
|
||
<li class="scylla-dropdown__item">
|
||
<a class="scylla-dropdown__title" href="#">
|
||
|
||
6.2
|
||
|
||
<i class="chevron icon-docs-chevron-right"></i>
|
||
</a>
|
||
<ul class="menu scylla-dropdown__content">
|
||
|
||
|
||
<li>
|
||
<a href="lwt.html">6.2</a>
|
||
</li>
|
||
|
||
|
||
|
||
<li>
|
||
<a href="../../branch-6.1/index.html">6.1</a>
|
||
</li>
|
||
|
||
|
||
|
||
<li>
|
||
<a href="../../branch-6.0/index.html">6.0</a>
|
||
</li>
|
||
|
||
|
||
|
||
<li>
|
||
<a href="../../branch-5.4/index.html">5.4</a>
|
||
</li>
|
||
|
||
|
||
|
||
<li>
|
||
<a href="../../branch-5.2/index.html">5.2</a>
|
||
</li>
|
||
|
||
|
||
|
||
<li>
|
||
<a href="../../branch-5.1/index.html">5.1</a>
|
||
</li>
|
||
|
||
|
||
|
||
</ul>
|
||
</li>
|
||
</ul></div>
|
||
<div class="side-nav__content">
|
||
<ul class="current">
|
||
<li class="toctree-l1 has-children"><a class="reference internal" href="../getting-started/index.html">Getting Started</a><input class="toctree-checkbox" id="toctree-checkbox-1" name="toctree-checkbox-1" type="checkbox"/><label for="toctree-checkbox-1"><i class="icon-chevron-right"></i></label><div class="break"></div><ul>
|
||
<li class="toctree-l2 has-children"><a class="reference internal" href="../getting-started/install-scylla/index.html">Install ScyllaDB</a><input class="toctree-checkbox" id="toctree-checkbox-2" name="toctree-checkbox-2" type="checkbox"/><label for="toctree-checkbox-2"><i class="icon-chevron-right"></i></label><div class="break"></div><ul>
|
||
<li class="toctree-l3"><a class="reference internal" href="../getting-started/install-scylla/launch-on-aws.html">Launch ScyllaDB on AWS</a></li>
|
||
<li class="toctree-l3"><a class="reference internal" href="../getting-started/install-scylla/launch-on-gcp.html">Launch ScyllaDB on GCP</a></li>
|
||
<li class="toctree-l3"><a class="reference internal" href="../getting-started/install-scylla/launch-on-azure.html">Launch ScyllaDB on Azure</a></li>
|
||
<li class="toctree-l3"><a class="reference internal" href="../getting-started/installation-common/scylla-web-installer.html">ScyllaDB Web Installer for Linux</a></li>
|
||
<li class="toctree-l3"><a class="reference internal" href="../getting-started/install-scylla/install-on-linux.html">Install ScyllaDB Linux Packages</a></li>
|
||
<li class="toctree-l3"><a class="reference internal" href="../getting-started/install-scylla/install-jmx.html">Install scylla-jmx Package</a></li>
|
||
<li class="toctree-l3"><a class="reference internal" href="../getting-started/install-scylla/run-in-docker.html">Run ScyllaDB in Docker</a></li>
|
||
<li class="toctree-l3"><a class="reference internal" href="../getting-started/installation-common/unified-installer.html">Install ScyllaDB Without root Privileges</a></li>
|
||
<li class="toctree-l3"><a class="reference internal" href="../getting-started/installation-common/air-gapped-install.html">Air-gapped Server Installation</a></li>
|
||
<li class="toctree-l3"><a class="reference internal" href="../getting-started/installation-common/disable-housekeeping.html">ScyllaDB Housekeeping and how to disable it</a></li>
|
||
<li class="toctree-l3"><a class="reference internal" href="../getting-started/installation-common/dev-mod.html">ScyllaDB Developer Mode</a></li>
|
||
</ul>
|
||
</li>
|
||
<li class="toctree-l2"><a class="reference internal" href="../getting-started/configure.html">Configure ScyllaDB</a></li>
|
||
<li class="toctree-l2"><a class="reference internal" href="../getting-started/config-commands.html">ScyllaDB Configuration Reference</a></li>
|
||
<li class="toctree-l2 has-children"><a class="reference internal" href="../getting-started/requirements.html">ScyllaDB Requirements</a><input class="toctree-checkbox" id="toctree-checkbox-3" name="toctree-checkbox-3" type="checkbox"/><label for="toctree-checkbox-3"><i class="icon-chevron-right"></i></label><div class="break"></div><ul>
|
||
<li class="toctree-l3"><a class="reference internal" href="../getting-started/system-requirements.html">System Requirements</a></li>
|
||
<li class="toctree-l3"><a class="reference internal" href="../getting-started/os-support.html">OS Support by Linux Distributions and Version</a></li>
|
||
<li class="toctree-l3"><a class="reference internal" href="../getting-started/cloud-instance-recommendations.html">Cloud Instance Recommendations</a></li>
|
||
<li class="toctree-l3"><a class="reference internal" href="../getting-started/scylla-in-a-shared-environment.html">ScyllaDB in a Shared Environment</a></li>
|
||
</ul>
|
||
</li>
|
||
<li class="toctree-l2 has-children"><a class="reference internal" href="../using-scylla/migrate-scylla.html">Migrate to ScyllaDB</a><input class="toctree-checkbox" id="toctree-checkbox-4" name="toctree-checkbox-4" type="checkbox"/><label for="toctree-checkbox-4"><i class="icon-chevron-right"></i></label><div class="break"></div><ul>
|
||
<li class="toctree-l3"><a class="reference internal" href="../operating-scylla/procedures/cassandra-to-scylla-migration-process.html">Migration Process from Cassandra to ScyllaDB</a></li>
|
||
<li class="toctree-l3"><a class="reference internal" href="../using-scylla/cassandra-compatibility.html">ScyllaDB and Apache Cassandra Compatibility</a></li>
|
||
<li class="toctree-l3"><a class="reference internal" href="../using-scylla/mig-tool-review.html">Migration Tools Overview</a></li>
|
||
</ul>
|
||
</li>
|
||
<li class="toctree-l2 has-children"><a class="reference internal" href="../using-scylla/integrations/index.html">Integration Solutions</a><input class="toctree-checkbox" id="toctree-checkbox-5" name="toctree-checkbox-5" type="checkbox"/><label for="toctree-checkbox-5"><i class="icon-chevron-right"></i></label><div class="break"></div><ul>
|
||
<li class="toctree-l3"><a class="reference internal" href="../using-scylla/integrations/integration-spark.html">Integrate ScyllaDB with Spark</a></li>
|
||
<li class="toctree-l3"><a class="reference internal" href="../using-scylla/integrations/integration-kairos.html">Integrate ScyllaDB with KairosDB</a></li>
|
||
<li class="toctree-l3"><a class="reference internal" href="../using-scylla/integrations/integration-presto.html">Integrate ScyllaDB with Presto</a></li>
|
||
<li class="toctree-l3"><a class="reference internal" href="../using-scylla/integrations/integration-elasticsearch.html">Integrate ScyllaDB with Elasticsearch</a></li>
|
||
<li class="toctree-l3"><a class="reference internal" href="../using-scylla/integrations/integration-k8.html">Integrate ScyllaDB with Kubernetes</a></li>
|
||
<li class="toctree-l3"><a class="reference internal" href="../using-scylla/integrations/integration-janus.html">Integrate ScyllaDB with the JanusGraph Graph Data System</a></li>
|
||
<li class="toctree-l3"><a class="reference internal" href="../using-scylla/integrations/integration-datadog.html">Integrate ScyllaDB with DataDog</a></li>
|
||
<li class="toctree-l3"><a class="reference internal" href="../using-scylla/integrations/integration-kafka.html">Integrate ScyllaDB with Kafka</a></li>
|
||
<li class="toctree-l3"><a class="reference internal" href="../using-scylla/integrations/integration-iota.html">Integrate ScyllaDB with IOTA Chronicle</a></li>
|
||
<li class="toctree-l3"><a class="reference internal" href="../using-scylla/integrations/integration-spring.html">Integrate ScyllaDB with Spring</a></li>
|
||
<li class="toctree-l3"><a class="reference internal" href="../using-scylla/integrations/sink-kafka-connector.html">Shard-Aware Kafka Connector for ScyllaDB</a></li>
|
||
<li class="toctree-l3"><a class="reference internal" href="../using-scylla/integrations/integration-ansible.html">Install ScyllaDB with Ansible</a></li>
|
||
<li class="toctree-l3"><a class="reference internal" href="../using-scylla/integrations/integration-databricks.html">Integrate ScyllaDB with Databricks</a></li>
|
||
<li class="toctree-l3"><a class="reference internal" href="../using-scylla/integrations/integration-jaeger.html">Integrate ScyllaDB with Jaeger Server</a></li>
|
||
<li class="toctree-l3"><a class="reference internal" href="../using-scylla/integrations/integration-mindsdb.html">Integrate ScyllaDB with MindsDB</a></li>
|
||
</ul>
|
||
</li>
|
||
<li class="toctree-l2"><a class="reference internal" href="../getting-started/tutorials.html">Tutorials</a></li>
|
||
</ul>
|
||
</li>
|
||
<li class="toctree-l1 has-children"><a class="reference internal" href="../operating-scylla/index.html">ScyllaDB for Administrators</a><input class="toctree-checkbox" id="toctree-checkbox-6" name="toctree-checkbox-6" type="checkbox"/><label for="toctree-checkbox-6"><i class="icon-chevron-right"></i></label><div class="break"></div><ul>
|
||
<li class="toctree-l2"><a class="reference internal" href="../operating-scylla/admin.html">Administration Guide</a></li>
|
||
<li class="toctree-l2 has-children"><a class="reference internal" href="../operating-scylla/procedures/index.html">Procedures</a><input class="toctree-checkbox" id="toctree-checkbox-7" name="toctree-checkbox-7" type="checkbox"/><label for="toctree-checkbox-7"><i class="icon-chevron-right"></i></label><div class="break"></div><ul>
|
||
<li class="toctree-l3"><a class="reference internal" href="../operating-scylla/procedures/cluster-management/index.html">Cluster Management</a></li>
|
||
<li class="toctree-l3"><a class="reference internal" href="../operating-scylla/procedures/backup-restore/index.html">Backup & Restore</a></li>
|
||
<li class="toctree-l3"><a class="reference internal" href="../operating-scylla/procedures/config-change/index.html">Change Configuration</a></li>
|
||
<li class="toctree-l3"><a class="reference internal" href="../operating-scylla/procedures/maintenance/index.html">Maintenance</a></li>
|
||
<li class="toctree-l3"><a class="reference internal" href="../operating-scylla/procedures/tips/index.html">Best Practices</a></li>
|
||
<li class="toctree-l3"><a class="reference internal" href="../operating-scylla/benchmarking-scylla.html">Benchmarking ScyllaDB</a></li>
|
||
<li class="toctree-l3"><a class="reference internal" href="../operating-scylla/procedures/cassandra-to-scylla-migration-process.html">Migrate from Cassandra to ScyllaDB</a></li>
|
||
<li class="toctree-l3"><a class="reference internal" href="../getting-started/installation-common/disable-housekeeping.html">Disable Housekeeping</a></li>
|
||
</ul>
|
||
</li>
|
||
<li class="toctree-l2 has-children"><a class="reference internal" href="../operating-scylla/security/index.html">Security</a><input class="toctree-checkbox" id="toctree-checkbox-8" name="toctree-checkbox-8" type="checkbox"/><label for="toctree-checkbox-8"><i class="icon-chevron-right"></i></label><div class="break"></div><ul>
|
||
<li class="toctree-l3"><a class="reference internal" href="../operating-scylla/security/security-checklist.html">ScyllaDB Security Checklist</a></li>
|
||
<li class="toctree-l3"><a class="reference internal" href="../operating-scylla/security/authentication.html">Enable Authentication</a></li>
|
||
<li class="toctree-l3"><a class="reference internal" href="../operating-scylla/security/runtime-authentication.html">Enable and Disable Authentication Without Downtime</a></li>
|
||
<li class="toctree-l3"><a class="reference internal" href="../operating-scylla/security/create-superuser.html">Creating a Custom Superuser</a></li>
|
||
<li class="toctree-l3"><a class="reference internal" href="../operating-scylla/security/gen-cqlsh-file.html">Generate a cqlshrc File</a></li>
|
||
<li class="toctree-l3"><a class="reference internal" href="../troubleshooting/password-reset.html">Reset Authenticator Password</a></li>
|
||
<li class="toctree-l3"><a class="reference internal" href="../operating-scylla/security/enable-authorization.html">Enable Authorization</a></li>
|
||
<li class="toctree-l3"><a class="reference internal" href="../operating-scylla/security/authorization.html">Grant Authorization CQL Reference</a></li>
|
||
<li class="toctree-l3"><a class="reference internal" href="../operating-scylla/security/certificate-authentication.html">Certificate-based Authentication</a></li>
|
||
<li class="toctree-l3"><a class="reference internal" href="../operating-scylla/security/rbac-usecase.html">Role Based Access Control (RBAC)</a></li>
|
||
<li class="toctree-l3"><a class="reference internal" href="../operating-scylla/security/client-node-encryption.html">Encryption: Data in Transit Client to Node</a></li>
|
||
<li class="toctree-l3"><a class="reference internal" href="../operating-scylla/security/node-node-encryption.html">Encryption: Data in Transit Node to Node</a></li>
|
||
<li class="toctree-l3"><a class="reference internal" href="../operating-scylla/security/generate-certificate.html">Generating a self-signed Certificate Chain Using openssl</a></li>
|
||
<li class="toctree-l3"><a class="reference internal" href="../operating-scylla/security/saslauthd.html">Configure SaslauthdAuthenticator</a></li>
|
||
</ul>
|
||
</li>
|
||
<li class="toctree-l2 has-children"><a class="reference internal" href="../operating-scylla/admin-tools/index.html">Admin Tools</a><input class="toctree-checkbox" id="toctree-checkbox-9" name="toctree-checkbox-9" type="checkbox"/><label for="toctree-checkbox-9"><i class="icon-chevron-right"></i></label><div class="break"></div><ul>
|
||
<li class="toctree-l3"><a class="reference internal" href="../operating-scylla/nodetool.html">Nodetool Reference</a></li>
|
||
<li class="toctree-l3"><a class="reference internal" href="../cql/cqlsh.html">CQLSh</a></li>
|
||
<li class="toctree-l3"><a class="reference internal" href="../operating-scylla/rest.html">Admin REST API</a></li>
|
||
<li class="toctree-l3"><a class="reference internal" href="../using-scylla/tracing.html">Tracing</a></li>
|
||
<li class="toctree-l3"><a class="reference internal" href="../operating-scylla/admin-tools/scylla-sstable.html">ScyllaDB SStable</a></li>
|
||
<li class="toctree-l3"><a class="reference internal" href="../operating-scylla/admin-tools/scylla-types.html">ScyllaDB Types</a></li>
|
||
<li class="toctree-l3"><a class="reference internal" href="../operating-scylla/admin-tools/sstableloader.html">SSTableLoader</a></li>
|
||
<li class="toctree-l3"><a class="reference internal" href="../operating-scylla/admin-tools/cassandra-stress.html">cassandra-stress</a></li>
|
||
<li class="toctree-l3"><a class="reference internal" href="../operating-scylla/admin-tools/sstabledump.html">SSTabledump</a></li>
|
||
<li class="toctree-l3"><a class="reference internal" href="../operating-scylla/admin-tools/sstablemetadata.html">SSTableMetadata</a></li>
|
||
<li class="toctree-l3"><a class="reference internal" href="../getting-started/logging.html">ScyllaDB Logs</a></li>
|
||
<li class="toctree-l3"><a class="reference internal" href="../operating-scylla/admin-tools/perftune.html">Seastar Perftune</a></li>
|
||
<li class="toctree-l3"><a class="reference internal" href="../operating-scylla/admin-tools/virtual-tables.html">Virtual Tables</a></li>
|
||
<li class="toctree-l3"><a class="reference internal" href="../operating-scylla/admin-tools/select-from-mutation-fragments.html">Reading mutation fragments</a></li>
|
||
<li class="toctree-l3"><a class="reference internal" href="../operating-scylla/admin-tools/maintenance-socket.html">Maintenance socket</a></li>
|
||
<li class="toctree-l3"><a class="reference internal" href="../operating-scylla/admin-tools/maintenance-mode.html">Maintenance mode</a></li>
|
||
<li class="toctree-l3"><a class="reference internal" href="../operating-scylla/admin-tools/task-manager.html">Task manager</a></li>
|
||
</ul>
|
||
</li>
|
||
<li class="toctree-l2"><a class="reference external" href="https://monitoring.docs.scylladb.com/">ScyllaDB Monitoring Stack</a></li>
|
||
<li class="toctree-l2"><a class="reference external" href="https://operator.docs.scylladb.com/">ScyllaDB Operator</a></li>
|
||
<li class="toctree-l2"><a class="reference external" href="https://manager.docs.scylladb.com/">ScyllaDB Manager</a></li>
|
||
<li class="toctree-l2 has-children"><a class="reference internal" href="../upgrade/index.html">Upgrade Procedures</a><input class="toctree-checkbox" id="toctree-checkbox-10" name="toctree-checkbox-10" type="checkbox"/><label for="toctree-checkbox-10"><i class="icon-chevron-right"></i></label><div class="break"></div><ul>
|
||
<li class="toctree-l3"><a class="reference internal" href="../upgrade/scylladb-versioning.html">ScyllaDB Versioning</a></li>
|
||
<li class="toctree-l3"><a class="reference internal" href="../upgrade/upgrade-opensource/index.html">ScyllaDB Open Source Upgrade</a></li>
|
||
<li class="toctree-l3"><a class="reference internal" href="../upgrade/upgrade-to-enterprise/index.html">ScyllaDB Open Source to ScyllaDB Enterprise Upgrade</a></li>
|
||
<li class="toctree-l3"><a class="reference internal" href="../upgrade/ami-upgrade.html">ScyllaDB Image</a></li>
|
||
<li class="toctree-l3"><a class="reference external" href="https://enterprise.docs.scylladb.com/stable/upgrade/upgrade-enterprise/index.html">ScyllaDB Enterprise</a></li>
|
||
</ul>
|
||
</li>
|
||
<li class="toctree-l2 has-children"><a class="reference internal" href="../operating-scylla/system-configuration/index.html">System Configuration</a><input class="toctree-checkbox" id="toctree-checkbox-11" name="toctree-checkbox-11" type="checkbox"/><label for="toctree-checkbox-11"><i class="icon-chevron-right"></i></label><div class="break"></div><ul>
|
||
<li class="toctree-l3"><a class="reference internal" href="../getting-started/system-configuration.html">System Configuration Guide</a></li>
|
||
<li class="toctree-l3"><a class="reference internal" href="../operating-scylla/admin.html">scylla.yaml</a></li>
|
||
<li class="toctree-l3"><a class="reference internal" href="../operating-scylla/system-configuration/snitch.html">ScyllaDB Snitches</a></li>
|
||
</ul>
|
||
</li>
|
||
<li class="toctree-l2"><a class="reference internal" href="../operating-scylla/benchmarking-scylla.html">Benchmarking ScyllaDB</a></li>
|
||
<li class="toctree-l2"><a class="reference internal" href="../operating-scylla/diagnostics.html">ScyllaDB Diagnostic Tools</a></li>
|
||
</ul>
|
||
</li>
|
||
<li class="toctree-l1 has-children"><a class="reference internal" href="../using-scylla/index.html">ScyllaDB for Developers</a><input class="toctree-checkbox" id="toctree-checkbox-12" name="toctree-checkbox-12" type="checkbox"/><label for="toctree-checkbox-12"><i class="icon-chevron-right"></i></label><div class="break"></div><ul>
|
||
<li class="toctree-l2"><a class="reference external" href="https://docs.scylladb.com/stable/get-started/develop-with-scylladb/index.html">Develop with ScyllaDB</a></li>
|
||
<li class="toctree-l2"><a class="reference external" href="https://docs.scylladb.com/stable/get-started/develop-with-scylladb/tutorials-example-projects.html">Tutorials and Example Projects</a></li>
|
||
<li class="toctree-l2"><a class="reference external" href="https://docs.scylladb.com/stable/get-started/learn-resources/index.html">Learn to Use ScyllaDB</a></li>
|
||
<li class="toctree-l2"><a class="reference internal" href="../using-scylla/alternator/index.html">ScyllaDB Alternator</a></li>
|
||
<li class="toctree-l2 has-children"><a class="reference internal" href="../using-scylla/drivers/index.html">ScyllaDB Drivers</a><input class="toctree-checkbox" id="toctree-checkbox-13" name="toctree-checkbox-13" type="checkbox"/><label for="toctree-checkbox-13"><i class="icon-chevron-right"></i></label><div class="break"></div><ul>
|
||
<li class="toctree-l3"><a class="reference internal" href="../using-scylla/drivers/cql-drivers/index.html">ScyllaDB CQL Drivers</a></li>
|
||
<li class="toctree-l3"><a class="reference internal" href="../using-scylla/drivers/dynamo-drivers/index.html">ScyllaDB DynamoDB Drivers</a></li>
|
||
</ul>
|
||
</li>
|
||
</ul>
|
||
</li>
|
||
<li class="toctree-l1 has-children"><a class="reference internal" href="../cql/index.html">CQL Reference</a><input class="toctree-checkbox" id="toctree-checkbox-14" name="toctree-checkbox-14" type="checkbox"/><label for="toctree-checkbox-14"><i class="icon-chevron-right"></i></label><div class="break"></div><ul>
|
||
<li class="toctree-l2"><a class="reference internal" href="../cql/cqlsh.html">CQLSh: the CQL shell</a></li>
|
||
<li class="toctree-l2"><a class="reference internal" href="../cql/appendices.html">Appendices</a></li>
|
||
<li class="toctree-l2"><a class="reference internal" href="../cql/compaction.html">Compaction</a></li>
|
||
<li class="toctree-l2"><a class="reference internal" href="../cql/consistency.html">Consistency Levels</a></li>
|
||
<li class="toctree-l2"><a class="reference internal" href="../cql/consistency-calculator.html">Consistency Level Calculator</a></li>
|
||
<li class="toctree-l2"><a class="reference internal" href="../cql/ddl.html">Data Definition</a></li>
|
||
<li class="toctree-l2 has-children"><a class="reference internal" href="../cql/dml.html">Data Manipulation</a><input class="toctree-checkbox" id="toctree-checkbox-15" name="toctree-checkbox-15" type="checkbox"/><label for="toctree-checkbox-15"><i class="icon-chevron-right"></i></label><div class="break"></div><ul>
|
||
<li class="toctree-l3"><a class="reference internal" href="../cql/dml/select.html">SELECT</a></li>
|
||
<li class="toctree-l3"><a class="reference internal" href="../cql/dml/insert.html">INSERT</a></li>
|
||
<li class="toctree-l3"><a class="reference internal" href="../cql/dml/update.html">UPDATE</a></li>
|
||
<li class="toctree-l3"><a class="reference internal" href="../cql/dml/delete.html">DELETE</a></li>
|
||
<li class="toctree-l3"><a class="reference internal" href="../cql/dml/batch.html">BATCH</a></li>
|
||
</ul>
|
||
</li>
|
||
<li class="toctree-l2"><a class="reference internal" href="../cql/types.html">Data Types</a></li>
|
||
<li class="toctree-l2"><a class="reference internal" href="../cql/definitions.html">Definitions</a></li>
|
||
<li class="toctree-l2"><a class="reference internal" href="../cql/secondary-indexes.html">Global Secondary Indexes</a></li>
|
||
<li class="toctree-l2"><a class="reference internal" href="../cql/time-to-live.html">Expiring Data with Time to Live (TTL)</a></li>
|
||
<li class="toctree-l2"><a class="reference internal" href="../cql/functions.html">Functions</a></li>
|
||
<li class="toctree-l2"><a class="reference internal" href="../cql/wasm.html">Wasm support for user-defined functions</a></li>
|
||
<li class="toctree-l2"><a class="reference internal" href="../cql/json.html">JSON Support</a></li>
|
||
<li class="toctree-l2"><a class="reference internal" href="../cql/mv.html">Materialized Views</a></li>
|
||
<li class="toctree-l2"><a class="reference internal" href="../cql/non-reserved-keywords.html">Non-Reserved CQL Keywords</a></li>
|
||
<li class="toctree-l2"><a class="reference internal" href="../cql/reserved-keywords.html">Reserved CQL Keywords</a></li>
|
||
<li class="toctree-l2"><a class="reference internal" href="../cql/service-levels.html">Service Levels</a></li>
|
||
<li class="toctree-l2"><a class="reference internal" href="../cql/cql-extensions.html">ScyllaDB CQL Extensions</a></li>
|
||
</ul>
|
||
</li>
|
||
<li class="toctree-l1 has-children"><a class="reference internal" href="../alternator/alternator.html">Alternator: DynamoDB API in Scylla</a><input class="toctree-checkbox" id="toctree-checkbox-16" name="toctree-checkbox-16" type="checkbox"/><label for="toctree-checkbox-16"><i class="icon-chevron-right"></i></label><div class="break"></div><ul>
|
||
<li class="toctree-l2"><a class="reference internal" href="../alternator/getting-started.html">Getting Started With ScyllaDB Alternator</a></li>
|
||
<li class="toctree-l2"><a class="reference internal" href="../alternator/compatibility.html">ScyllaDB Alternator for DynamoDB users</a></li>
|
||
</ul>
|
||
</li>
|
||
<li class="toctree-l1 current has-children"><a class="reference internal" href="index.html">Features</a><input checked="" class="toctree-checkbox" id="toctree-checkbox-17" name="toctree-checkbox-17" type="checkbox"/><label for="toctree-checkbox-17"><i class="icon-chevron-right"></i></label><div class="break"></div><ul class="current">
|
||
<li class="toctree-l2 current current-page"><a class="current reference internal" href="#">Lightweight Transactions</a></li>
|
||
<li class="toctree-l2"><a class="reference internal" href="secondary-indexes.html">Global Secondary Indexes</a></li>
|
||
<li class="toctree-l2"><a class="reference internal" href="local-secondary-indexes.html">Local Secondary Indexes</a></li>
|
||
<li class="toctree-l2"><a class="reference internal" href="materialized-views.html">Materialized Views</a></li>
|
||
<li class="toctree-l2"><a class="reference internal" href="counters.html">Counters</a></li>
|
||
<li class="toctree-l2 has-children"><a class="reference internal" href="cdc/index.html">Change Data Capture</a><input class="toctree-checkbox" id="toctree-checkbox-18" name="toctree-checkbox-18" type="checkbox"/><label for="toctree-checkbox-18"><i class="icon-chevron-right"></i></label><div class="break"></div><ul>
|
||
<li class="toctree-l3"><a class="reference internal" href="cdc/cdc-intro.html">CDC Overview</a></li>
|
||
<li class="toctree-l3"><a class="reference internal" href="cdc/cdc-log-table.html">The CDC Log Table</a></li>
|
||
<li class="toctree-l3"><a class="reference internal" href="cdc/cdc-basic-operations.html">Basic operations in CDC</a></li>
|
||
<li class="toctree-l3"><a class="reference internal" href="cdc/cdc-streams.html">CDC Streams</a></li>
|
||
<li class="toctree-l3"><a class="reference internal" href="cdc/cdc-stream-generations.html">CDC Stream Generations</a></li>
|
||
<li class="toctree-l3"><a class="reference internal" href="cdc/cdc-querying-streams.html">Querying CDC Streams</a></li>
|
||
<li class="toctree-l3"><a class="reference internal" href="cdc/cdc-advanced-types.html">Advanced column types</a></li>
|
||
<li class="toctree-l3"><a class="reference internal" href="cdc/cdc-preimages.html">Preimages and postimages</a></li>
|
||
<li class="toctree-l3"><a class="reference internal" href="cdc/cdc-consistency.html">Data Consistency in CDC</a></li>
|
||
</ul>
|
||
</li>
|
||
<li class="toctree-l2"><a class="reference internal" href="workload-attributes.html">Workload Attributes</a></li>
|
||
</ul>
|
||
</li>
|
||
<li class="toctree-l1 has-children"><a class="reference internal" href="../architecture/index.html">ScyllaDB Architecture</a><input class="toctree-checkbox" id="toctree-checkbox-19" name="toctree-checkbox-19" type="checkbox"/><label for="toctree-checkbox-19"><i class="icon-chevron-right"></i></label><div class="break"></div><ul>
|
||
<li class="toctree-l2"><a class="reference internal" href="../architecture/tablets.html">Data Distribution with Tablets</a></li>
|
||
<li class="toctree-l2"><a class="reference internal" href="../architecture/ringarchitecture/index.html">ScyllaDB Ring Architecture</a></li>
|
||
<li class="toctree-l2"><a class="reference internal" href="../architecture/architecture-fault-tolerance.html">ScyllaDB Fault Tolerance</a></li>
|
||
<li class="toctree-l2"><a class="reference internal" href="../architecture/console-CL-full-demo.html">Consistency Level Console Demo</a></li>
|
||
<li class="toctree-l2 has-children"><a class="reference internal" href="../architecture/anti-entropy/index.html">ScyllaDB Anti-Entropy</a><input class="toctree-checkbox" id="toctree-checkbox-20" name="toctree-checkbox-20" type="checkbox"/><label for="toctree-checkbox-20"><i class="icon-chevron-right"></i></label><div class="break"></div><ul>
|
||
<li class="toctree-l3"><a class="reference internal" href="../architecture/anti-entropy/hinted-handoff.html">ScyllaDB Hinted Handoff</a></li>
|
||
<li class="toctree-l3"><a class="reference internal" href="../architecture/anti-entropy/read-repair.html">ScyllaDB Read Repair</a></li>
|
||
<li class="toctree-l3"><a class="reference internal" href="../operating-scylla/procedures/maintenance/repair.html">ScyllaDB Repair</a></li>
|
||
</ul>
|
||
</li>
|
||
<li class="toctree-l2 has-children"><a class="reference internal" href="../architecture/sstable/index.html">SSTable</a><input class="toctree-checkbox" id="toctree-checkbox-21" name="toctree-checkbox-21" type="checkbox"/><label for="toctree-checkbox-21"><i class="icon-chevron-right"></i></label><div class="break"></div><ul>
|
||
<li class="toctree-l3"><a class="reference internal" href="../architecture/sstable/sstable2/index.html">ScyllaDB SSTable - 2.x</a></li>
|
||
<li class="toctree-l3"><a class="reference internal" href="../architecture/sstable/sstable3/index.html">ScyllaDB SSTable - 3.x</a></li>
|
||
</ul>
|
||
</li>
|
||
<li class="toctree-l2"><a class="reference internal" href="../architecture/compaction/compaction-strategies.html">Compaction Strategies</a></li>
|
||
<li class="toctree-l2"><a class="reference internal" href="../architecture/raft.html">Raft Consensus Algorithm in ScyllaDB</a></li>
|
||
<li class="toctree-l2"><a class="reference internal" href="../architecture/zero-token-nodes.html">Zero-token Nodes</a></li>
|
||
</ul>
|
||
</li>
|
||
<li class="toctree-l1 has-children"><a class="reference internal" href="../troubleshooting/index.html">Troubleshooting ScyllaDB</a><input class="toctree-checkbox" id="toctree-checkbox-22" name="toctree-checkbox-22" type="checkbox"/><label for="toctree-checkbox-22"><i class="icon-chevron-right"></i></label><div class="break"></div><ul>
|
||
<li class="toctree-l2 has-children"><a class="reference internal" href="../troubleshooting/support/index.html">Errors and Support</a><input class="toctree-checkbox" id="toctree-checkbox-23" name="toctree-checkbox-23" type="checkbox"/><label for="toctree-checkbox-23"><i class="icon-chevron-right"></i></label><div class="break"></div><ul>
|
||
<li class="toctree-l3"><a class="reference internal" href="../troubleshooting/report-scylla-problem.html">Report a ScyllaDB problem</a></li>
|
||
<li class="toctree-l3"><a class="reference internal" href="../troubleshooting/error-messages/index.html">Error Messages</a></li>
|
||
<li class="toctree-l3"><a class="reference internal" href="../troubleshooting/log-level.html">Change Log Level</a></li>
|
||
</ul>
|
||
</li>
|
||
<li class="toctree-l2 has-children"><a class="reference internal" href="../troubleshooting/startup/index.html">ScyllaDB Startup</a><input class="toctree-checkbox" id="toctree-checkbox-24" name="toctree-checkbox-24" type="checkbox"/><label for="toctree-checkbox-24"><i class="icon-chevron-right"></i></label><div class="break"></div><ul>
|
||
<li class="toctree-l3"><a class="reference internal" href="../troubleshooting/change-ownership.html">Ownership Problems</a></li>
|
||
<li class="toctree-l3"><a class="reference internal" href="../troubleshooting/scylla-wont-start.html">ScyllaDB will not Start</a></li>
|
||
<li class="toctree-l3"><a class="reference internal" href="../troubleshooting/python-error-no-module-named-yaml.html">ScyllaDB Python Script broken</a></li>
|
||
</ul>
|
||
</li>
|
||
<li class="toctree-l2 has-children"><a class="reference internal" href="../troubleshooting/upgrade/index.html">Upgrade</a><input class="toctree-checkbox" id="toctree-checkbox-25" name="toctree-checkbox-25" type="checkbox"/><label for="toctree-checkbox-25"><i class="icon-chevron-right"></i></label><div class="break"></div><ul>
|
||
<li class="toctree-l3"><a class="reference internal" href="../troubleshooting/missing-dotmount-files.html">Inaccessible configuration files after ScyllaDB upgrade</a></li>
|
||
</ul>
|
||
</li>
|
||
<li class="toctree-l2 has-children"><a class="reference internal" href="../troubleshooting/cluster/index.html">Cluster and Node</a><input class="toctree-checkbox" id="toctree-checkbox-26" name="toctree-checkbox-26" type="checkbox"/><label for="toctree-checkbox-26"><i class="icon-chevron-right"></i></label><div class="break"></div><ul>
|
||
<li class="toctree-l3"><a class="reference internal" href="../troubleshooting/handling-node-failures.html">Handling Node Failures</a></li>
|
||
<li class="toctree-l3"><a class="reference internal" href="../troubleshooting/failed-add-remove-replace.html">Failure to Add, Remove, or Replace a Node</a></li>
|
||
<li class="toctree-l3"><a class="reference internal" href="../troubleshooting/failed-decommission.html">Failed Decommission Problem</a></li>
|
||
<li class="toctree-l3"><a class="reference internal" href="../troubleshooting/timeouts.html">Cluster Timeouts</a></li>
|
||
<li class="toctree-l3"><a class="reference internal" href="../troubleshooting/node-joined-without-any-data.html">Node Joined With No Data</a></li>
|
||
<li class="toctree-l3"><a class="reference internal" href="../troubleshooting/nodetool-nullpointerexception.html">NullPointerException</a></li>
|
||
<li class="toctree-l3"><a class="reference internal" href="../troubleshooting/failed-schema-sync.html">Failed Schema Sync</a></li>
|
||
</ul>
|
||
</li>
|
||
<li class="toctree-l2 has-children"><a class="reference internal" href="../troubleshooting/modeling/index.html">Data Modeling</a><input class="toctree-checkbox" id="toctree-checkbox-27" name="toctree-checkbox-27" type="checkbox"/><label for="toctree-checkbox-27"><i class="icon-chevron-right"></i></label><div class="break"></div><ul>
|
||
<li class="toctree-l3"><a class="reference internal" href="../troubleshooting/large-partition-table.html">ScyllaDB Large Partitions Table</a></li>
|
||
<li class="toctree-l3"><a class="reference internal" href="../troubleshooting/large-rows-large-cells-tables.html">ScyllaDB Large Rows and Cells Table</a></li>
|
||
<li class="toctree-l3"><a class="reference internal" href="../troubleshooting/debugging-large-partition.html">Large Partitions Hunting</a></li>
|
||
<li class="toctree-l3"><a class="reference internal" href="../troubleshooting/failed-update-schema.html">Failure to Update the Schema</a></li>
|
||
</ul>
|
||
</li>
|
||
<li class="toctree-l2 has-children"><a class="reference internal" href="../troubleshooting/storage/index.html">Data Storage and SSTables</a><input class="toctree-checkbox" id="toctree-checkbox-28" name="toctree-checkbox-28" type="checkbox"/><label for="toctree-checkbox-28"><i class="icon-chevron-right"></i></label><div class="break"></div><ul>
|
||
<li class="toctree-l3"><a class="reference internal" href="../troubleshooting/space-up.html">Space Utilization Increasing</a></li>
|
||
<li class="toctree-l3"><a class="reference internal" href="../troubleshooting/drop-table-space-up.html">Disk Space is not Reclaimed</a></li>
|
||
<li class="toctree-l3"><a class="reference internal" href="../troubleshooting/sstable-corruption.html">SSTable Corruption Problem</a></li>
|
||
<li class="toctree-l3"><a class="reference internal" href="../troubleshooting/pointless-compactions.html">Pointless Compactions</a></li>
|
||
<li class="toctree-l3"><a class="reference external" href="https://monitoring.docs.scylladb.com/stable/use-monitoring/advisor/heavyCompaction.html">Limiting Compaction</a></li>
|
||
</ul>
|
||
</li>
|
||
<li class="toctree-l2 has-children"><a class="reference internal" href="../troubleshooting/CQL/index.html">CQL</a><input class="toctree-checkbox" id="toctree-checkbox-29" name="toctree-checkbox-29" type="checkbox"/><label for="toctree-checkbox-29"><i class="icon-chevron-right"></i></label><div class="break"></div><ul>
|
||
<li class="toctree-l3"><a class="reference internal" href="../troubleshooting/time-zone.html">Time Range Query Fails</a></li>
|
||
<li class="toctree-l3"><a class="reference internal" href="../troubleshooting/copy-from-failed.html">COPY FROM Fails</a></li>
|
||
<li class="toctree-l3"><a class="reference internal" href="../troubleshooting/clients-table.html">CQL Connection Table</a></li>
|
||
</ul>
|
||
</li>
|
||
<li class="toctree-l2 has-children"><a class="reference internal" href="../troubleshooting/monitor/index.html">ScyllaDB Monitor and Manager</a><input class="toctree-checkbox" id="toctree-checkbox-30" name="toctree-checkbox-30" type="checkbox"/><label for="toctree-checkbox-30"><i class="icon-chevron-right"></i></label><div class="break"></div><ul>
|
||
<li class="toctree-l3"><a class="reference internal" href="../troubleshooting/manager-monitoring-integration.html">Manager and Monitoring integration</a></li>
|
||
<li class="toctree-l3"><a class="reference internal" href="../troubleshooting/reverse-dns-sshd.html">Manager lists healthy nodes as down</a></li>
|
||
</ul>
|
||
</li>
|
||
<li class="toctree-l2 has-children"><a class="reference internal" href="../troubleshooting/install-remove/index.html">Installation and Removal</a><input class="toctree-checkbox" id="toctree-checkbox-31" name="toctree-checkbox-31" type="checkbox"/><label for="toctree-checkbox-31"><i class="icon-chevron-right"></i></label><div class="break"></div><ul>
|
||
<li class="toctree-l3"><a class="reference internal" href="../troubleshooting/autoremove-ubuntu.html">Removing ScyllaDB on Ubuntu breaks system packages</a></li>
|
||
</ul>
|
||
</li>
|
||
</ul>
|
||
</li>
|
||
<li class="toctree-l1 has-children"><a class="reference internal" href="../kb/index.html">Knowledge Base</a><input class="toctree-checkbox" id="toctree-checkbox-32" name="toctree-checkbox-32" type="checkbox"/><label for="toctree-checkbox-32"><i class="icon-chevron-right"></i></label><div class="break"></div><ul>
|
||
<li class="toctree-l2"><a class="reference internal" href="../kb/cdc-experimental-upgrade.html">Upgrading from experimental CDC</a></li>
|
||
<li class="toctree-l2"><a class="reference internal" href="../kb/compaction.html">Compaction</a></li>
|
||
<li class="toctree-l2"><a class="reference internal" href="../kb/consistency.html">Consistency in ScyllaDB</a></li>
|
||
<li class="toctree-l2"><a class="reference internal" href="../kb/count-all-rows.html">Counting all rows in a table is slow</a></li>
|
||
<li class="toctree-l2"><a class="reference internal" href="../kb/cqlsh-more.html">CQL Query Does Not Display Entire Result Set</a></li>
|
||
<li class="toctree-l2"><a class="reference internal" href="../kb/cqlsh-results.html">When CQLSh query returns partial results with followed by “More”</a></li>
|
||
<li class="toctree-l2"><a class="reference internal" href="../kb/custom-user.html">Run ScyllaDB and supporting services as a custom user:group</a></li>
|
||
<li class="toctree-l2"><a class="reference internal" href="../kb/customizing-cpuset.html">Customizing CPUSET</a></li>
|
||
<li class="toctree-l2"><a class="reference internal" href="../kb/decode-stack-trace.html">Decoding Stack Traces</a></li>
|
||
<li class="toctree-l2"><a class="reference internal" href="../kb/disk-utilization.html">Snapshots and Disk Utilization</a></li>
|
||
<li class="toctree-l2"><a class="reference internal" href="../kb/dpdk-hardware.html">DPDK mode</a></li>
|
||
<li class="toctree-l2"><a class="reference internal" href="../kb/flamegraph.html">Debug your database with Flame Graphs</a></li>
|
||
<li class="toctree-l2"><a class="reference internal" href="../kb/gc-grace-seconds.html">How to Change gc_grace_seconds for a Table</a></li>
|
||
<li class="toctree-l2"><a class="reference internal" href="../kb/gossip.html">Gossip in ScyllaDB</a></li>
|
||
<li class="toctree-l2"><a class="reference internal" href="../kb/increase-permission-cache.html">Increase Permission Cache to Avoid Non-paged Queries</a></li>
|
||
<li class="toctree-l2"><a class="reference internal" href="../kb/lwt-differences.html">How does ScyllaDB LWT Differ from Apache Cassandra ?</a></li>
|
||
<li class="toctree-l2"><a class="reference internal" href="../kb/map-cpu.html">Map CPUs to ScyllaDB Shards</a></li>
|
||
<li class="toctree-l2"><a class="reference internal" href="../kb/memory-usage.html">ScyllaDB Memory Usage</a></li>
|
||
<li class="toctree-l2"><a class="reference internal" href="../kb/ntp.html">NTP Configuration for ScyllaDB</a></li>
|
||
<li class="toctree-l2"><a class="reference internal" href="../kb/perftune-modes-sync.html">Updating the Mode in perftune.yaml After a ScyllaDB Upgrade</a></li>
|
||
<li class="toctree-l2"><a class="reference internal" href="../kb/posix.html">POSIX networking for ScyllaDB</a></li>
|
||
<li class="toctree-l2"><a class="reference internal" href="../kb/quiz-administrators.html">ScyllaDB consistency quiz for administrators</a></li>
|
||
<li class="toctree-l2"><a class="reference internal" href="../kb/raid-device.html">Recreate RAID devices</a></li>
|
||
<li class="toctree-l2"><a class="reference internal" href="../kb/rf-increase.html">How to Safely Increase the Replication Factor</a></li>
|
||
<li class="toctree-l2"><a class="reference internal" href="../kb/scylla-and-spark-integration.html">ScyllaDB and Spark integration</a></li>
|
||
<li class="toctree-l2"><a class="reference internal" href="../kb/scylla-limits-systemd.html">Increase ScyllaDB resource limits over systemd</a></li>
|
||
<li class="toctree-l2"><a class="reference internal" href="../kb/seed-nodes.html">ScyllaDB Seed Nodes</a></li>
|
||
<li class="toctree-l2"><a class="reference internal" href="../kb/set-up-swap.html">How to Set up a Swap Space</a></li>
|
||
<li class="toctree-l2"><a class="reference internal" href="../kb/snapshots.html">ScyllaDB Snapshots</a></li>
|
||
<li class="toctree-l2"><a class="reference internal" href="../kb/static-columns.html">ScyllaDB payload sent duplicated static columns</a></li>
|
||
<li class="toctree-l2"><a class="reference internal" href="../kb/stop-local-repair.html">Stopping a local repair</a></li>
|
||
<li class="toctree-l2"><a class="reference internal" href="../kb/system-limits.html">System Limits</a></li>
|
||
<li class="toctree-l2"><a class="reference internal" href="../kb/tombstones-flush.html">How to flush old tombstones from a table</a></li>
|
||
<li class="toctree-l2"><a class="reference internal" href="../kb/ttl-facts.html">Time to Live (TTL) and Compaction</a></li>
|
||
<li class="toctree-l2"><a class="reference internal" href="../kb/unresponsive-nodes.html">ScyllaDB Nodes are Unresponsive</a></li>
|
||
<li class="toctree-l2"><a class="reference internal" href="../kb/update-pk.html">Update a Primary Key</a></li>
|
||
<li class="toctree-l2"><a class="reference internal" href="../kb/use-perf.html">Using the perf utility with ScyllaDB</a></li>
|
||
<li class="toctree-l2"><a class="reference internal" href="../kb/yaml-address.html">Configure ScyllaDB Networking with Multiple NIC/IP Combinations</a></li>
|
||
</ul>
|
||
</li>
|
||
<li class="toctree-l1 has-children"><a class="reference internal" href="../reference/index.html">Reference</a><input class="toctree-checkbox" id="toctree-checkbox-33" name="toctree-checkbox-33" type="checkbox"/><label for="toctree-checkbox-33"><i class="icon-chevron-right"></i></label><div class="break"></div><ul>
|
||
<li class="toctree-l2"><a class="reference internal" href="../reference/aws-images.html">AWS Images</a></li>
|
||
<li class="toctree-l2"><a class="reference internal" href="../reference/azure-images.html">Azure Images</a></li>
|
||
<li class="toctree-l2"><a class="reference internal" href="../reference/gcp-images.html">GCP Images</a></li>
|
||
<li class="toctree-l2"><a class="reference internal" href="../reference/configuration-parameters.html">Configuration Parameters</a></li>
|
||
<li class="toctree-l2"><a class="reference internal" href="../reference/glossary.html">Glossary</a></li>
|
||
<li class="toctree-l2"><a class="reference internal" href="../reference/limits.html">Limits</a></li>
|
||
<li class="toctree-l2"><a class="reference internal" href="../reference/api-reference.html">API Reference (BETA)</a></li>
|
||
<li class="toctree-l2"><a class="reference internal" href="../reference/metrics.html">Metrics (BETA)</a></li>
|
||
</ul>
|
||
</li>
|
||
<li class="toctree-l1"><a class="reference internal" href="../faq.html">ScyllaDB FAQ</a></li>
|
||
<li class="toctree-l1"><a class="reference internal" href="../contribute.html">Contribute to ScyllaDB</a></li>
|
||
</ul>
|
||
|
||
</div>
|
||
</div>
|
||
</div>
|
||
|
||
|
||
</div>
|
||
|
||
</section>
|
||
|
||
<footer class="footer">
|
||
<div class="footer-group">
|
||
<div class="footer-top">
|
||
<a class="footer-logo" href="https://www.scylladb.com"></a>
|
||
<div class="footer-links">
|
||
<a class="footer-links__link" href="https://docs.scylladb.com/" target="_blank">Docs</a>
|
||
<a class="footer-links__link" href="https://docs.scylladb.com/stable/get-started/develop-with-scylladb/tutorials-example-projects.html" target="_blank">Tutorials</a>
|
||
<a class="footer-links__link" href="https://university.scylladb.com/" target="_blank">University</a>
|
||
<a class="footer-links__link" href="https://www.scylladb.com/company/contact-us/"
|
||
target="_blank">Contact Us</a>
|
||
<a class="footer-links__link" href="https://www.scylladb.com/company/" target="_blank">About Us</a>
|
||
</div>
|
||
<div class="footer-actions">
|
||
<a class="footer-actions__link" href="http://slack.scylladb.com/" target="_blank">
|
||
<span data-tooltip tabindex="1" title="User Slack channel" data-position="bottom">
|
||
<i class="icon-slack"></i>
|
||
</span>
|
||
</a>
|
||
<a class="footer-actions__link" href="https://forum.scylladb.com/" target="_blank">
|
||
<span data-tooltip tabindex="1" title="Community forum" data-position="bottom">
|
||
<i class="icon-docs-community"></i>
|
||
</span>
|
||
</a>
|
||
</div>
|
||
</div>
|
||
|
||
|
||
<div class="footer-copyright">
|
||
|
||
|
||
© 2026, ScyllaDB. All rights reserved.
|
||
|
||
| <a class="footer-copyright__link" href="https://www.scylladb.com/tos/" target="_blank">Terms of Service</a>
|
||
| <a class="footer-copyright__link" href="https://www.scylladb.com/privacy/" target="_blank">Privacy Policy</a>
|
||
| ScyllaDB, and ScyllaDB Cloud, are registered trademarks of ScyllaDB, Inc.
|
||
|
||
</div>
|
||
|
||
|
||
|
||
<div class="footer-bottom">
|
||
|
||
<div class="footer-bottom__last-updated">
|
||
|
||
Last updated on 19 Apr 2026.
|
||
|
||
</div>
|
||
|
||
<div class="footer-bottom__version">
|
||
Powered by
|
||
<a class="footer-bottom__link" href="http://sphinx-doc.org/">Sphinx 9.1.0</a> &
|
||
<a class="footer-bottom__link" href="https://sphinx-theme.scylladb.com/">ScyllaDB Theme 1.9.2</a>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</footer>
|
||
|
||
<noscript>
|
||
<iframe src="https://www.googletagmanager.com/ns.html?id=GTM-T8P2JP" height="0" width="0"
|
||
style="display: none; visibility: hidden"></iframe>
|
||
</noscript>
|
||
</body>
|
||
|
||
</html> |