simpledboverview - courses.cs.washington.edu · •achunk of data that can reside in the bufferpool...

17
SimpleDB Overview CSE 444 – Section 1 1

Upload: others

Post on 07-Jun-2020

2 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: SimpleDBOverview - courses.cs.washington.edu · •Achunk of data that can reside in the BufferPool •Format: Header + Tuples •# of 1 bits in Bitmap = # of active tuples on page

SimpleDB OverviewCSE444– Section1

1

Page 2: SimpleDBOverview - courses.cs.washington.edu · •Achunk of data that can reside in the BufferPool •Format: Header + Tuples •# of 1 bits in Bitmap = # of active tuples on page

Today…

• DemoGit/EclipseSetup• GothroughanoverviewofSimpleDB

2

Page 3: SimpleDBOverview - courses.cs.washington.edu · •Achunk of data that can reside in the BufferPool •Format: Header + Tuples •# of 1 bits in Bitmap = # of active tuples on page

LocalRepository/home/jortiz16

GitLab IndividualRepositorygit@.../simple-db-jortiz16

GitLab CourseRepositorygit@.../simple-db

Forked(byus)

Origin RemoteCloned(byyou)

Upstream RemoteAdded(byyou)

git pushgit pull

git pullupstreammaster

Git

3

Page 4: SimpleDBOverview - courses.cs.washington.edu · •Achunk of data that can reside in the BufferPool •Format: Header + Tuples •# of 1 bits in Bitmap = # of active tuples on page

WhatyoushouldNOTdo:

•Modifygivenclasses• Removing,renaming,relocatingtootherpackages

•Modifygivenmethods• Changingparametersorreturntypes

• Usethird-partylibraries• Excepttheonesunderlib/directory• YoucandoeverythingusingregularJavalibraries

4

Page 5: SimpleDBOverview - courses.cs.washington.edu · •Achunk of data that can reside in the BufferPool •Format: Header + Tuples •# of 1 bits in Bitmap = # of active tuples on page

WhatyouCANdo:

• Addnewclasses/interfaces/methods/packages•Watchoutfornameconflictswithfuturelabs!• Saferchoice:usenewpackages(best)orinnerclasses(meh)

• Re-implementprovidedmethods• Justdon’tdestroycorrectnessorspecification!

• Findbugs!

5

Page 6: SimpleDBOverview - courses.cs.washington.edu · •Achunk of data that can reside in the BufferPool •Format: Header + Tuples •# of 1 bits in Bitmap = # of active tuples on page

• Systemtestcases• Undertest/systemtest•We’llgradeusingadditionaltests

•Writeup• Explainwhydoyouimplementinthatway

•We’llreadyourcode• Readinghorriblecodeishorrible,sospendsometimepolishing• Passingallthetestcasesmaynotnecessarymeanyou’llgetahighscore

6

WhatyouCANdo(continued):

Page 7: SimpleDBOverview - courses.cs.washington.edu · •Achunk of data that can reside in the BufferPool •Format: Header + Tuples •# of 1 bits in Bitmap = # of active tuples on page

SettingupSimpleDBAnyquestionsorconcerns?

7

Page 8: SimpleDBOverview - courses.cs.washington.edu · •Achunk of data that can reside in the BufferPool •Format: Header + Tuples •# of 1 bits in Bitmap = # of active tuples on page

OverviewofSimpleDB

8

Page 9: SimpleDBOverview - courses.cs.washington.edu · •Achunk of data that can reside in the BufferPool •Format: Header + Tuples •# of 1 bits in Bitmap = # of active tuples on page

Database

•Asingledatabase• Oneschema• Listoftables

•Referencestomajorcomponents• GlobalinstanceofCatalog• GlobalinstanceofBufferPool

9

Page 10: SimpleDBOverview - courses.cs.washington.edu · •Achunk of data that can reside in the BufferPool •Format: Header + Tuples •# of 1 bits in Bitmap = # of active tuples on page

Catalog

•Storesmetadataabouttablesinthedatabase• voidaddTable(DbFile d,TupleDesc d)• DbFile getTable(int tableid)• TupleDesc getTupleDesc(int tableid)• …

•NOTpersistedtodisk• CataloginfoisreloadedeverytimeSimpleDB startsup

10

Page 11: SimpleDBOverview - courses.cs.washington.edu · •Achunk of data that can reside in the BufferPool •Format: Header + Tuples •# of 1 bits in Bitmap = # of active tuples on page

BufferPool

•TheONLYbridgebetweendata-processingoperatorsandactualdatafiles• Strictinterfaceforphysicalindependence!

•Datafilesareneveraccesseddirectly• Laterlabs:• Lockingfortransactions• Flushingpagesforrecovery

11

Page 12: SimpleDBOverview - courses.cs.washington.edu · •Achunk of data that can reside in the BufferPool •Format: Header + Tuples •# of 1 bits in Bitmap = # of active tuples on page

DataTypes

•Integer• Type.INT_TYPE• 4bytewidth

•Fixed-lengthStrings• Type.STRING_TYPE• 128byteslong(Type.STRING_LEN)• Donotchangethisconstant!

12

Page 13: SimpleDBOverview - courses.cs.washington.edu · •Achunk of data that can reside in the BufferPool •Format: Header + Tuples •# of 1 bits in Bitmap = # of active tuples on page

OpIterator

•Ancestorclassforalloperators• Join,Project,SeqScan,etc…

•Eachoperatorhasmethods:• open(),close(),getTupleDesc(),hasNext(),next(),rewind()

• Iteratormodel:chainiteratorstogether

13

Page 14: SimpleDBOverview - courses.cs.washington.edu · •Achunk of data that can reside in the BufferPool •Format: Header + Tuples •# of 1 bits in Bitmap = # of active tuples on page

HeapFile

•Mainclassthatorganizesthephysicalstorageoftables•CollectionofHeapPages ondisk• OneHeapFile foreachtable• Fixed-sizepagesmeansefficientlookupofpages

HeapPage #1

HeapPage #2

HeapPage #3

14

Page 15: SimpleDBOverview - courses.cs.washington.edu · •Achunk of data that can reside in the BufferPool •Format: Header + Tuples •# of 1 bits in Bitmap = # of active tuples on page

15

Page 16: SimpleDBOverview - courses.cs.washington.edu · •Achunk of data that can reside in the BufferPool •Format: Header + Tuples •# of 1 bits in Bitmap = # of active tuples on page

HeapPage

•A chunkofdatathatcanresideintheBufferPool•Format:Header+Tuples• #of1bitsinBitmap=#ofactivetuplesonpage

•Fixedsize:BufferPool.PAGE_SIZE Header Bitmap

Tuple #1

Tuple #2

.

.

.16

Page 17: SimpleDBOverview - courses.cs.washington.edu · •Achunk of data that can reside in the BufferPool •Format: Header + Tuples •# of 1 bits in Bitmap = # of active tuples on page

Questions?

17