17
SimpleDB Overview CSE 444 – Section 1 1

SimpleDB Overview - courses.cs.washington.edu€¦ · Overview of SimpleDB 8. Database •A single database • One schema • List of tables •References to major components •

  • Upload
    others

  • View
    7

  • Download
    0

Embed Size (px)

Citation preview

Page 1: SimpleDB Overview - courses.cs.washington.edu€¦ · Overview of SimpleDB 8. Database •A single database • One schema • List of tables •References to major components •

SimpleDB OverviewCSE444– Section1

1

Page 2: SimpleDB Overview - courses.cs.washington.edu€¦ · Overview of SimpleDB 8. Database •A single database • One schema • List of tables •References to major components •

Today…

• DemoGit/EclipseSetup• GothroughanoverviewofSimpleDB

2

Page 3: SimpleDB Overview - courses.cs.washington.edu€¦ · Overview of SimpleDB 8. Database •A single database • One schema • List of tables •References to major components •

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: SimpleDB Overview - courses.cs.washington.edu€¦ · Overview of SimpleDB 8. Database •A single database • One schema • List of tables •References to major components •

WhatyoushouldNOTdo:

•Modifygivenclasses• Removing,renaming,relocatingtootherpackages

•Modifygivenmethods• Changingparametersorreturntypes

• Usethird-partylibraries• Excepttheonesunderlib/directory• YoucandoeverythingusingregularJavalibraries

4

Page 5: SimpleDB Overview - courses.cs.washington.edu€¦ · Overview of SimpleDB 8. Database •A single database • One schema • List of tables •References to major components •

WhatyouCANdo:

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

• Re-implementprovidedmethods• Justdon’tdestroycorrectnessorspecification!

• Findbugs!

5

Page 6: SimpleDB Overview - courses.cs.washington.edu€¦ · Overview of SimpleDB 8. Database •A single database • One schema • List of tables •References to major components •

• Systemtestcases• Undertest/systemtest•We’llgradeusingadditionaltests

•Writeup• Explainwhydoyouimplementinthatway

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

6

WhatyouCANdo(continued):

Page 7: SimpleDB Overview - courses.cs.washington.edu€¦ · Overview of SimpleDB 8. Database •A single database • One schema • List of tables •References to major components •

SettingupSimpleDBAnyquestionsorconcerns?

7

Page 8: SimpleDB Overview - courses.cs.washington.edu€¦ · Overview of SimpleDB 8. Database •A single database • One schema • List of tables •References to major components •

OverviewofSimpleDB

8

Page 9: SimpleDB Overview - courses.cs.washington.edu€¦ · Overview of SimpleDB 8. Database •A single database • One schema • List of tables •References to major components •

Database

•Asingledatabase• Oneschema• Listoftables

•Referencestomajorcomponents• GlobalinstanceofCatalog• GlobalinstanceofBufferPool

9

Page 10: SimpleDB Overview - courses.cs.washington.edu€¦ · Overview of SimpleDB 8. Database •A single database • One schema • List of tables •References to major components •

Catalog

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

•NOTpersistedtodisk• CataloginfoisreloadedeverytimeSimpleDB startsup

10

Page 11: SimpleDB Overview - courses.cs.washington.edu€¦ · Overview of SimpleDB 8. Database •A single database • One schema • List of tables •References to major components •

BufferPool

•TheONLYbridgebetweendata-processingoperatorsandactualdatafiles• Strictinterfaceforphysicalindependence!

•Datafilesareneveraccesseddirectly• Laterlabs:• Lockingfortransactions• Flushingpagesforrecovery

11

Page 12: SimpleDB Overview - courses.cs.washington.edu€¦ · Overview of SimpleDB 8. Database •A single database • One schema • List of tables •References to major components •

DataTypes

•Integer• Type.INT_TYPE• 4bytewidth

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

12

Page 13: SimpleDB Overview - courses.cs.washington.edu€¦ · Overview of SimpleDB 8. Database •A single database • One schema • List of tables •References to major components •

DbIterator

•Ancestorclassforalloperators• Join,Project,SeqScan,etc…

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

• Iteratormodel:chainiteratorstogether

13

Page 14: SimpleDB Overview - courses.cs.washington.edu€¦ · Overview of SimpleDB 8. Database •A single database • One schema • List of tables •References to major components •

HeapFile

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

HeapPage #1

HeapPage #2

HeapPage #3

14

Page 15: SimpleDB Overview - courses.cs.washington.edu€¦ · Overview of SimpleDB 8. Database •A single database • One schema • List of tables •References to major components •

15

Page 16: SimpleDB Overview - courses.cs.washington.edu€¦ · Overview of SimpleDB 8. Database •A single database • One schema • List of tables •References to major components •

HeapPage

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

•Fixedsize:BufferPool.PAGE_SIZE Header Bitmap

Tuple #1

Tuple #2

.

.

.16

Page 17: SimpleDB Overview - courses.cs.washington.edu€¦ · Overview of SimpleDB 8. Database •A single database • One schema • List of tables •References to major components •

Questions?

17