diff --git a/README.md b/README.md index 935c14f..d7738ba 100644 --- a/README.md +++ b/README.md @@ -30,6 +30,8 @@ If you find any typos please let me know via a GitHub issue! Thank you :) - [Jovyn Tan](https://github.com/jovyntls) - CS3223 - [Jotham Wong](https://github.com/jothamwong) +- CS4224 + - [Jotham Wong](https://github.com/jothamwong), [Wang Jiefan](https://github.com/Nafeij), [Arnav Aggarwal](https://github.com/arnav-ag) (It's 2 pages in overleaf, but overfilled in local dev) - CS3236 - [Jovyn Tan](https://github.com/jovyntls) - CS4231 diff --git a/cs4224/cs4224-cheatsheet.aux b/cs4224/cs4224-cheatsheet.aux new file mode 100644 index 0000000..11c2922 --- /dev/null +++ b/cs4224/cs4224-cheatsheet.aux @@ -0,0 +1,51 @@ +\relax +\providecommand\hyper@newdestlabel[2]{} +\providecommand\HyperFirstAtBeginDocument{\AtBeginDocument} +\HyperFirstAtBeginDocument{\ifx\hyper@anchor\@undefined +\global\let\oldcontentsline\contentsline +\gdef\contentsline#1#2#3#4{\oldcontentsline{#1}{#2}{#3}} +\global\let\oldnewlabel\newlabel +\gdef\newlabel#1#2{\newlabelxx{#1}#2} +\gdef\newlabelxx#1#2#3#4#5#6{\oldnewlabel{#1}{{#2}{#3}}} +\AtEndDocument{\ifx\hyper@anchor\@undefined +\let\contentsline\oldcontentsline +\let\newlabel\oldnewlabel +\fi} +\fi} +\global\let\hyper@last\relax +\gdef\HyperFirstAtBeginDocument#1{#1} +\providecommand\HyField@AuxAddToFields[1]{} +\providecommand\HyField@AuxAddToCoFields[2]{} +\@writefile{toc}{\contentsline {subsection}{2. Data Partitioning}{1}{section*.1}\protected@file@percent } +\@writefile{toc}{\contentsline {subsection}{3. Query Processing}{1}{section*.2}\protected@file@percent } +\@writefile{toc}{\contentsline {subsubsection}{Reduction Techniques}{1}{section*.3}\protected@file@percent } +\@writefile{toc}{\contentsline {subsubsection}{Join Strategies for $R \bowtie _{a} S$}{1}{section*.4}\protected@file@percent } +\@writefile{toc}{\contentsline {subsection}{4. Query Optimization}{1}{section*.5}\protected@file@percent } +\@writefile{toc}{\contentsline {subsubsection}{Selectivity Factor}{1}{section*.6}\protected@file@percent } +\@writefile{toc}{\contentsline {subsubsection}{Cost estimation}{1}{section*.7}\protected@file@percent } +\@writefile{toc}{\contentsline {subsubsection}{Optimization w/ Semi-Joins}{1}{section*.8}\protected@file@percent } +\@writefile{toc}{\contentsline {subsubsection}{Group-By Optimization}{1}{section*.9}\protected@file@percent } +\@writefile{toc}{\contentsline {subsection}{5. Storage}{1}{section*.10}\protected@file@percent } +\@writefile{toc}{\contentsline {subsubsection}{Log-Structured Merge Table}{1}{section*.11}\protected@file@percent } +\@writefile{toc}{\contentsline {subsubsection}{LSM Compaction}{1}{section*.12}\protected@file@percent } +\@writefile{toc}{\contentsline {subsubsection}{LSM Search Optimization}{1}{section*.13}\protected@file@percent } +\@writefile{toc}{\contentsline {subsubsection}{Indexing}{1}{section*.14}\protected@file@percent } +\@writefile{toc}{\contentsline {subsection}{6. Commit Protocols}{1}{section*.15}\protected@file@percent } +\@writefile{toc}{\contentsline {subsubsection}{2PC Protocol}{1}{section*.16}\protected@file@percent } +\@writefile{toc}{\contentsline {subsubsection}{3PC-1 Protocol}{1}{section*.17}\protected@file@percent } +\@writefile{toc}{\contentsline {subsubsection}{3PC-2 Protocol}{1}{section*.18}\protected@file@percent } +\@writefile{toc}{\contentsline {subsection}{7. Concurrency Control}{1}{section*.19}\protected@file@percent } +\@writefile{toc}{\contentsline {subsubsection}{Revision}{1}{section*.20}\protected@file@percent } +\@writefile{toc}{\contentsline {subsubsection}{Distributed CC}{2}{section*.21}\protected@file@percent } +\@writefile{toc}{\contentsline {subsection}{8. Replication}{2}{section*.22}\protected@file@percent } +\@writefile{toc}{\contentsline {subsubsection}{Handling Failures}{2}{section*.23}\protected@file@percent } +\@writefile{toc}{\contentsline {subsubsection}{Quorum Consensus Protocol}{2}{section*.24}\protected@file@percent } +\@writefile{toc}{\contentsline {subsection}{9. Consistency}{2}{section*.25}\protected@file@percent } +\@writefile{toc}{\contentsline {subsubsection}{Pileus}{2}{section*.26}\protected@file@percent } +\@writefile{toc}{\contentsline {subsection}{10. Raft Consensus}{2}{section*.27}\protected@file@percent } +\@writefile{toc}{\contentsline {subsubsection}{Server State}{2}{section*.28}\protected@file@percent } +\@writefile{toc}{\contentsline {subsubsection}{RPCs \& Timers}{2}{section*.29}\protected@file@percent } +\@writefile{toc}{\contentsline {subsubsection}{Leader Election}{2}{section*.30}\protected@file@percent } +\@writefile{toc}{\contentsline {subsubsection}{Log Replication}{2}{section*.31}\protected@file@percent } +\@writefile{toc}{\contentsline {subsubsection}{Example Scenario}{2}{section*.32}\protected@file@percent } +\gdef \@abspage@last{3} diff --git a/cs4224/cs4224-cheatsheet.log b/cs4224/cs4224-cheatsheet.log new file mode 100644 index 0000000..983fb4b --- /dev/null +++ b/cs4224/cs4224-cheatsheet.log @@ -0,0 +1,706 @@ +This is pdfTeX, Version 3.141592653-2.6-1.40.24 (TeX Live 2022) (preloaded format=pdflatex 2022.11.7) 2 DEC 2024 03:44 +entering extended mode + \write18 enabled. + file:line:error style messages enabled. + %&-line parsing enabled. +**/Users/jotham/School/nus-cheatsheets/cs4224/cs4224-cheatsheet +(/Users/jotham/School/nus-cheatsheets/cs4224/cs4224-cheatsheet.tex +LaTeX2e <2021-11-15> patch level 1 +L3 programming layer <2022-02-24> (/usr/local/texlive/2022/texmf-dist/tex/latex/extsizes/extarticle.cls +Document Class: extarticle 1996/10/08 v1.0 Non Standard LaTeX document class +(/usr/local/texlive/2022/texmf-dist/tex/latex/extsizes/size8.clo +File: size8.clo 1999/11/11 v1.4a NON-Standard LaTeX file (size option) +) (/usr/local/texlive/2022/texmf-dist/tex/latex/base/exscale.sty +Package: exscale 2018/09/24 v2.1i Standard LaTeX package exscale +LaTeX Font Info: Redeclaring symbol font `largesymbols' on input line 57. +LaTeX Font Info: Overwriting symbol font `largesymbols' in version `normal' +(Font) OMX/cmex/m/n --> OMX/cmex/m/n on input line 57. +LaTeX Font Info: Overwriting symbol font `largesymbols' in version `bold' +(Font) OMX/cmex/m/n --> OMX/cmex/m/n on input line 57. +\big@size=\dimen138 +) +\c@part=\count185 +\c@section=\count186 +\c@subsection=\count187 +\c@subsubsection=\count188 +\c@paragraph=\count189 +\c@subparagraph=\count190 +\c@figure=\count191 +\c@table=\count192 +\abovecaptionskip=\skip47 +\belowcaptionskip=\skip48 +\bibindent=\dimen139 +) (/usr/local/texlive/2022/texmf-dist/tex/latex/psnfss/helvet.sty +Package: helvet 2020/03/25 PSNFSS-v9.3 (WaS) + (/usr/local/texlive/2022/texmf-dist/tex/latex/graphics/keyval.sty +Package: keyval 2014/10/28 v1.15 key=value parser (DPC) +\KV@toks@=\toks16 +)) (/usr/local/texlive/2022/texmf-dist/tex/latex/tools/calc.sty +Package: calc 2017/05/25 v4.3 Infix arithmetic (KKT,FJ) +\calc@Acount=\count193 +\calc@Bcount=\count194 +\calc@Adimen=\dimen140 +\calc@Bdimen=\dimen141 +\calc@Askip=\skip49 +\calc@Bskip=\skip50 +LaTeX Info: Redefining \setlength on input line 80. +LaTeX Info: Redefining \addtolength on input line 81. +\calc@Ccount=\count195 +\calc@Cskip=\skip51 +) (/usr/local/texlive/2022/texmf-dist/tex/latex/tools/multicol.sty +Package: multicol 2021/10/28 v1.9b multicolumn formatting (FMi) +\c@tracingmulticols=\count196 +\mult@box=\box50 +\multicol@leftmargin=\dimen142 +\c@unbalance=\count197 +\c@collectmore=\count198 +\doublecol@number=\count199 +\multicoltolerance=\count266 +\multicolpretolerance=\count267 +\full@width=\dimen143 +\page@free=\dimen144 +\premulticols=\dimen145 +\postmulticols=\dimen146 +\multicolsep=\skip52 +\multicolbaselineskip=\skip53 +\partial@page=\box51 +\last@line=\box52 +\maxbalancingoverflow=\dimen147 +\mult@rightbox=\box53 +\mult@grightbox=\box54 +\mult@firstbox=\box55 +\mult@gfirstbox=\box56 +\@tempa=\box57 +\@tempa=\box58 +\@tempa=\box59 +\@tempa=\box60 +\@tempa=\box61 +\@tempa=\box62 +\@tempa=\box63 +\@tempa=\box64 +\@tempa=\box65 +\@tempa=\box66 +\@tempa=\box67 +\@tempa=\box68 +\@tempa=\box69 +\@tempa=\box70 +\@tempa=\box71 +\@tempa=\box72 +\@tempa=\box73 +\@tempa=\box74 +\@tempa=\box75 +\@tempa=\box76 +\@tempa=\box77 +\@tempa=\box78 +\@tempa=\box79 +\@tempa=\box80 +\@tempa=\box81 +\@tempa=\box82 +\@tempa=\box83 +\@tempa=\box84 +\@tempa=\box85 +\@tempa=\box86 +\@tempa=\box87 +\@tempa=\box88 +\@tempa=\box89 +\@tempa=\box90 +\@tempa=\box91 +\@tempa=\box92 +\c@minrows=\count268 +\c@columnbadness=\count269 +\c@finalcolumnbadness=\count270 +\last@try=\dimen148 +\multicolovershoot=\dimen149 +\multicolundershoot=\dimen150 +\mult@nat@firstbox=\box93 +\colbreak@box=\box94 +\mc@col@check@num=\count271 +) (/usr/local/texlive/2022/texmf-dist/tex/latex/geometry/geometry.sty +Package: geometry 2020/01/02 v5.9 Page Geometry + (/usr/local/texlive/2022/texmf-dist/tex/generic/iftex/ifvtex.sty +Package: ifvtex 2019/10/25 v1.7 ifvtex legacy package. Use iftex instead. + (/usr/local/texlive/2022/texmf-dist/tex/generic/iftex/iftex.sty +Package: iftex 2022/02/03 v1.0f TeX engine tests +)) +\Gm@cnth=\count272 +\Gm@cntv=\count273 +\c@Gm@tempcnt=\count274 +\Gm@bindingoffset=\dimen151 +\Gm@wd@mp=\dimen152 +\Gm@odd@mp=\dimen153 +\Gm@even@mp=\dimen154 +\Gm@layoutwidth=\dimen155 +\Gm@layoutheight=\dimen156 +\Gm@layouthoffset=\dimen157 +\Gm@layoutvoffset=\dimen158 +\Gm@dimlist=\toks17 +) (/usr/local/texlive/2022/texmf-dist/tex/latex/amsmath/amsmath.sty +Package: amsmath 2021/10/15 v2.17l AMS math features +\@mathmargin=\skip54 + +For additional information on amsmath, use the `?' option. +(/usr/local/texlive/2022/texmf-dist/tex/latex/amsmath/amstext.sty +Package: amstext 2021/08/26 v2.01 AMS text + (/usr/local/texlive/2022/texmf-dist/tex/latex/amsmath/amsgen.sty +File: amsgen.sty 1999/11/30 v2.0 generic functions +\@emptytoks=\toks18 +\ex@=\dimen159 +)) (/usr/local/texlive/2022/texmf-dist/tex/latex/amsmath/amsbsy.sty +Package: amsbsy 1999/11/29 v1.2d Bold Symbols +\pmbraise@=\dimen160 +) (/usr/local/texlive/2022/texmf-dist/tex/latex/amsmath/amsopn.sty +Package: amsopn 2021/08/26 v2.02 operator names +) +\inf@bad=\count275 +LaTeX Info: Redefining \frac on input line 234. +\uproot@=\count276 +\leftroot@=\count277 +LaTeX Info: Redefining \overline on input line 399. +\classnum@=\count278 +\DOTSCASE@=\count279 +LaTeX Info: Redefining \ldots on input line 496. +LaTeX Info: Redefining \dots on input line 499. +LaTeX Info: Redefining \cdots on input line 620. +\Mathstrutbox@=\box95 +\strutbox@=\box96 +\big@size=\dimen161 +LaTeX Font Info: Redeclaring font encoding OML on input line 743. +LaTeX Font Info: Redeclaring font encoding OMS on input line 744. +\macc@depth=\count280 +\c@MaxMatrixCols=\count281 +\dotsspace@=\muskip16 +\c@parentequation=\count282 +\dspbrk@lvl=\count283 +\tag@help=\toks19 +\row@=\count284 +\column@=\count285 +\maxfields@=\count286 +\andhelp@=\toks20 +\eqnshift@=\dimen162 +\alignsep@=\dimen163 +\tagshift@=\dimen164 +\tagwidth@=\dimen165 +\totwidth@=\dimen166 +\lineht@=\dimen167 +\@envbody=\toks21 +\multlinegap=\skip55 +\multlinetaggap=\skip56 +\mathdisplay@stack=\toks22 +LaTeX Info: Redefining \[ on input line 2938. +LaTeX Info: Redefining \] on input line 2939. +) (/usr/local/texlive/2022/texmf-dist/tex/latex/amscls/amsthm.sty +Package: amsthm 2020/05/29 v2.20.6 +\thm@style=\toks23 +\thm@bodyfont=\toks24 +\thm@headfont=\toks25 +\thm@notefont=\toks26 +\thm@headpunct=\toks27 +\thm@preskip=\skip57 +\thm@postskip=\skip58 +\thm@headsep=\skip59 +\dth@everypar=\toks28 +) (/usr/local/texlive/2022/texmf-dist/tex/latex/amsfonts/amsfonts.sty +Package: amsfonts 2013/01/14 v3.01 Basic AMSFonts support +\symAMSa=\mathgroup4 +\symAMSb=\mathgroup5 +LaTeX Font Info: Redeclaring math symbol \hbar on input line 98. +LaTeX Font Info: Overwriting math alphabet `\mathfrak' in version `bold' +(Font) U/euf/m/n --> U/euf/b/n on input line 106. +) (/usr/local/texlive/2022/texmf-dist/tex/latex/amsfonts/amssymb.sty +Package: amssymb 2013/01/14 v3.01 AMS font symbols +) (/usr/local/texlive/2022/texmf-dist/tex/latex/graphics/color.sty +Package: color 2021/12/07 v1.3c Standard LaTeX Color (DPC) + (/usr/local/texlive/2022/texmf-dist/tex/latex/graphics-cfg/color.cfg +File: color.cfg 2016/01/02 v1.6 sample color configuration +) +Package color Info: Driver file: pdftex.def on input line 149. + (/usr/local/texlive/2022/texmf-dist/tex/latex/graphics-def/pdftex.def +File: pdftex.def 2020/10/05 v1.2a Graphics/color driver for pdftex +)) (/usr/local/texlive/2022/texmf-dist/tex/latex/graphics/graphicx.sty +Package: graphicx 2021/09/16 v1.2d Enhanced LaTeX Graphics (DPC,SPQR) + (/usr/local/texlive/2022/texmf-dist/tex/latex/graphics/graphics.sty +Package: graphics 2021/03/04 v1.4d Standard LaTeX Graphics (DPC,SPQR) + (/usr/local/texlive/2022/texmf-dist/tex/latex/graphics/trig.sty +Package: trig 2021/08/11 v1.11 sin cos tan (DPC) +) (/usr/local/texlive/2022/texmf-dist/tex/latex/graphics-cfg/graphics.cfg +File: graphics.cfg 2016/06/04 v1.11 sample graphics configuration +) +Package graphics Info: Driver file: pdftex.def on input line 107. +) +\Gin@req@height=\dimen168 +\Gin@req@width=\dimen169 +) (/usr/local/texlive/2022/texmf-dist/tex/latex/overpic/overpic.sty +Package: overpic 2020/02/22 1.3 picture overlays (RN) + (/usr/local/texlive/2022/texmf-dist/tex/latex/eepic/epic.sty +Enhancements to Picture Environment. Version 1.2 - Released June 1, 1986 +\@@multicnt=\count287 +\d@lta=\count288 +\@delta=\dimen170 +\@@delta=\dimen171 +\@gridcnt=\count289 +\@joinkind=\count290 +\@dotgap=\dimen172 +\@ddotgap=\dimen173 +\@x@diff=\count291 +\@y@diff=\count292 +\x@diff=\dimen174 +\y@diff=\dimen175 +\@dotbox=\box97 +\num@segments=\count293 +\num@segmentsi=\count294 +\@datafile=\read2 +) +\OVP@box=\box98 +) (/usr/local/texlive/2022/texmf-dist/tex/latex/hyperref/hyperref.sty +Package: hyperref 2022-02-21 v7.00n Hypertext links for LaTeX + (/usr/local/texlive/2022/texmf-dist/tex/generic/ltxcmds/ltxcmds.sty +Package: ltxcmds 2020-05-10 v1.25 LaTeX kernel commands for general use (HO) +) (/usr/local/texlive/2022/texmf-dist/tex/generic/pdftexcmds/pdftexcmds.sty +Package: pdftexcmds 2020-06-27 v0.33 Utility functions of pdfTeX for LuaTeX (HO) + (/usr/local/texlive/2022/texmf-dist/tex/generic/infwarerr/infwarerr.sty +Package: infwarerr 2019/12/03 v1.5 Providing info/warning/error messages (HO) +) +Package pdftexcmds Info: \pdf@primitive is available. +Package pdftexcmds Info: \pdf@ifprimitive is available. +Package pdftexcmds Info: \pdfdraftmode found. +) (/usr/local/texlive/2022/texmf-dist/tex/generic/kvsetkeys/kvsetkeys.sty +Package: kvsetkeys 2019/12/15 v1.18 Key value parser (HO) +) (/usr/local/texlive/2022/texmf-dist/tex/generic/kvdefinekeys/kvdefinekeys.sty +Package: kvdefinekeys 2019-12-19 v1.6 Define keys (HO) +) (/usr/local/texlive/2022/texmf-dist/tex/generic/pdfescape/pdfescape.sty +Package: pdfescape 2019/12/09 v1.15 Implements pdfTeX's escape features (HO) +) (/usr/local/texlive/2022/texmf-dist/tex/latex/hycolor/hycolor.sty +Package: hycolor 2020-01-27 v1.10 Color options for hyperref/bookmark (HO) +) (/usr/local/texlive/2022/texmf-dist/tex/latex/letltxmacro/letltxmacro.sty +Package: letltxmacro 2019/12/03 v1.6 Let assignment for LaTeX macros (HO) +) (/usr/local/texlive/2022/texmf-dist/tex/latex/auxhook/auxhook.sty +Package: auxhook 2019-12-17 v1.6 Hooks for auxiliary files (HO) +) (/usr/local/texlive/2022/texmf-dist/tex/latex/kvoptions/kvoptions.sty +Package: kvoptions 2020-10-07 v3.14 Key value format for package options (HO) +) +\@linkdim=\dimen176 +\Hy@linkcounter=\count295 +\Hy@pagecounter=\count296 + (/usr/local/texlive/2022/texmf-dist/tex/latex/hyperref/pd1enc.def +File: pd1enc.def 2022-02-21 v7.00n Hyperref: PDFDocEncoding definition (HO) +Now handling font encoding PD1 ... +... no UTF-8 mapping file for font encoding PD1 +) (/usr/local/texlive/2022/texmf-dist/tex/generic/intcalc/intcalc.sty +Package: intcalc 2019/12/15 v1.3 Expandable calculations with integers (HO) +) (/usr/local/texlive/2022/texmf-dist/tex/generic/etexcmds/etexcmds.sty +Package: etexcmds 2019/12/15 v1.7 Avoid name clashes with e-TeX commands (HO) +) +\Hy@SavedSpaceFactor=\count297 + (/usr/local/texlive/2022/texmf-dist/tex/latex/hyperref/puenc.def +File: puenc.def 2022-02-21 v7.00n Hyperref: PDF Unicode definition (HO) +Now handling font encoding PU ... +... no UTF-8 mapping file for font encoding PU +) +Package hyperref Info: Hyper figures OFF on input line 4137. +Package hyperref Info: Link nesting OFF on input line 4142. +Package hyperref Info: Hyper index ON on input line 4145. +Package hyperref Info: Plain pages OFF on input line 4152. +Package hyperref Info: Backreferencing OFF on input line 4157. +Package hyperref Info: Implicit mode ON; LaTeX internals redefined. +Package hyperref Info: Bookmarks ON on input line 4390. +\c@Hy@tempcnt=\count298 + (/usr/local/texlive/2022/texmf-dist/tex/latex/url/url.sty +\Urlmuskip=\muskip17 +Package: url 2013/09/16 ver 3.4 Verb mode for urls, etc. +) +LaTeX Info: Redefining \url on input line 4749. +\XeTeXLinkMargin=\dimen177 + (/usr/local/texlive/2022/texmf-dist/tex/generic/bitset/bitset.sty +Package: bitset 2019/12/09 v1.3 Handle bit-vector datatype (HO) + (/usr/local/texlive/2022/texmf-dist/tex/generic/bigintcalc/bigintcalc.sty +Package: bigintcalc 2019/12/15 v1.5 Expandable calculations on big integers (HO) +)) +\Fld@menulength=\count299 +\Field@Width=\dimen178 +\Fld@charsize=\dimen179 +Package hyperref Info: Hyper figures OFF on input line 6027. +Package hyperref Info: Link nesting OFF on input line 6032. +Package hyperref Info: Hyper index ON on input line 6035. +Package hyperref Info: backreferencing OFF on input line 6042. +Package hyperref Info: Link coloring OFF on input line 6047. +Package hyperref Info: Link coloring with OCG OFF on input line 6052. +Package hyperref Info: PDF/A mode OFF on input line 6057. +LaTeX Info: Redefining \ref on input line 6097. +LaTeX Info: Redefining \pageref on input line 6101. + (/usr/local/texlive/2022/texmf-dist/tex/latex/base/atbegshi-ltx.sty +Package: atbegshi-ltx 2021/01/10 v1.0c Emulation of the original atbegshi +package with kernel methods +) +\Hy@abspage=\count300 +\c@Item=\count301 +\c@Hfootnote=\count302 +) +Package hyperref Info: Driver (autodetected): hpdftex. + (/usr/local/texlive/2022/texmf-dist/tex/latex/hyperref/hpdftex.def +File: hpdftex.def 2022-02-21 v7.00n Hyperref driver for pdfTeX + (/usr/local/texlive/2022/texmf-dist/tex/latex/base/atveryend-ltx.sty +Package: atveryend-ltx 2020/08/19 v1.0a Emulation of the original atveryend package +with kernel methods +) +\Fld@listcount=\count303 +\c@bookmark@seq@number=\count304 + (/usr/local/texlive/2022/texmf-dist/tex/latex/rerunfilecheck/rerunfilecheck.sty +Package: rerunfilecheck 2019/12/05 v1.9 Rerun checks for auxiliary files (HO) + (/usr/local/texlive/2022/texmf-dist/tex/generic/uniquecounter/uniquecounter.sty +Package: uniquecounter 2019/12/15 v1.4 Provide unlimited unique counter (HO) +) +Package uniquecounter Info: New unique counter `rerunfilecheck' on input line 286. +) +\Hy@SectionHShift=\skip60 +) (/usr/local/texlive/2022/texmf-dist/tex/latex/newtx/newtxtext.sty +Package: newtxtext 2022/02/28 v1.71(Michael Sharpe) latex and unicode latex support for TeXGyreTermesX + `newtxtext' v1.71, 2022/02/28 Text macros taking advantage of TeXGyre Termes and its extensions (msharpe) (/usr/local/texlive/2022/texmf-dist/tex/latex/xkeyval/xkeyval.sty +Package: xkeyval 2020/11/20 v2.8 package option processing (HA) + (/usr/local/texlive/2022/texmf-dist/tex/generic/xkeyval/xkeyval.tex (/usr/local/texlive/2022/texmf-dist/tex/generic/xkeyval/xkvutils.tex +\XKV@toks=\toks29 +\XKV@tempa@toks=\toks30 +) +\XKV@depth=\count305 +File: xkeyval.tex 2014/12/03 v2.7a key=value parser (HA) +)) (/usr/local/texlive/2022/texmf-dist/tex/latex/etoolbox/etoolbox.sty +Package: etoolbox 2020/10/05 v2.5k e-TeX tools for LaTeX (JAW) +\etb@tempcnta=\count306 +) (/usr/local/texlive/2022/texmf-dist/tex/latex/base/textcomp.sty +Package: textcomp 2020/02/02 v2.0n Standard LaTeX package +) (/usr/local/texlive/2022/texmf-dist/tex/generic/xstring/xstring.sty (/usr/local/texlive/2022/texmf-dist/tex/generic/xstring/xstring.tex +\integerpart=\count307 +\decimalpart=\count308 +) +Package: xstring 2021/07/21 v1.84 String manipulations (CT) +) (/usr/local/texlive/2022/texmf-dist/tex/latex/base/ifthen.sty +Package: ifthen 2020/11/24 v1.1c Standard LaTeX ifthen package (DPC) +) (/usr/local/texlive/2022/texmf-dist/tex/latex/carlisle/scalefnt.sty) +LaTeX Font Info: Setting ntxLF sub-encoding to TS1/0 on input line 21. +LaTeX Font Info: Setting ntxTLF sub-encoding to TS1/0 on input line 21. +LaTeX Font Info: Setting ntxOsF sub-encoding to TS1/0 on input line 21. +LaTeX Font Info: Setting ntxTOsF sub-encoding to TS1/0 on input line 21. + (/usr/local/texlive/2022/texmf-dist/tex/generic/kastrup/binhex.tex) +\ntx@tmpcnta=\count309 +\ntx@cnt=\count310 + +ntx@otftextfalse +(/usr/local/texlive/2022/texmf-dist/tex/latex/fontaxes/fontaxes.sty +Package: fontaxes 2020/07/21 v1.0e Font selection axes +LaTeX Info: Redefining \upshape on input line 29. +LaTeX Info: Redefining \itshape on input line 31. +LaTeX Info: Redefining \slshape on input line 33. +LaTeX Info: Redefining \swshape on input line 35. +LaTeX Info: Redefining \scshape on input line 37. +LaTeX Info: Redefining \sscshape on input line 39. +LaTeX Info: Redefining \ulcshape on input line 41. +LaTeX Info: Redefining \textsw on input line 47. +LaTeX Info: Redefining \textssc on input line 48. +LaTeX Info: Redefining \textulc on input line 49. +) +LaTeX Info: Redefining \oldstylenums on input line 657. +) (/usr/local/texlive/2022/texmf-dist/tex/latex/enumitem/enumitem.sty +Package: enumitem 2019/06/20 v3.9 Customized lists +\labelindent=\skip61 +\enit@outerparindent=\dimen180 +\enit@toks=\toks31 +\enit@inbox=\box99 +\enit@count@id=\count311 +\enitdp@description=\count312 +) (/usr/local/texlive/2022/texmf-dist/tex/latex/xcolor/xcolor.sty +Package: xcolor 2021/10/31 v2.13 LaTeX color extensions (UK) + (/usr/local/texlive/2022/texmf-dist/tex/latex/graphics-cfg/color.cfg +File: color.cfg 2016/01/02 v1.6 sample color configuration +) +Package xcolor Info: Driver file: pdftex.def on input line 227. + (/usr/local/texlive/2022/texmf-dist/tex/latex/colortbl/colortbl.sty +Package: colortbl 2020/01/04 v1.0e Color table columns (DPC) + (/usr/local/texlive/2022/texmf-dist/tex/latex/tools/array.sty +Package: array 2021/10/04 v2.5f Tabular extension package (FMi) +\col@sep=\dimen181 +\ar@mcellbox=\box100 +\extrarowheight=\dimen182 +\NC@list=\toks32 +\extratabsurround=\skip62 +\backup@length=\skip63 +\ar@cellbox=\box101 +) +\everycr=\toks33 +\minrowclearance=\skip64 +) +LaTeX Info: Redefining \color on input line 711. +\rownum=\count313 +Package xcolor Info: Model `cmy' substituted by `cmy0' on input line 1352. +Package xcolor Info: Model `hsb' substituted by `rgb' on input line 1356. +Package xcolor Info: Model `RGB' extended on input line 1368. +Package xcolor Info: Model `HTML' substituted by `rgb' on input line 1370. +Package xcolor Info: Model `Hsb' substituted by `hsb' on input line 1371. +Package xcolor Info: Model `tHsb' substituted by `hsb' on input line 1372. +Package xcolor Info: Model `HSB' substituted by `hsb' on input line 1373. +Package xcolor Info: Model `Gray' substituted by `gray' on input line 1374. +Package xcolor Info: Model `wave' substituted by `hsb' on input line 1375. +) (/usr/local/texlive/2022/texmf-dist/tex/latex/mathtools/mathtools.sty +Package: mathtools 2022/02/07 v1.28a mathematical typesetting tools + (/usr/local/texlive/2022/texmf-dist/tex/latex/mathtools/mhsetup.sty +Package: mhsetup 2021/03/18 v1.4 programming setup (MH) +) +\g_MT_multlinerow_int=\count314 +\l_MT_multwidth_dim=\dimen183 +\origjot=\skip65 +\l_MT_shortvdotswithinadjustabove_dim=\dimen184 +\l_MT_shortvdotswithinadjustbelow_dim=\dimen185 +\l_MT_above_intertext_sep=\dimen186 +\l_MT_below_intertext_sep=\dimen187 +\l_MT_above_shortintertext_sep=\dimen188 +\l_MT_below_shortintertext_sep=\dimen189 +\xmathstrut@box=\box102 +\xmathstrut@dim=\dimen190 +) (/usr/local/texlive/2022/texmf-dist/tex/latex/caption/caption.sty +Package: caption 2022/03/01 v3.6b Customizing captions (AR) + (/usr/local/texlive/2022/texmf-dist/tex/latex/caption/caption3.sty +Package: caption3 2022/03/17 v2.3b caption3 kernel (AR) +\caption@tempdima=\dimen191 +\captionmargin=\dimen192 +\caption@leftmargin=\dimen193 +\caption@rightmargin=\dimen194 +\caption@width=\dimen195 +\caption@indent=\dimen196 +\caption@parindent=\dimen197 +\caption@hangindent=\dimen198 +Package caption Info: Standard document class detected. +) +\c@caption@flags=\count315 +\c@continuedfloat=\count316 +Package caption Info: hyperref package is loaded. +) (/usr/local/texlive/2022/texmf-dist/tex/latex/subfig/subfig.sty +Package: subfig 2005/06/28 ver: 1.3 subfig package +\c@KVtest=\count317 +\sf@farskip=\skip66 +\sf@captopadj=\dimen199 +\sf@capskip=\skip67 +\sf@nearskip=\skip68 +\c@subfigure=\count318 +\c@subfigure@save=\count319 +\c@lofdepth=\count320 +\c@subtable=\count321 +\c@subtable@save=\count322 +\c@lotdepth=\count323 +\sf@top=\skip69 +\sf@bottom=\skip70 +) (../commands/style-helpers.tex (/usr/local/texlive/2022/texmf-dist/tex/generic/soul/soul.sty +Package: soul 2003/11/17 v2.4 letterspacing/underlining (mf) +\SOUL@word=\toks34 +\SOUL@lasttoken=\toks35 +\SOUL@cmds=\toks36 +\SOUL@buffer=\toks37 +\SOUL@token=\toks38 +\SOUL@spaceskip=\skip71 +\SOUL@ttwidth=\dimen256 +\SOUL@uldp=\dimen257 +\SOUL@ulht=\dimen258 +)) +LaTeX Font Info: Trying to load font information for OT1+qhv on input line 76. + (/usr/local/texlive/2022/texmf-dist/tex/latex/tex-gyre/ot1qhv.fd +File: ot1qhv.fd 2009/09/25 v1.2 font definition file for OT1/qhv +) +LaTeX Font Info: Font shape `OT1/qhv/m/n' will be +(Font) scaled to size 7.52002pt on input line 76. + (/usr/local/texlive/2022/texmf-dist/tex/latex/l3backend/l3backend-pdftex.def +File: l3backend-pdftex.def 2022-02-07 L3 backend support: PDF output (pdfTeX) +\l__color_backend_stack_int=\count324 +\l__pdf_internal_box=\box103 +) +No file cs4224-cheatsheet.aux. +\openout1 = `cs4224-cheatsheet.aux'. + +LaTeX Font Info: Checking defaults for OML/cmm/m/it on input line 76. +LaTeX Font Info: ... okay on input line 76. +LaTeX Font Info: Checking defaults for OMS/cmsy/m/n on input line 76. +LaTeX Font Info: ... okay on input line 76. +LaTeX Font Info: Checking defaults for OT1/cmr/m/n on input line 76. +LaTeX Font Info: ... okay on input line 76. +LaTeX Font Info: Checking defaults for T1/cmr/m/n on input line 76. +LaTeX Font Info: ... okay on input line 76. +LaTeX Font Info: Checking defaults for TS1/cmr/m/n on input line 76. +LaTeX Font Info: ... okay on input line 76. +LaTeX Font Info: Checking defaults for OMX/cmex/m/n on input line 76. +LaTeX Font Info: ... okay on input line 76. +LaTeX Font Info: Checking defaults for U/cmr/m/n on input line 76. +LaTeX Font Info: ... okay on input line 76. +LaTeX Font Info: Checking defaults for PD1/pdf/m/n on input line 76. +LaTeX Font Info: ... okay on input line 76. +LaTeX Font Info: Checking defaults for PU/pdf/m/n on input line 76. +LaTeX Font Info: ... okay on input line 76. +*geometry* driver: auto-detecting +*geometry* detected driver: pdftex +*geometry* verbose mode - [ preamble ] result: +* driver: pdftex +* paper: a4paper +* layout: +* layoutoffset:(h,v)=(0.0pt,0.0pt) +* modes: landscape +* h-part:(L,W,R)=(5.69054pt, 833.66577pt, 5.69054pt) +* v-part:(T,H,B)=(5.69054pt, 586.1268pt, 5.69054pt) +* \paperwidth=845.04684pt +* \paperheight=597.50787pt +* \textwidth=833.66577pt +* \textheight=586.1268pt +* \oddsidemargin=-66.57945pt +* \evensidemargin=-66.57945pt +* \topmargin=-80.00208pt +* \headheight=12.0pt +* \headsep=1.42262pt +* \topskip=9.0pt +* \footskip=30.0pt +* \marginparwidth=144.0pt +* \marginparsep=10.0pt +* \columnsep=10.0pt +* \skip\footins=7.0pt plus 4.0pt minus 2.0pt +* \hoffset=0.0pt +* \voffset=0.0pt +* \mag=1000 +* \@twocolumnfalse +* \@twosidefalse +* \@mparswitchfalse +* \@reversemarginfalse +* (1in=72.27pt=25.4mm, 1cm=28.453pt) + +(/usr/local/texlive/2022/texmf-dist/tex/context/base/mkii/supp-pdf.mkii +[Loading MPS to PDF converter (version 2006.09.02).] +\scratchcounter=\count325 +\scratchdimen=\dimen259 +\scratchbox=\box104 +\nofMPsegments=\count326 +\nofMParguments=\count327 +\everyMPshowfont=\toks39 +\MPscratchCnt=\count328 +\MPscratchDim=\dimen260 +\MPnumerator=\count329 +\makeMPintoPDFobject=\count330 +\everyMPtoPDFconversion=\toks40 +) (/usr/local/texlive/2022/texmf-dist/tex/latex/epstopdf-pkg/epstopdf-base.sty +Package: epstopdf-base 2020-01-24 v2.11 Base part for package epstopdf +Package epstopdf-base Info: Redefining graphics rule for `.eps' on input line 485. + (/usr/local/texlive/2022/texmf-dist/tex/latex/latexconfig/epstopdf-sys.cfg +File: epstopdf-sys.cfg 2010/07/13 v1.3 Configuration of (r)epstopdf for TeX Live +)) +Package hyperref Info: Link coloring OFF on input line 76. + (/usr/local/texlive/2022/texmf-dist/tex/latex/hyperref/nameref.sty +Package: nameref 2021-04-02 v2.47 Cross-referencing by name of section + (/usr/local/texlive/2022/texmf-dist/tex/latex/refcount/refcount.sty +Package: refcount 2019/12/15 v3.6 Data extraction from label references (HO) +) (/usr/local/texlive/2022/texmf-dist/tex/generic/gettitlestring/gettitlestring.sty +Package: gettitlestring 2019/12/15 v1.6 Cleanup title references (HO) +) +\c@section@level=\count331 +) +LaTeX Info: Redefining \ref on input line 76. +LaTeX Info: Redefining \pageref on input line 76. +LaTeX Info: Redefining \nameref on input line 76. +\@outlinefile=\write3 +\openout3 = `cs4224-cheatsheet.out'. + +\c@mv@tabular=\count332 +\c@mv@boldtabular=\count333 +Package caption Info: Begin \AtBeginDocument code. +Package caption Info: subfig package v1.3 is loaded. +Package caption Info: End \AtBeginDocument code. +LaTeX Font Info: Font shape `OT1/qhv/m/n' will be +(Font) scaled to size 5.64001pt on input line 78. +LaTeX Font Info: Font shape `OT1/qhv/b/n' will be +(Font) scaled to size 5.64001pt on input line 90. +LaTeX Font Info: Trying to load font information for U+msa on input line 90. + (/usr/local/texlive/2022/texmf-dist/tex/latex/amsfonts/umsa.fd +File: umsa.fd 2013/01/14 v3.01 AMS symbols A +) +LaTeX Font Info: Trying to load font information for U+msb on input line 90. + (/usr/local/texlive/2022/texmf-dist/tex/latex/amsfonts/umsb.fd +File: umsb.fd 2013/01/14 v3.01 AMS symbols B +) +LaTeX Font Info: Font shape `OT1/qhv/b/n' will be +(Font) scaled to size 7.52002pt on input line 92. +LaTeX Font Info: Trying to load font information for TS1+qhv on input line 105. + (/usr/local/texlive/2022/texmf-dist/tex/latex/tex-gyre/ts1qhv.fd +File: ts1qhv.fd 2009/09/25 v1.2 font definition file for TS1/qhv +) +LaTeX Font Info: Font shape `TS1/qhv/m/n' will be +(Font) scaled to size 5.64001pt on input line 105. +LaTeX Font Info: Font shape `OT1/qhv/m/n' will be +(Font) scaled to size 4.70001pt on input line 112. +LaTeX Font Info: Font shape `OT1/qhv/m/n' will be +(Font) scaled to size 6.58002pt on input line 118. +LaTeX Font Info: Font shape `OT1/qhv/b/n' will be +(Font) scaled to size 6.58002pt on input line 118. + + +Package hyperref Warning: Token not allowed in a PDF string (Unicode): +(hyperref) removing `math shift' on input line 126. + + +Package hyperref Warning: Token not allowed in a PDF string (Unicode): +(hyperref) removing `\mathrel' on input line 126. + + +Package hyperref Warning: Token not allowed in a PDF string (Unicode): +(hyperref) removing `\triangleright' on input line 126. + + +Package hyperref Warning: Token not allowed in a PDF string (Unicode): +(hyperref) removing `\mathrel' on input line 126. + + +Package hyperref Warning: Token not allowed in a PDF string (Unicode): +(hyperref) removing `\mkern' on input line 126. + + +Package hyperref Warning: Token not allowed in a PDF string (Unicode): +(hyperref) removing `\mathrel' on input line 126. + + +Package hyperref Warning: Token not allowed in a PDF string (Unicode): +(hyperref) removing `\triangleleft' on input line 126. + + +Package hyperref Warning: Token not allowed in a PDF string (Unicode): +(hyperref) removing `subscript' on input line 126. + + +Package hyperref Warning: Token not allowed in a PDF string (Unicode): +(hyperref) removing `math shift' on input line 126. + +[1 + +{/usr/local/texlive/2022/texmf-var/fonts/map/pdftex/updmap/pdftex.map}] +LaTeX Font Info: Font shape `OT1/qhv/m/it' will be +(Font) scaled to size 5.64001pt on input line 648. +LaTeX Font Info: Trying to load font information for OT1+ntxtt on input line 743. + (/usr/local/texlive/2022/texmf-dist/tex/latex/newtx/ot1ntxtt.fd +File: ot1ntxtt.fd 2012/04/20 v3.1 +) +LaTeX Font Info: Font shape `OT1/ntxtt/m/n' will be +(Font) scaled to size 6.0pt on input line 743. + [2] [3] (./cs4224-cheatsheet.aux) + +Package rerunfilecheck Warning: File `cs4224-cheatsheet.out' has changed. +(rerunfilecheck) Rerun to get outlines right +(rerunfilecheck) or use package `bookmark'. + +Package rerunfilecheck Info: Checksums for `cs4224-cheatsheet.out': +(rerunfilecheck) Before: +(rerunfilecheck) After: CB1DA56ED04E572AAF0CD8F94F64D98A;4526. + ) +Here is how much of TeX's memory you used: + 15151 strings out of 478268 + 244364 string characters out of 5846347 + 715709 words of memory out of 5000000 + 32928 multiletter control sequences out of 15000+600000 + 500057 words of font info for 53 fonts, out of 8000000 for 9000 + 1141 hyphenation exceptions out of 8191 + 69i,8n,117p,555b,754s stack positions out of 10000i,1000n,20000p,200000b,200000s +{/usr/local/texlive/2022/texmf-dist/fonts/enc/dvips/tex-gyre/q-rm.enc}{/usr/local/texlive/2022/texmf-dist/fonts/enc/dvips/tex-gyre/q-ts1.enc} +Output written on cs4224-cheatsheet.pdf (3 pages, 198253 bytes). +PDF statistics: + 327 PDF objects out of 1000 (max. 8388607) + 294 compressed objects within 3 object streams + 203 named destinations out of 1000 (max. 500000) + 1 words of extra memory for PDF output out of 10000 (max. 10000000) + diff --git a/cs4224/cs4224-cheatsheet.out b/cs4224/cs4224-cheatsheet.out new file mode 100644 index 0000000..ef34e32 --- /dev/null +++ b/cs4224/cs4224-cheatsheet.out @@ -0,0 +1,32 @@ +\BOOKMARK [2][-]{section*.1}{\376\377\0002\000.\000\040\000D\000a\000t\000a\000\040\000P\000a\000r\000t\000i\000t\000i\000o\000n\000i\000n\000g}{}% 1 +\BOOKMARK [2][-]{section*.2}{\376\377\0003\000.\000\040\000Q\000u\000e\000r\000y\000\040\000P\000r\000o\000c\000e\000s\000s\000i\000n\000g}{}% 2 +\BOOKMARK [3][-]{section*.3}{\376\377\000R\000e\000d\000u\000c\000t\000i\000o\000n\000\040\000T\000e\000c\000h\000n\000i\000q\000u\000e\000s}{section*.2}% 3 +\BOOKMARK [3][-]{section*.4}{\376\377\000J\000o\000i\000n\000\040\000S\000t\000r\000a\000t\000e\000g\000i\000e\000s\000\040\000f\000o\000r\000\040\000R\000\040\000-\0003\000m\000u\000a\000\040\000S}{section*.2}% 4 +\BOOKMARK [2][-]{section*.5}{\376\377\0004\000.\000\040\000Q\000u\000e\000r\000y\000\040\000O\000p\000t\000i\000m\000i\000z\000a\000t\000i\000o\000n}{}% 5 +\BOOKMARK [3][-]{section*.6}{\376\377\000S\000e\000l\000e\000c\000t\000i\000v\000i\000t\000y\000\040\000F\000a\000c\000t\000o\000r}{section*.5}% 6 +\BOOKMARK [3][-]{section*.7}{\376\377\000C\000o\000s\000t\000\040\000e\000s\000t\000i\000m\000a\000t\000i\000o\000n}{section*.5}% 7 +\BOOKMARK [3][-]{section*.8}{\376\377\000O\000p\000t\000i\000m\000i\000z\000a\000t\000i\000o\000n\000\040\000w\000/\000\040\000S\000e\000m\000i\000-\000J\000o\000i\000n\000s}{section*.5}% 8 +\BOOKMARK [3][-]{section*.9}{\376\377\000G\000r\000o\000u\000p\000-\000B\000y\000\040\000O\000p\000t\000i\000m\000i\000z\000a\000t\000i\000o\000n}{section*.5}% 9 +\BOOKMARK [2][-]{section*.10}{\376\377\0005\000.\000\040\000S\000t\000o\000r\000a\000g\000e}{}% 10 +\BOOKMARK [3][-]{section*.11}{\376\377\000L\000o\000g\000-\000S\000t\000r\000u\000c\000t\000u\000r\000e\000d\000\040\000M\000e\000r\000g\000e\000\040\000T\000a\000b\000l\000e}{section*.10}% 11 +\BOOKMARK [3][-]{section*.12}{\376\377\000L\000S\000M\000\040\000C\000o\000m\000p\000a\000c\000t\000i\000o\000n}{section*.10}% 12 +\BOOKMARK [3][-]{section*.13}{\376\377\000L\000S\000M\000\040\000S\000e\000a\000r\000c\000h\000\040\000O\000p\000t\000i\000m\000i\000z\000a\000t\000i\000o\000n}{section*.10}% 13 +\BOOKMARK [3][-]{section*.14}{\376\377\000I\000n\000d\000e\000x\000i\000n\000g}{section*.10}% 14 +\BOOKMARK [2][-]{section*.15}{\376\377\0006\000.\000\040\000C\000o\000m\000m\000i\000t\000\040\000P\000r\000o\000t\000o\000c\000o\000l\000s}{}% 15 +\BOOKMARK [3][-]{section*.16}{\376\377\0002\000P\000C\000\040\000P\000r\000o\000t\000o\000c\000o\000l}{section*.15}% 16 +\BOOKMARK [3][-]{section*.17}{\376\377\0003\000P\000C\000-\0001\000\040\000P\000r\000o\000t\000o\000c\000o\000l}{section*.15}% 17 +\BOOKMARK [3][-]{section*.18}{\376\377\0003\000P\000C\000-\0002\000\040\000P\000r\000o\000t\000o\000c\000o\000l}{section*.15}% 18 +\BOOKMARK [2][-]{section*.19}{\376\377\0007\000.\000\040\000C\000o\000n\000c\000u\000r\000r\000e\000n\000c\000y\000\040\000C\000o\000n\000t\000r\000o\000l}{}% 19 +\BOOKMARK [3][-]{section*.20}{\376\377\000R\000e\000v\000i\000s\000i\000o\000n}{section*.19}% 20 +\BOOKMARK [3][-]{section*.21}{\376\377\000D\000i\000s\000t\000r\000i\000b\000u\000t\000e\000d\000\040\000C\000C}{section*.19}% 21 +\BOOKMARK [2][-]{section*.22}{\376\377\0008\000.\000\040\000R\000e\000p\000l\000i\000c\000a\000t\000i\000o\000n}{}% 22 +\BOOKMARK [3][-]{section*.23}{\376\377\000H\000a\000n\000d\000l\000i\000n\000g\000\040\000F\000a\000i\000l\000u\000r\000e\000s}{section*.22}% 23 +\BOOKMARK [3][-]{section*.24}{\376\377\000Q\000u\000o\000r\000u\000m\000\040\000C\000o\000n\000s\000e\000n\000s\000u\000s\000\040\000P\000r\000o\000t\000o\000c\000o\000l}{section*.22}% 24 +\BOOKMARK [2][-]{section*.25}{\376\377\0009\000.\000\040\000C\000o\000n\000s\000i\000s\000t\000e\000n\000c\000y}{}% 25 +\BOOKMARK [3][-]{section*.26}{\376\377\000P\000i\000l\000e\000u\000s}{section*.25}% 26 +\BOOKMARK [2][-]{section*.27}{\376\377\0001\0000\000.\000\040\000R\000a\000f\000t\000\040\000C\000o\000n\000s\000e\000n\000s\000u\000s}{}% 27 +\BOOKMARK [3][-]{section*.28}{\376\377\000S\000e\000r\000v\000e\000r\000\040\000S\000t\000a\000t\000e}{section*.27}% 28 +\BOOKMARK [3][-]{section*.29}{\376\377\000R\000P\000C\000s\000\040\000\046\000\040\000T\000i\000m\000e\000r\000s}{section*.27}% 29 +\BOOKMARK [3][-]{section*.30}{\376\377\000L\000e\000a\000d\000e\000r\000\040\000E\000l\000e\000c\000t\000i\000o\000n}{section*.27}% 30 +\BOOKMARK [3][-]{section*.31}{\376\377\000L\000o\000g\000\040\000R\000e\000p\000l\000i\000c\000a\000t\000i\000o\000n}{section*.27}% 31 +\BOOKMARK [3][-]{section*.32}{\376\377\000E\000x\000a\000m\000p\000l\000e\000\040\000S\000c\000e\000n\000a\000r\000i\000o}{section*.27}% 32 diff --git a/cs4224/cs4224-cheatsheet.pdf b/cs4224/cs4224-cheatsheet.pdf new file mode 100644 index 0000000..eb01c15 Binary files /dev/null and b/cs4224/cs4224-cheatsheet.pdf differ diff --git a/cs4224/cs4224-cheatsheet.synctex.gz b/cs4224/cs4224-cheatsheet.synctex.gz new file mode 100644 index 0000000..c8d9489 Binary files /dev/null and b/cs4224/cs4224-cheatsheet.synctex.gz differ diff --git a/cs4224/cs4224-cheatsheet.tex b/cs4224/cs4224-cheatsheet.tex new file mode 100755 index 0000000..8358f60 --- /dev/null +++ b/cs4224/cs4224-cheatsheet.tex @@ -0,0 +1,772 @@ +\documentclass[8pt, landscape]{extarticle} +\usepackage[scaled=0.92]{helvet} +\usepackage{calc} +\usepackage{multicol} +\usepackage[a4paper,margin=2mm,landscape, headsep=0.5mm]{geometry} +\usepackage{amsmath,amsthm,amsfonts,amssymb} +\usepackage{color,graphicx,overpic} +\usepackage{hyperref} +\usepackage{newtxtext} +\usepackage{enumitem} +\usepackage[table]{xcolor} +\usepackage{mathtools} +\usepackage{caption} +\usepackage{subfig} + +\setlist{nosep} +% for including images +\graphicspath{ {./images/} } + +\pdfinfo{ + /Title (CS3223.pdf) + /Creator (TeX) + /Producer (pdfTeX 1.40.0) + /Author (Jovyn Tan, Jotham Wong) + /Subject (CS3223) +/Keywords (CS3223, nus,cheatsheet,pdf)} + +% Turn off header and footer +\pagestyle{empty} + +% redefine section commands to use less space +\makeatletter +\renewcommand{\section}{\@startsection{section}{1}{0mm}% + {-1ex plus -.5ex minus -.2ex}% + {0.5ex plus .2ex}%x +{\normalfont\large\bfseries}} +\renewcommand{\subsection}{\@startsection{subsection}{2}{0mm}% + {-1explus -.5ex minus -.2ex}% + {0.5ex plus .2ex}% +{\normalfont\normalsize\bfseries}} +\renewcommand{\subsubsection}{\@startsection{subsubsection}{3}{0mm}% + {-1ex plus -.5ex minus -.2ex}% + {1ex plus .2ex}% +{\normalfont\small\bfseries}}% +\makeatother + +\renewcommand{\familydefault}{\sfdefault} +\renewcommand\rmdefault{\sfdefault} +% makes nested numbering (e.g. 1.1.1, 1.1.2, etc) +\renewcommand{\labelenumii}{\theenumii} +\renewcommand{\theenumii}{\theenumi.\arabic{enumii}.} +\renewcommand\labelitemii{•} +\renewcommand\labelitemiii{•} + +\definecolor{mathblue}{cmyk}{1,.72,0,.38} +\everymath\expandafter{\the\everymath \color{mathblue}} + +% Don't print section numbers +\setcounter{secnumdepth}{0} + +\setlength{\parindent}{0pt} +\setlength{\parskip}{0pt plus 0.5ex} +%% adjust spacing for all itemize/enumerate +\setlength{\leftmargini}{0.5cm} +\setlength{\leftmarginii}{0.5cm} +\setlist[itemize,1]{leftmargin=2mm,labelindent=1mm,labelsep=1mm} +\setlist[itemize,2]{leftmargin=4mm,labelindent=1mm,labelsep=1mm} +\setlist[itemize,3]{leftmargin=4mm,labelindent=1mm,labelsep=1mm} + +\captionsetup{belowskip=0pt} +% adding my commands +\input{../commands/style-helpers.tex} + +% ----------------------------------------------------------------------- + +\begin{document} +\raggedright +\footnotesize +\begin{multicols*}{4} + % multicol parameters + \setlength{\columnseprule}{0.25pt} + + \begin{center} + \fbox{% + \parbox{0.8\linewidth}{\centering \textcolor{black}{ + {\textbf{CS4224}} + \\ AY24/25 SEM 1} + \\ {\footnotesize \textcolor{gray}{github/JothamWong}} + }% + } + \end{center} + \subsection{2. Data Partitioning} + \begin{enumerate} + \item Horizontal Fragmentation (Partition) + \begin{enumerate} + \item \textbf{Completeness}: $\forall t \in R, \exists R_i \ s.t \ t \in R_i$ + \item \textbf{Reconstruction}: $R = R_1 \cup \dots \cup R_n$ + \item \textbf{Disjointness}: $\forall R_i, R_j (i \neq j \Rightarrow R_i \cap R_j = \emptyset)$ + \end{enumerate} + Techniques: + \begin{enumerate} + \item Range Partitioning (on some predicates) + \item Hash Partitioning (Modulo or Consistent Hashing) + \begin{itemize} + \item Consistent Hashing allows even distribution or efficient redistribution of non-uniform data, oblivious to server heterogeneity (with virtual nodes). Key $k$ goes to node $N$ if $h(N-1) < h(k) \leq h(N)$. + \end{itemize} + \item Derived Horizontal Fragmentation (Based on a \textbf{non-nullable foreign key} to another partitioned relation) + \end{enumerate} + \item Vertical Fragmentation + \begin{enumerate} + \item Completeness follows. \textbf{Reconstruction}: $R = R_1 \bowtie \dots \bowtie R_n$ + \item \textbf{Disjointness}: $\forall R_i, R_j (i \neq j \Rightarrow \text{attributes(}R_i\text{)} \cap \text{attributes(}R_j\text{)} = \lbrace\text{key(}R\text{)}\rbrace)$ + \end{enumerate} + \item Purpose is for co-location of data (geographical) + \item Optimize for access patterns: Avoid \textbf{distributed update txns} (update multiple partitions), avoid \textbf{scatter-gather} (accesses every partition) + \end{enumerate} + \subsection{3. Query Processing} + \subsubsection{Reduction Techniques} + Simplify localized query (by eliminating redundant fragments) following conversion of distributed query + \begin{enumerate} + \item $R_i = \sigma_{F_i}(R) \land \neg ( F_i \land p ) \implies \sigma_p(R_i) = \emptyset $ + \item $R_i = \sigma_{F_a \land F}(R) \land S_j = \sigma_{F'_a \land F'}(S) \land \neg ( F_a \land F'_a ) \implies R_i \bowtie_a S_j = \emptyset $ + \item $S_i = S \ltimes_a R_i $ is a derived horizontal fragment of $R_i \land i \neq j \implies S_i \bowtie_a R_j = \emptyset $ + \item $R_1, \dots, R_n$ are vertical fragments of $R \land (attr(R_1) - key (R)) \cap L = \emptyset \implies \pi_L(R_1 \bowtie \cdots \bowtie R_n) = \pi_L(R_2 \bowtie \dots \bowtie R_n)$ + \end{enumerate} + \subsubsection{Join Strategies for $R \bowtie_{a} S$} + \begin{itemize} + \item Case 1: Both R and S partitioned on join key (Collocated) + \item Case 2: Only R, not S, is partitioned on join key (Directed or BCast) + \item Case 3: Neither R nor S partitioned on join key (Repartitioned or BCast) + \item When tackling optimal partitioning, there is no greedy choice. One must enumerate all plans as a suboptimal broadcast now can result in an optimal collocation later. + \end{itemize} +\begin{tabular}{|l|l|} +\hline +Join Strategy & Communication Cost (excl. post-join union cost) \\ +\hline +Collocated &0 \\ +Directed &$size(R)$ if $R$ is being repartitioned \\ +Repartitioned &$size(R) + size(S)$ \\ +Broadcast &$(n-1) \times size(R)$ if $R$ is being broadcast \\ +\hline +\end{tabular} + +\subsection{4. Query Optimization} + Query plan minimizes (CPU, I/O) cost (max. throughput), or latency + \subsubsection{Selectivity Factor} + \begin{enumerate} + \item \textbf{Extended push down of selection over join:} $\sigma_p(R\bowtie_{p'}S)=\sigma_{PR}(R)\bowtie_{p'}\sigma_{PS}(S) \text{ iff } p = PR \land PS, attr(PR) \subseteq attr(R) \land attr(PS) \subseteq attr(S)$ + \item Joins can be distributed over union: $(E_1 \cup E_2)\bowtie (C_1\cup C_2) = (E_1 \bowtie C_1) \cup (E_1 \bowtie C_2) \cup (E_2 \bowtie C_1) \cup (E_2 \bowtie C_2)$ + \item \begin{itemize} + \item Uniformity assumption: uniform distribution of values in attr + \item Independence assumption: attrs are independent + \item Inclusion assumption: For $R \bowtie_A S$, if $\lVert{\pi_A (R)}\lVert \leq \lVert{\pi_A (S)}\lVert$ then $\pi_A (R) \subseteq \pi_A(S)$ + \end{itemize} + \item $SF(\sigma_{A=v}(R)) \approx \frac{1}{\lVert \pi_A(R \lVert}$ + \item $SF(\sigma_{A Cost = T_{MSG} + T_{TR} \times size(\pi_A(S))$ + % \item Note that the $SF(R\ltimes S)$ is the statistic for the RHS! not the LHS + % \begin{align*} + % T_{TR} \times size(R) \times (1 - SF(R \ltimes_A S)) \\ + % - T_{MSG} - T_{TR} \times size(\pi_A(S)) > 0 + % \end{align*} + \end{itemize} + + \subsubsection{Group-By Optimization} + \textbf{Refer to exam attachment.} \\ + For $G_{A,F}(R)$, \\ + $A \subseteq attrs(R)$ and $F = \{T_1=f_1(e_1),\dots,T_n=f_n(e_n)\}$, where each $A_i$ is a grouping column, each $f_i$ is an aggregate function, each $e_i$ is an expression of attributes in $R$ and each $T_i$ is a column alias. \\ + $alias(F) = \{T_1, \dots, T_n\}$ + +\subsection{5. Storage} +\subsubsection{Log-Structured Merge Table} +\begin{itemize} + \item MemTable + SSTables + commit log + \item Deleted records marked with tombstones ($\bot$) + \item Flush to new SSTable when MemTable is full + \item SSTables are sorted by and associated with range of key values and creation timestamp +\end{itemize} +\subsubsection{LSM Compaction} +\begin{enumerate} + \item Remove stale (older) values. Keep tombstones if newer. + \item Let $r$ be a record in R and let $V_r$ be the set of all versions of $r \in D$ + \item \textbf{Size-tiered Compaction Strategy} + \begin{itemize} + \item Each tier has approximately the same size, and a higher tier is larger than the previous tier. + \item Compaction is triggered when the number of SSTables at a tier L reaches a threshold, then all SSTables in Tier L merged into a single SSTable in Tier L+1. Tier L is empty and Tier L + 1 can either be +1 (most cases) or -1 if last level and all are tombstones. + \item \textbf{Search:} Top-down from MemTable, Tier 0 tables to Tier m tables, most recent timestamp first. + \item There is 1 unique version of r in each table in each tier. So if you have $N_0 + N_1 + N_2$ tables, ($N_0$ = number of tables at tier 0), you have $N_0+N_1+N_2$ versions of r in total. + \end{itemize} + + \item \textbf{Leveled Compaction Strategy} + \begin{itemize} + \item After merge, split into properly-sized tables. + \item SSTables at level 0 may overlap + \item $L \geq 1$: SSTables at the same level do not overlap, have the same size + \item SSTable at level L overlaps with at most F SSTables in level L+1. + \item If the max num records in R is $n$ and the size of each record is $m$ MB, the max size of R is $mn$. Let $L$ denote num levels to store $R$. In worst case, last level of LSM stores a version of each record in $R$. Therefore $F^{L-1}< mn \leq F^{L} \rightarrow log_{F}(mn) \leq L < log_{F}(mn)+1 \rightarrow L = ceil(log_{F}(mn))$ + \item Increasing F reduces number of levels of LSM which improves worst case I/O for searching. But larger F means more overlapping tables to be merged during compaction, so it increases I/O cost of compaction. + \item In LCS, it is possible for 2 tables in L (S1, S2) to overlap with the same table (S3) in L+1. Denote the intersection of S2 and S3 as O3. S2 overlaps with S3 and F-1 other tables in L+1. When compacting S1, if the records in O3 are distributed across two tables (as table is full), S2 will violate invariant. The fix is to identify O3, and if the entire O3 cannot fit into the current new table, move them all to a new table. + \item \textbf{Compacting} + \begin{itemize} + \item $L=0$: \textbf{All} SSTables at level 0 are merged with all overlapping SSTables at L1 + \item $L \geq 1$: Let v be the ending key of the last compaction. Next SSTable S to compact is first SSTable that starts after v if it exists, otherwise go to smallest start value. Merge S with all overlapping SSTables at level L+1. + \end{itemize} + \item \textbf{Search:} Top-down from MemTable, Tier 0 tables to Tier m tables, most recent timestamp first. \textbf{Check if key falls in table's range before searching within table.} + \item For $V_r$, there is 1 version of each table in Tier 0 and only 1 unique version in Tiers 1 and above. So you have $N_0 + k$ where k is number of Tier 1 and above SSTables. + \end{itemize} +\end{enumerate} + +\subsubsection{LSM Search Optimization} +Each SSTable file consists of a sequence of data blocks. +\begin{enumerate} + \item \textbf{Sparse Index}: To find the block, build a sparse index of "first key value in $i^{th}$ block" $\rightarrow$ "address of $i^{th}$ block". Search within block of covering range. + \item \textbf{Bloom Filter}: To test if a key $x$ exists in a block, build a bloom filter $B$ for each block $S$. If $\exists i \in [1,k] \ s.t. \ h_i(x) = j \text{ and } B[j]=0$, $x\notin S$. +\end{enumerate} + +\subsubsection{Indexing} +\begin{itemize} + \item \textbf{Local Index}: An index for each partition is built. + \item This is bad for search: as you need to search the index of each partition + \item Better for updates, as you only need to update the index for each partition + \item \textbf{Global Index}: The index is a derived partition from the data partition. + \item Bad for updates, as the index may not be on the same fragment as the data. + \item Good for searching the index, as you only need to search one index server. But bcos data can be on different shards, still may end up querying multiple shards. +\end{itemize} + + \subsection{6. Commit Protocols} +\begin{itemize} + \item \textbf{Log} Sequential file of records in \textbf{non-volatile/stable storage} (multiple copies) + \item \textbf{Recovery manager}: Supports Abort, Commit and Restart to preserve atomicity and durability of \textbf{local} txns. + \begin{itemize} + \item \textbf{Abort: Write-ahead logging (WAL) protocol} + \begin{itemize} + \item Uncommitted update to DB not flushed til log with before-image is flushed. + \item Restore log record's before-image in reverse order. + \end{itemize} + \item \textbf{Commit: Force-at-commit protocol} + \begin{itemize} + \item Do not commit a Xact until after-images of all its updated records are in stable storage (DB or log). Enforced by writing a \textbf{commit log record} r for Xact and flushing all log records (up to and including r) for Xact to disk. + \item An Xact is considered committed if its commit log is written to stable storage + \end{itemize} + \item \textbf{Restart: Redo + Undo} + \begin{enumerate} + \item \textbf{Redo Phase:} Scans log records in forward direction to redo updates, keeping track of active txns. + \item \textbf{Undo Phase:} Abort active txns. + \end{enumerate} + \end{itemize} + \item \textbf{Commit Protocol:} + \begin{itemize} + \item Txn coordinator (TC) coordinates with Txn Managers (TMs) to execute txn T at multiple sites, and ensures \textbf{atomicity} of distributed txn. + \item \textbf{Log Records:} Log writes are \textbf{forced} or synchronous if it must be flushed to disk before the next message can be sent, else it is not forced/asynchronous. + \item \textbf{Site failures:} + \begin{itemize} + \item Detected by \textbf{timeouts}, which invoke \textbf{termination protocol} at operational sites. Termination protocol is \textbf{non-blocking} if it permits a transaction to commit/abort at sites w/o waiting for recovery. + \item On restart, invoke \textbf{recovery protocol} at failed site. Recovery protocol is \textbf{independent} if no communication with another site is necessary to determine how to terminate a txn. + \end{itemize} + \end{itemize} +\end{itemize} + +\subsubsection{2PC Protocol} +Two-Phase commit +\begin{enumerate} + \item Voting phase: TC collects votes from TMs + \item Decision phase: TC broadcasts global decision to TMs. +\end{enumerate} +2PC is synchronous within one state transition.\\ +\textbf{See exam attachment for state transitions, recovery and termination protocols.} + +\textbf{2PC Cooperative Termination Protocol} \\ + +Reduce probability of blocking by failure in coordinator. +\begin{itemize} + \item TC includes addresses of all participants in "Prepare" msg. + \item When a participant P times out in READY state, bcast "Decision-request" msg. + \item When another participant receives it, respond as follows: + \begin{tabular}{cl} + \textbf{State} & \textbf{Actions} \\ + INITIAL & Replies "Abort"; Unilaterally aborts \\ + READY & Replies "Uncertain" \\ + COMMIT & Replies "Commit" \\ + ABORT & Replies "Abort" \\ + \end{tabular} + \item P terminates txn with decision, if any, and sends it to all participats that replied "Uncertain". Else P remains blocked. +\end{itemize} + +\textbf{Other blocking scenarios} +\begin{itemize} + \item $C$ fails after sending Global-commit, $P_1$ fails after recieving Global-commit, others are in READY state. + \item $C$ fails before recieving any vote, $P_1$ fails after voting, others are in READY state. +\end{itemize} + +\subsubsection{3PC-1 Protocol} +Three-Phase commit. Non-blocking in absence of comm. or total site failure. \\ +May block in event of total site failure, but correctness is guaranteed. +\begin{enumerate} + \item Voting phase: TC collects votes from TMs + \item TC disseminates voting outcome to TMs if there is no abort vote. + \item Decision phase: TC broadcasts global decision to TMs. +\end{enumerate} + +\textbf{See exam attachment for state transitions, recovery and termination protocols.} \\ + +\textbf{3PC Termination Protocol 1} + +\begin{enumerate} + \item Elect a new coordinator C'. + \item C' sends "State-request" msg and obtains current states of participants. + \item C' terminates txn as follows: + \begin{enumerate} + \item If there is some TM in COMMIT, + \begin{enumerate} + \item C' sends "Global-commit" + \end{enumerate} + \item else if no Tm is in PRECOMMIT, + \begin{enumerate} + \item C' sends "Global-abort" to all + \end{enumerate} + \item else, C' sends "Prepare-to-commit" to TMs in READY state. After recieving "Ready-to-commit" from them, send "Global-commit" to all. + \end{enumerate} +\end{enumerate} + +\begin{itemize} + \item If any TM times out, elect a new TC. + \item If any participant fails, TC will ignore it. + \item If a participant recovers during the termination protocol, it's blocked until after the protocol finishes. +\end{itemize} + +\textbf{Handling Total site failure} \\ +Recovering TMs remain blocked until a TM P recovers: +\begin{itemize} + \item \textbf{Case 1:} P recovers independently (it is READY/ABORT/COMMIT). \\ + P will notify recovered TMs of global decision. + \item \textbf{Case 2:} P was the last TM to fail \\ + P terminates the txns by executing Termination Protocol 1 among recoverd TMs. +\end{itemize} + +\subsubsection{3PC-2 Protocol} +\textbf{Goal:} Under comm. failure, ensure correctness (consistent decision) made by \textbf{multiple coordinators}. + +\textbf{3PC Termination Protocol 2} + +\begin{enumerate} + \item Elect a new coordinator C'. + \item C' sends "State-request" msg and obtains current states of participants. + \item C' terminates txn as follows: + \begin{enumerate} + \item If there is some TM in COMMIT, + \begin{enumerate} + \item C' sends "Global-commit" + \end{enumerate} + \item else if there is some TM in ABORT, + \begin{enumerate} + \item C' sends "Global-abort" + \end{enumerate} + \item else if there's at least 1 PRECOMMIT, no COMMIT/ABORT \& majority READY+PRECOMMIT states, + \begin{enumerate} + \item C' sends "Prepare-to-commit" to those not in PRECOMMIT. + \item Those recieving change to PRECOMMIT and reply "Ready-to-commit". + \item If "Ready-to-commit" msg + PRECOMMIT is majority, C' sends "Global-commit"; else, all \textbf{block}. + \end{enumerate} + \item else if there's no COMMIT nor ABORT \& majority INITIAL+READY+PREABORT states, + \begin{enumerate} + \item C' sends "Prepare-to-abort" to those not in PREABORT. + \item Those recieving change to PREABORT and reply "Ready-to-abort". + \item If "Ready-to-abort" msg + PREABORT is majority, C' sends "Global-abort"; else, all \textbf{block}. + \end{enumerate} + \item else, all \textbf{block}. + \end{enumerate} +\end{enumerate} + +Blocked TMs periodically execute the above protocol, as do failed TMs upon recovery. \\ +3PC-2 is non-blocking in absence of comm. failure, so long as majority of TMs are operational.\\ +Reasoning about whether an operation is forced or not forced, think about what happens if it crashes before it writes the op, does that contradict the global decision?\\ +3PC-1 can global abort even if one P is in pre-commit. C crashes immediately after. Rest of P are in READY and elect new C. Termination protocol. + +\subsection{7. Concurrency Control} + +\subsubsection{Revision} + +\begin{itemize} + \item $S$ and $S'$ are \textbf{View equiv.} if + \begin{enumerate} + \item Every $T_i$ that reads $A$ from $T_j$ in $S$ also reads $A$ from $T_j$ in $S'$. + \item For each $A$, the same txn performs the final write in $S'$ as in $S$. + \end{enumerate} + \item Pairs of accesses conflict if they are on the same obj., are from different txns, and one of them is a write. + \item $S$ and $S'$ are \textbf{Conflict equiv.} if they preserve the order of all pairs of conflicting accesses in committed txns. + \item $S$ is \textbf{VSS/CSS} if $S$ and some serial (non-interleaved) sched. are \textbf{view/conflict equiv}. + \item VSSs with no blind writes are also CSSs. + \item If in $S$, every $T$ commits after all $T'$s it reads from, $S$ is a \textbf{recoverable sched.} + \item Assume blocked lock reqs. are FIFO queued (no starvation), and checked on each release. + \item Terminating a txn removes all its locks from req. queue. + \item Writes of $T$s in \textbf{strict scheds.} are not read from or overwritten by another txn until $T$ terminates. Thus they can be recovered with before-images (in logs). + \item \textbf{2PL:} Uses S and X-locks, cannot request more locks after releasing first lock. + \item \textbf{S2PL:} Can only release locks when terminating. + \item \textbf{MVCC:} Read-only txns never block, become blocked, or become aborted. + \item $S$ and $S'$ are \textbf{MV view equiv.} if every $T_i$ that reads $A_k$ from $T_j$ in $S$ also reads $A_k$ from $T_j$ in $S'$. + \item Each read in a \textbf{Monoversion scheds.} returns most recent-version write. + \item $S$ is \textbf{MVSS} if $S$ and some serial \textbf{monoversion} sched. are \textbf{MV view equiv}. + \item S2PL-S $\subset$ 2PL-S $\subset$ CSS $\subset$ VSS $\subset$ MVSS + \\ + \item \textbf{SI:} $R_i(O)$ reads the latest write in $T_i$, if any. Else, they read from the latest $W_j(O)$ where $T_j$ has the largest commit timestamp smaller than $T_i$'s start timestamp. + \begin{enumerate} + \item \textbf{FCW:} In pairs of concurrent txns, the first txn to commit causes the other to abort. + \item \textbf{FUW:} Txns requesting and blocked on an X-lock abort upon commit of the blocker txn. Txns upon obtaining an X-lock abort if they detect it has been updated by a concurrent txn. + \end{enumerate} + \item SI protocols can produce non-serializable schedules (Write Skew/Read-Only Txn anomaly). + \item To disprove SI, check that any concurrent updates must be disjoint. First scan all schedules and find two Txns that write to the same object. Say W4(c), W2(c). Then, you must show that C4 happens before the first operation in T2 or find a counter example by seeing if you can find a chain to any operation before W4(c) in the same local txn. + \item To disprove S2PL, check that a txn must release locks. +\end{itemize} + +\subsubsection{Distributed CC} + +\begin{itemize} + \item Let $T=\{ T_1, \dots T_n\}$ be a set of distributed txns executed over m sites with local schedules $\{ S_1, \dots S_m \}$. + \item A schedule S is a \textbf{global schedule} for T and the local schedules if each $S_i$ is a subsequence of S. + \item A \textbf{serializable global schedule} S is \textbf{view/conflict equiv.} to some serial schedule $S'$ over T. To approach this, for each local schedule $S_i$, derive a possible serial schedule for each local schedule. If the union of all the serial scheds. are compatible (acyclic) a global serial schedule exists. + \item \textbf{C2PL:} Central site manages all lock requests. \\ + \textbf{Deadlock Detection:} Each site maintains a local \textbf{Wait-For Graph (WFG)}, periodically transimtted to central site to build global \textbf{WFG}. + \item \textbf{D2PL:} Each lock is held at the same site as the obj. + \item \textbf{CSI:} CC site (different from $TM_A$) assigns start and commit timestamps. Queries from TC to obtain start timestamp also returns latest prior commit timestamp. \\ + Uses \textbf{FUW}, where X-locks are managed locally by each $TM_A$. + \begin{enumerate} + \item To read $x$ at Site A, TC sends read req and last commit $T_i$ to $TM_A$. $TM_A$ sends most recent version of x wrt lastcommit timestamp. + \item To write $x$ at site A, send write req to $TM_A$. Check if X-lock can be given. if granted, $TM_A$ updates X and sends notif to TC, otherwise $T_i$ is blocked. + \end{enumerate} + When T commits and releases locks, all $T_i$ blocked by T abort.\\ + On commit, execute \textbf{2PC variant:} + \begin{enumerate} + \item TC includes start and commit timestamps of $T_i$ in PREPARE msg. + \item On receipt, participants (with obj X-locks held by $T_i$) check for WW-conflicts between $T_i$ and committed concurrent txns (i.e. if version number of obj is between PREPARE start and commit timestamps). + \end{enumerate} +\end{itemize} + +\subsection{8. Replication} + +\begin{itemize} + \item \textbf{One-copy database} = non-replicated database + \item \textbf{Mutually consistent} = all replicas of data items have identical values. \\ + \textbf{Strong:} identical at the end of each update txn; \textbf{Weak:} eventual consistency (end of sched). + \item \textbf{Replicated data (RD)}: schedules on replicated database. Vice versa for \textbf{1-copy} schedule. + \item $T_j$ reads $x$ from $T_i$ in RD if + \begin{enumerate} + \item for some copy $x_A$ of $x$, $W_i(x_A)$ precedes $R_j(x_A)$ and + \item there is no $W_k(x_A), k \neq i$ that occurs between $W_i(x_A)$ and $R_j(x_A)$ + \end{enumerate} + \item $S_{RD}$ is \textbf{1SR} if it is equivalent to a serial one-copy schedule $S_{1C}$, where equivalence is + \begin{enumerate} + \item $T_j$ reads $x$ from $T_i$ in $S_{RD}$ iff $T_j$ reads $x$ from $T_i$ in $S_{1C}$ and + \item for each final write $W_i(x)$ in $S_{1C}$, $W_i(x_A)$ is a final write in $S_{RD}$ for \textbf{some copy} $x_A$ + \end{enumerate} + \item To check \textbf{1SR}, look at the reads-from relationship for each local schedule and check the precedence graph in the serial schedule for cycles. Then check if final write is satisfied for each serial final write. + \item Replication protocols are defined as WHEN+WHERE. + \item Eager (synchronous update): Propagates updates to all replicas affected by xact before commit. Enforces strong mutual consistency, ROWA. + \item Lazy (async): Xact updates only one replica, updates may propagate later (refresh txn). + \begin{itemize} + \item Need to preserver order of different refresh txns (as well as writes within txn) across all sites. + \item Use the commit timestamp of original txn. + \item Sites receiving refresh txn need to grant X-locks. + \end{itemize} + \item Centralized: Update is applied to master copy and propagated to slave copies. + \item Distributed: Update can be applied to any copy and propagated to other copies. + \item To distinguish centralized vs distributed, check if T write to another site when it has its own local copy. + \item Assume S2PL, statement-based replication. + \item Under lazy distributed, Last-Writer-Wins heuristic (timestamp-order) needed to reconcile conflicting concurrent updates by multiple xacts at different sites/copies. i.e. refresh updates with an older txn timestamp than local copy gets ignored. Heuristic can cause non-blind writes (RW-updates) to be lost. +\end{itemize} + +Eager is always 1 copy serializable +Lazy is not guaranteed to be 1 copy serializable, even when just 1 txn! +Lazy single-master: read local copy, which can be stale cos master update is async +Lazy distributed: no 1SR and inconsistent update: multiple xacts can update different copies of same data concurrently at different sites, requires last writer updates (only works for blind writes) + +\subsubsection{Handling Failures} +Single-master replication, with timeout-based detection. +\begin{itemize} + \item \textbf{Failure of slave site:} + \begin{enumerate} + \item Lazy replication: Sync unavailable ones later when they become available. + \item Eager replication: ROWAA. Update available replicas and terminate txn, sync unavailable replicas later + \end{enumerate} + \item \textbf{Failure of master:} \\ + \textbf{CAP Theorem:} In a \textbf{P}artitioned network, + \begin{enumerate} + \item Forfeit \textbf{A}vailability: Wait (block) for master site/network recovery, or + \item Forfeit \textbf{C}onsistency: Elect new master. Need to ensure at most one partition can have an operational master; else inconsistency. + \end{enumerate} +\end{itemize} + +\subsubsection{Quorum Consensus Protocol} + +\begin{itemize} + \item Assign non-negative weights and version nos. to all copies of an object $O$, which sum to some $Wt(O)$. + \item For k-tolerant, $(n-k)w \geq max \lbrace T_w(O), T_r(O)\rbrace$ + \item \textbf{To Read:} + \begin{enumerate} + \item Acquire S-locks on a quorum of copies whose sum-of-weights exceed $T_r(O)$ + \item Return copy within quorum with most recent version no. + \end{enumerate} + \item \textbf{To Write:} + \begin{enumerate} + \item Acquire X-locks on a quorum of copies whose sum-of-weights exceed $T_w(O)$ + \item Get max version no. within quorum, $n$. + \item Write to all copies in quorum, setting version no. to $n+1$. + \end{enumerate} + \item Note that $T_r(O) + T_w(O) > Wt(O)$ and $2 \times T_w(O) > Wt(O)$ +\end{itemize} + +\subsection{9. Consistency} + +\subsubsection{Pileus} + +\begin{enumerate} + \item Range-partitions and replicates with lazy centralized: primary and secondary sites. Updates are ordered by commit timestamps and performed at primary sites. Updates are received in timestamp order at secondary sites. + \item Concurrency control uses distributed snapshot isolation: prevent concurrent updates, $\text{readTS(t), commitTS(t)}$ + \item Server maintains the following information: + \begin{enumerate} + \item \textbf{key-range}: range of keys maintained by server + \item \textbf{store}: set of (key, value, timestamp) + \item \textbf{highTS}: commit timestamp of latest txn processed by server + \item \textbf{lowTS}: timestamp of server's most recent pruning operation + \end{enumerate} + \item Each primary server additionally maintains + \begin{enumerate} + \item \textbf{logical clock} for assigning commit timestamps + \item \textbf{pending} = list of (Put-set, proposed timestamp) pairs for uncommitted txns + \item \textbf{propagating} = queue of (Put-set, commit timestamp) to be async-sent to secondary replicas + \end{enumerate} + \item \textbf{Pruning old data}: For each object O at server S, all versions of O with commitTS $\leq$ S.lowTS are pruned, \textbf{except for one (w/ latest version)} + \item $\text{BeginTx(Consistency level L, key-set KS)}$ + \begin{enumerate} + \item Determine \textbf{readTS(T)} for new Xact T based off L, it determines the snapshot that T accesses for all Get operations. + \item If $\text{Get(k)}$ is serviced by server S, S will return the latest version v of key k at S s.t $\text{v.commitTS} \leq \text{readTS(T)}$ + \item First, compute \textbf{MARTS}: Minimum Acceptable Read Timestamp. As long as $\text{readTS(T)} \leq \text{MARTS(T)}$, L is guaranteed + \item A server S is a \textbf{candidate server} for $\text{Get(k)}$ if + \begin{enumerate} + \item S contains k in its key-range AND + \item Either S is a primary server for k or $\text{highTS[S]}\geq \text{MARTS(T)}$ + \end{enumerate} + \item Among the candidate servers for $\text{Get(k)}$, pick S that minimizes latencies, if tie, maximize $\text{highTS[S]}$. + \item For each $k_i \in KS$, let $S_i$ denote server selected for $\text{Get(k)}$ + \item $\text{readTS(T)} = \min\lbrace \text{highTS[S]} | k_i \in KS\rbrace$ + \end{enumerate} + \item $\text{Get(key)}$ + \begin{enumerate} + \item Becomes $\text{Get(key, readTS(T))}$ to S which is processed as + \item If S is the primary server for key, S accepts request if $\text{readTS(T)}\ge \text{S.lowTS}$, and S updates its logical clock to max of local clock or readTS(T) + \item If S is a secondary server for key, S accepts request if $\text{readTS(T]} \in {[\text{S.lowTS, S.highTS}]}$ + \item If S accepts the request, then S returns $\text{(v, v.commitTS, S.highTS)}$ where $v$ is the most recent version of key in S with $\text{v.commitTS} \leq \text{readTS(T)}$. Otherwise S rejects the Get request + \end{enumerate} + \item \textbf{MARTS}: Minimum Acceptable Read Timestamp + \item \textbf{Strong}: Contains results of all Xacts that committed before start of T. Let $\text{maxTS}(k_i)$ be max ts among all versions of key $k_i$ in the primary server for $k_i$. $\text{MARTS(T)}=\max\lbrace \text{maxTS}(k_i)|k_i\in KS\rbrace$ + \item \textbf{Eventual}: In Pileus, this is equivalent to consistent prefix consistency (all writes up till and including the k-th write). In non-pileus, it is an arbitrary subset of the superset of all tables. $\text{MARTS}=0$. + \item \textbf{Read-my-writes}: $\text{MARTS(T)}$ = max ts of all previously committed Puts for keys accessed by T in current session + \item \textbf{Monotonic Reads}: $\text{MARTS(T)}$ = max ts of all previous Gets (\textbf{any key}, including those not in KS in BeginTx!!!!!!!!!!!!). + \item \textbf{Bounded(t)}: Snapshot contains results of all Xacts committed from start t - deltaT to start of t. $\text{MARTS(T)}$ = \textbf{realTimeToLogicalTime(client's clock time - t)} + \item \textbf{Causal Consistency}: Snapshot contains results of all Xacts that \textbf{causally precede} T. If $T_1 < T_2$ then $\text{commitTS}(T_1) < \text{commitTS}(T_2)$. $\text{MARTS(T)}$ = max ts of all previous Gets and Puts for any key (!!!) in current session + \item \textbf{T1 causally precedes T2} if any of the following hold + \begin{enumerate} + \item $T_2$ is executed after $T_1$ in the same session + \item $T_2$ reads some object written by $T_1$ + \item $T_1$ and $T_2$ both performed a put on the same object and $T_2$ commits after $T_1$ + \item There is some Xact $T_3$ where $T_1 < T_3$ and $T_3 < T_2$ + \end{enumerate} + \item $\text{EndTX}$ + \begin{enumerate} + \item Only primary servers with data updated by T will be participants in the 2PC process, \textbf{commit coordinator} (CC) is among them + \item Client sends a \textbf{commit request} containing: \textbf{readTS(T)}, set of Puts for T (\textbf{Put-set}), largest commit timestamp among all Gets/Puts in the session (\textbf{LCT} to derive commit timestamp and causal consistency). + \item CC partitions Put-Set into $PS_1 \cup \dots \cup PS_n$ where $P_i$ is primary server for keys in $PS_i$. + \item When CC receives commit request from client, CC updates local clock to $\max(\text{local clock timestamp, LCT+1})$. Then sends \textbf{prepare-commit} request to each $P_i$ alongside $PS_i$ + \item When $P_i$ rcvs \textbf{prepare-commit} from CC, $P_i$ sets proposedTimestamp = local clock ts, increments local clock TS, appends $PS_i$ to pending list (list of uncommitted txns) and replies to CC + \item From all proposedTS, CC selects max as \textbf{commitTS(T)} and sends \textbf{commitTS(T)} to all participants + \item Upon receiving \textbf{commitTS(T)} from CC, $P_i$ updates local clock to $\max(\text{local clock timestamp, commit(TS)+1})$, validates whether it can commit T (First updater win?), and sends abort or commit reply + \item if all P voted to commit, CC commits T by writing a \textbf{commit log record} to stable storage (contains commit ts and put-set of T), inform client that T has committed and inform participants + \item When $P_i$ rcv commit decision, $P_i$ processes $PS_i$ by creating new object versions using $\textbf{commitTS(T)}$, appends $PS_i$ to $\textbf{propagating queue}$ (for lazy replication). When $P_i$ has processed $PS_i$ for T, P notifies CC that P has completed T and removes T from pending. Then async updates $PS_i$. + \end{enumerate} +\end{enumerate} + + + +\subsection{10. Raft Consensus} +% Implements consensus through \textbf{replicated state machines (RSM)} to provide fault-tolerant distributed services. Service remains available if a \textbf{majority} of servers are operational and can communicate. Each server maintains one of three states: \textbf{follower} (passive, expects heartbeats), \textbf{candidate} (initiates elections), or \textbf{leader} (handles client requests, manages log replication). + +% \textbf{Terms}: Monotonically increasing integers that mark leadership changes and detect stale leaders. \textit{At most one leader per term}. When a server receives a higher term, it immediately updates its term and reverts to follower state. + +% \textbf{Log entries}: Each entry contains (index, term, command). An entry becomes \textit{committed when replicated on a majority of servers}. When comparing logs, a log is more complete if it has either a \textit{higher last term} or the \textit{same last term but higher index}. + +\subsubsection{Server State} +\textbf{Persistent state} (survives crashes): +\begin{enumerate} + \item \textbf{currentTerm}: Latest term server has seen (initialized to 0) + \item \textbf{votedFor}: CandidateId that received vote in currentTerm (null if none) + \item \textbf{log[]}: Log entries, each containing (index,term,command), first index 1 +\end{enumerate} + +\textbf{Volatile state} (all servers, initialized to 0): +\begin{enumerate} + \item \textbf{commitIndex}: Highest log entry known to be committed + \item \textbf{lastApplied}: Highest log entry applied to state machine +\end{enumerate} + +\textbf{Leader-only volatile state} (reinitialized after election): +\begin{enumerate} + \item \textbf{nextIndex[i]}: For each server, index of next log entry to send + \begin{itemize} + \item Initialized to (leader's last log index + 1) + \item Used to quickly restore log consistency after failures + \end{itemize} + \item \textbf{matchIndex[i]}: For each server, highest replicated log entry + \begin{itemize} + \item Initialized to 0, increases monotonically + \item Used to track commitment progress + \end{itemize} +\end{enumerate} + +\subsubsection{RPCs \& Timers} +\textbf{RequestVote RPC}: +\begin{enumerate} + \item \textbf{Arguments}: + \begin{itemize} + \item candidateId: Candidate requesting vote + \item term: Candidate's term + \item lastLogIndex: Index of candidate's last log entry + \item lastLogTerm: Term of candidate's last log entry + \end{itemize} + \item \textbf{Response}: (term, voteGranted) + \item \textit{Vote granted when}: + \begin{itemize} + \item Candidate's term $\geq$ current term (current term will be updated) + \item Server hasn't voted for different candidate + \item Candidate's log is at least as complete as receiver's + \end{itemize} + \item \textbf{If RPC.term $>$ current term} and did not vote, R.votedFor=null + \item \textbf{If already voted (R.term=currentTerm) and same cand}, return True! +\end{enumerate} + +\textbf{AppendEntries RPC}: +\begin{enumerate} + \item \textbf{Arguments}: + \begin{itemize} + \item leaderId: Current leader's identifier + \item term: Leader's term + \item leaderCommit: Leader's commitIndex + \item prevLogIndex: Index of log entry immediately before new ones + \item prevLogTerm: Term of prevLogIndex entry + \item entries[]: Log entries to store (empty for heartbeat) + \end{itemize} + \item \textbf{Response}: (term,success), term=current term of follower F, success=True if F contain entry matching prevLogIndex n prevLogTerm, false otherwise + \item \textit{Sending by Leader}: + \begin{itemize} + \item Periodically send as heartbeat. entries is empty in this case. + \item Send log entries starting at nextIndex[F] index. Update nextIndex[F] \& matchIndex[F] if success, decrement nextIndex[F] and retry if fail. + \item Update commitIndex to N, s.t. $N > commitIndex$, a majority of $matchIndex[i]\geq N$ and $log[N].term$=currentTerm if N exists + \end{itemize} + \item \textit{Processing by followers}: + \begin{itemize} + \item Reject if leader's term $<$ currentTerm. Else update currentTerm if higher (reflected in response) + \item Reject if log doesn't contain entry at prevLogIndex with prevLogTerm + \item If conflict found, delete existing entry and all that follow + \item Append any new entries not already in log + \item Update commitIndex if leader's is higher (commitIndex=$\min$(leaderCommit,index of last entry in F's log) + \end{itemize} +\end{enumerate} + +\textbf{Timer System}: +\begin{enumerate} + \item \textbf{Election timer}: Random timeout in [T,2T] + \begin{itemize} + \item Reset on valid RPCs from current leader + \item Triggers new election when expired + \end{itemize} + \item \textbf{Leader timer}: Periodic trigger for heartbeats/replication + \item \textbf{Client timer}: Command retry mechanism +\end{enumerate} + +\subsubsection{Leader Election} +\textbf{Election Protocol}: +\begin{enumerate} + \item Follower increments term and becomes candidate when election timer expires + \item Candidate votes for self and sends RequestVote RPCs + \item Upon receiving majority votes, becomes leader and sends heartbeat + \item Reverts to follower if discovers current leader or higher term + \item Starts new election if timer expires before conclusion +\end{enumerate} + +\textbf{Liveness Properties}: +\begin{enumerate} + \item Random timeouts prevent simultaneous candidates + \item Election timeout $\gg$ broadcast RTT ensures stability + \item Term mechanism breaks deadlocks +\end{enumerate} + +\subsubsection{Log Replication} + +X's log is more \textbf{complete} than Y if +\begin{enumerate} + \item X's last log term is greater than Y's, or + \item The terms are equal, and X's last log index is greater +\end{enumerate} +\textbf{Normal Operation}: Leader appends locally and broadcasts via AppendEntries. \\ +\textbf{Commitment Rules}: +A log entry can only be committed through one of two paths, with a crucial \textbf{term-specific constraint}: +\begin{enumerate} + \item \textbf{Direct Commitment}: An entry becomes directly committed only when the leader that created the entry in the current term successfully replicates it to a majority of servers within that same term. \textbf{Simply having an entry appear in a majority of logs is insufficient - the replication must happen by the leader that created it, within its own term.} + + \item \textbf{Indirect Commitment}: When an entry achieves direct commitment, all previous entries in the log automatically become indirectly committed, regardless of their terms. Ensures no gaps in commitment. +\end{enumerate} + +The term-specific requirement for direct commitment prevents scenarios where entries from previous terms that achieved majority replication but weren't fully committed could conflict with newer entries. Once committed through either path, a leader executes the command, responds to client, and notifies followers via AppendEntries. Followers then execute the committed commands in order (increment \textbf{lastApplied} and apply log[lastApplied] to state machine) + +\textbf{Client Interaction}: +Clients contact random server initially and get redirected to leader if needed. Each command includes unique serial number to prevent duplicates, used by leaders to cache responses. If timeout, reidentify leader and resend. + +\textbf{Read Operations}: +Standard approach logs reads as normal entries. Optimized approach allows direct reads after leader commits no-op entry at term start, confirms leadership via heartbeat, and verifies state machine currency. + +\textbf{Consistency Guarantees}: +Same index and term imply identical history (preceding entries). Leaders append only, never overwrite. Committed entries persist in all future leader logs, with no conflicts possible at same index. + +\subsubsection{Example Scenario} +Consider a 5-server cluster with logs: +\begin{verbatim} +Term: 1 2 3 4 5 6 7 +S1: 1 1 2 2 2 2 4 +S2: 1 1 1 3 +S3: 1 1 2 2 2 +S4: 1 +S5: 1 1 2 2 2 2 +\end{verbatim} + +\textbf{Key Observations}: +\begin{enumerate} + \item Entry (1,1) appears in all logs: guaranteed preserved + \item Only S2/S5 qualified as leaders if S1 fails: + \begin{itemize} + \item S4: Log too short + \item S3: Missing entries present in S5 + \item S2: Can overwrite later entries with term 3 + \item S5: Most complete log matching old leader + \end{itemize} + \item Committed entries analysis: + \begin{itemize} + \item (1,1): Never overwritten (universal) + \item (2,1): Required for majority consensus + \item (3,2)-(5,2): Could be overwritten despite majority + \end{itemize} +\end{enumerate} + +\end{multicols*} + +\end{document} \ No newline at end of file