Top Banner
Assignment 2 Solution Introduction to Database Systems DataLab CS, NTHU
37

Assignment 2 Solution - GitHub Pages · 2019-06-05 · Assignment 2 Solution Introduction to Database Systems DataLab CS, NTHU. Outline ... (SP/JDBC implementations) •StatisticManager

Mar 13, 2020

Download

Documents

dariahiddleston
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Assignment 2 Solution - GitHub Pages · 2019-06-05 · Assignment 2 Solution Introduction to Database Systems DataLab CS, NTHU. Outline ... (SP/JDBC implementations) •StatisticManager

Assignment 2 Solution

Introduction to Database Systems

DataLab

CS, NTHU

Page 2: Assignment 2 Solution - GitHub Pages · 2019-06-05 · Assignment 2 Solution Introduction to Database Systems DataLab CS, NTHU. Outline ... (SP/JDBC implementations) •StatisticManager

Outline

• UpdateItemPrice transaction (SP/JDBC implementations)

• StatisticManager

• An example of Experiment Results

2

Page 3: Assignment 2 Solution - GitHub Pages · 2019-06-05 · Assignment 2 Solution Introduction to Database Systems DataLab CS, NTHU. Outline ... (SP/JDBC implementations) •StatisticManager

Outline

• UpdateItemPrice transaction (SP/JDBC implementations)

• StatisticManager

• An example of Experiment Results

3

Page 4: Assignment 2 Solution - GitHub Pages · 2019-06-05 · Assignment 2 Solution Introduction to Database Systems DataLab CS, NTHU. Outline ... (SP/JDBC implementations) •StatisticManager

Modified/Added Classes

4

• Shared class– As2BenchTxnType

– As2BenchConstants

• Client-side classes– As2BenchRte

– As2UpdateItemPriceParamGen

– As2BenchJdbcExecutor

– UpdateItemPriceTxnJdbcJob

• Server-side classes– As2BenchStoredProcFactory

– UpdateItemPriceProcParamHelper

– UpdateItemPriceTxnProc

Page 5: Assignment 2 Solution - GitHub Pages · 2019-06-05 · Assignment 2 Solution Introduction to Database Systems DataLab CS, NTHU. Outline ... (SP/JDBC implementations) •StatisticManager

Modified/Added Classes

5

• Shared class– As2BenchTxnType

– As2BenchConstants

• Client-side classes– As2BenchRte

– As2UpdateItemPriceParamGen

– As2BenchJdbcExecutor

– UpdateItemPriceTxnJdbcJob

• Server-side classes– As2BenchStoredProcFactory

– UpdateItemPriceProcParamHelper

– UpdateItemPriceTxnProc

Page 6: Assignment 2 Solution - GitHub Pages · 2019-06-05 · Assignment 2 Solution Introduction to Database Systems DataLab CS, NTHU. Outline ... (SP/JDBC implementations) •StatisticManager

New Transaction Type

6

Page 7: Assignment 2 Solution - GitHub Pages · 2019-06-05 · Assignment 2 Solution Introduction to Database Systems DataLab CS, NTHU. Outline ... (SP/JDBC implementations) •StatisticManager

READ_WRITE_TX_RATE

7

Page 8: Assignment 2 Solution - GitHub Pages · 2019-06-05 · Assignment 2 Solution Introduction to Database Systems DataLab CS, NTHU. Outline ... (SP/JDBC implementations) •StatisticManager

Modified/Added Classes

8

• Shared class– As2BenchTxnType

– As2BenchConstants

• Client-side classes– As2BenchRte

– As2UpdateItemPriceParamGen

– As2BenchJdbcExecutor

– UpdateItemPriceTxnJdbcJob

• Server-side classes– As2BenchStoredProcFactory

– UpdateItemPriceProcParamHelper

– UpdateItemPriceTxnProc

Page 9: Assignment 2 Solution - GitHub Pages · 2019-06-05 · Assignment 2 Solution Introduction to Database Systems DataLab CS, NTHU. Outline ... (SP/JDBC implementations) •StatisticManager

Modified/Added Classes (Shared)

9

• Shared class– As2BenchTxnType

– As2BenchConstants

• Client-side classes– As2BenchRte

– As2UpdateItemPriceParamGen

– As2BenchJdbcExecutor

– UpdateItemPriceTxnJdbcJob

• Server-side classes– As2BenchStoredProcFactory

– UpdateItemPriceProcParamHelper

– UpdateItemPriceTxnProc

Page 10: Assignment 2 Solution - GitHub Pages · 2019-06-05 · Assignment 2 Solution Introduction to Database Systems DataLab CS, NTHU. Outline ... (SP/JDBC implementations) •StatisticManager

Workflow of As2BenchRte

10

execute()

As2BenchRte

getNextTxType()

getTxExecutor()

As2BenchTxExecutor

executeTxn()

SP/JDBC Connection

generateParameter()

As2BenchRte()

As2UpdateItemPriceParamGen

Page 11: Assignment 2 Solution - GitHub Pages · 2019-06-05 · Assignment 2 Solution Introduction to Database Systems DataLab CS, NTHU. Outline ... (SP/JDBC implementations) •StatisticManager

Initialize RTE

11

execute()

callStoredProc()

As2Rte

getNextTxType()

getTxExecutor()

As2TxExecutor

executeTxn()

Connection

generateParameter()

As2UpdateItemPriceParamGen

As2BenchRte()

Page 12: Assignment 2 Solution - GitHub Pages · 2019-06-05 · Assignment 2 Solution Introduction to Database Systems DataLab CS, NTHU. Outline ... (SP/JDBC implementations) •StatisticManager

Initialize RTE

12

Page 13: Assignment 2 Solution - GitHub Pages · 2019-06-05 · Assignment 2 Solution Introduction to Database Systems DataLab CS, NTHU. Outline ... (SP/JDBC implementations) •StatisticManager

Choose a Transaction

13

execute()

callStoredProc()

As2BenchRte

getNextTxType()

getTxExecutor()

As2TxExecutor

executeTxn()

Connection

generateParameter()

As2RTE()

As2UpdateItemParamGen

Page 14: Assignment 2 Solution - GitHub Pages · 2019-06-05 · Assignment 2 Solution Introduction to Database Systems DataLab CS, NTHU. Outline ... (SP/JDBC implementations) •StatisticManager

Choose a Transaction

14

Page 15: Assignment 2 Solution - GitHub Pages · 2019-06-05 · Assignment 2 Solution Introduction to Database Systems DataLab CS, NTHU. Outline ... (SP/JDBC implementations) •StatisticManager

Generate and Send Parameters

15

execute()

As2BenchRte

getNextTxType()

getTxExecutor()

As2BenchTxExecutor

executeTxn()

SP/JDBC Connection

generateParameter()

As2BenchRte()

As2UpdateItemPriceParamGen

Page 16: Assignment 2 Solution - GitHub Pages · 2019-06-05 · Assignment 2 Solution Introduction to Database Systems DataLab CS, NTHU. Outline ... (SP/JDBC implementations) •StatisticManager

Generate Parameters

16

Page 17: Assignment 2 Solution - GitHub Pages · 2019-06-05 · Assignment 2 Solution Introduction to Database Systems DataLab CS, NTHU. Outline ... (SP/JDBC implementations) •StatisticManager

Modified/Added Classes (SP)

17

• Shared class– As2BenchTxnType

– As2BenchConstants

• Client-side classes– As2BenchRte

– As2UpdateItemPriceParamGen

– As2BenchJdbcExecutor

– UpdateItemPriceTxnJdbcJob

• Server-side classes– As2BenchStoredProcFactory

– UpdateItemPriceProcParamHelper

– UpdateItemPriceTxnProc

Page 18: Assignment 2 Solution - GitHub Pages · 2019-06-05 · Assignment 2 Solution Introduction to Database Systems DataLab CS, NTHU. Outline ... (SP/JDBC implementations) •StatisticManager

Inquiry via SP

18

execute()

As2BenchRte

getNextTxType()

getTxExecutor()

As2BenchTxExecutor

executeTxn()generateParameter()

As2BenchRte()

As2UpdateItemPriceParamGen

callStoredProc()

Connection

Page 19: Assignment 2 Solution - GitHub Pages · 2019-06-05 · Assignment 2 Solution Introduction to Database Systems DataLab CS, NTHU. Outline ... (SP/JDBC implementations) •StatisticManager

Execute a Stored Procedure

19

prepare()

execute()

executeSql()

UpdateItemPriceTxnProc

prepareParameters()

UpdateItemPriceProcParamHelper

getStoredProcedure()

As2BenchStoredProcFactory

createResultSet()

Page 20: Assignment 2 Solution - GitHub Pages · 2019-06-05 · Assignment 2 Solution Introduction to Database Systems DataLab CS, NTHU. Outline ... (SP/JDBC implementations) •StatisticManager

Get the Specified SP

20

prepare()

execute()

executeSql()

UpdateItemPriceTxnProc

prepareParameters()

UpdateItemPriceProcParamHelper

getStoredProcedure()

As2BenchStoredProcFactory

createResultSet()

Page 21: Assignment 2 Solution - GitHub Pages · 2019-06-05 · Assignment 2 Solution Introduction to Database Systems DataLab CS, NTHU. Outline ... (SP/JDBC implementations) •StatisticManager

Get the Specified SP

21

Page 22: Assignment 2 Solution - GitHub Pages · 2019-06-05 · Assignment 2 Solution Introduction to Database Systems DataLab CS, NTHU. Outline ... (SP/JDBC implementations) •StatisticManager

Preprocess Parameters

22

prepare()

execute()

executeSql()

UpdateItemPriceTxnProc

prepareParameters()

UpdateItemPriceProcParamHelper

getStoredProcedure()

As2BenchStoredProcFactory

createResultSet()

Page 23: Assignment 2 Solution - GitHub Pages · 2019-06-05 · Assignment 2 Solution Introduction to Database Systems DataLab CS, NTHU. Outline ... (SP/JDBC implementations) •StatisticManager

Preprocess Parameters

23

Page 24: Assignment 2 Solution - GitHub Pages · 2019-06-05 · Assignment 2 Solution Introduction to Database Systems DataLab CS, NTHU. Outline ... (SP/JDBC implementations) •StatisticManager

Execute Queries

24

prepare()

execute()

executeSql()

UpdateItemPriceTxnProc

prepareParameters()

UpdateItemPriceProcParamHelper

getStoredProcedure()

As2BenchStoredProcFactory

createResultSet()

Page 25: Assignment 2 Solution - GitHub Pages · 2019-06-05 · Assignment 2 Solution Introduction to Database Systems DataLab CS, NTHU. Outline ... (SP/JDBC implementations) •StatisticManager

Execute Queries

25

Page 26: Assignment 2 Solution - GitHub Pages · 2019-06-05 · Assignment 2 Solution Introduction to Database Systems DataLab CS, NTHU. Outline ... (SP/JDBC implementations) •StatisticManager

Modified/Added Classes (JDBC)

26

• Shared class– As2BenchTxnType

– As2BenchConstants

• Client-side classes– As2BenchRte

– As2UpdateItemPriceParamGen

– As2BenchJdbcExecutor

– UpdateItemPriceTxnJdbcJob

• Server-side classes– As2BenchStoredProcFactory

– UpdateItemPriceProcParamHelper

– UpdateItemPriceTxnProc

Page 27: Assignment 2 Solution - GitHub Pages · 2019-06-05 · Assignment 2 Solution Introduction to Database Systems DataLab CS, NTHU. Outline ... (SP/JDBC implementations) •StatisticManager

Inquiry via SP

27

execute()

As2BenchRte

getNextTxType()

getTxExecutor()

As2BenchTxExecutor

executeTxn()generateParameter()

As2BenchRte()

As2UpdateItemPriceParamGen

callStoredProc()

Connection

Page 28: Assignment 2 Solution - GitHub Pages · 2019-06-05 · Assignment 2 Solution Introduction to Database Systems DataLab CS, NTHU. Outline ... (SP/JDBC implementations) •StatisticManager

Inquiry via JDBC

28

execute()

As2BenchRte

getNextTxType()

getTxExecutor()

As2BenchTxExecutor

executeTxn()generateParameter()

As2BenchRte()

As2UpdateItemPriceParamGen

execute()

As2JdbcExecutor

execute()

As2UpdateItemJob

Page 29: Assignment 2 Solution - GitHub Pages · 2019-06-05 · Assignment 2 Solution Introduction to Database Systems DataLab CS, NTHU. Outline ... (SP/JDBC implementations) •StatisticManager

Inquiry via JDBC

29

execute()

As2BenchRte

getNextTxType()

getTxExecutor()

As2BenchTxExecutor

executeTxn()generateParameter()

As2BenchRte()

As2UpdateItemPriceParamGen

execute()

As2JdbcExecutor

execute()

As2UpdateItemJob

Page 30: Assignment 2 Solution - GitHub Pages · 2019-06-05 · Assignment 2 Solution Introduction to Database Systems DataLab CS, NTHU. Outline ... (SP/JDBC implementations) •StatisticManager

Inquiry via JDBC

30

Page 31: Assignment 2 Solution - GitHub Pages · 2019-06-05 · Assignment 2 Solution Introduction to Database Systems DataLab CS, NTHU. Outline ... (SP/JDBC implementations) •StatisticManager

31

Execute Queries

Page 32: Assignment 2 Solution - GitHub Pages · 2019-06-05 · Assignment 2 Solution Introduction to Database Systems DataLab CS, NTHU. Outline ... (SP/JDBC implementations) •StatisticManager

Outline

• UpdateItemPrice transaction (SP/JDBC implementations)

• StatisticManager

• An example of Experiment Results

32

Page 33: Assignment 2 Solution - GitHub Pages · 2019-06-05 · Assignment 2 Solution Introduction to Database Systems DataLab CS, NTHU. Outline ... (SP/JDBC implementations) •StatisticManager

Modified Class

33

• StatisticMgr

Page 34: Assignment 2 Solution - GitHub Pages · 2019-06-05 · Assignment 2 Solution Introduction to Database Systems DataLab CS, NTHU. Outline ... (SP/JDBC implementations) •StatisticManager

Latency History

34

(0, [145, 27, 33, …])(5, [23, 11, 150, …])(10, [28, 16, 50, …])…

Page 35: Assignment 2 Solution - GitHub Pages · 2019-06-05 · Assignment 2 Solution Introduction to Database Systems DataLab CS, NTHU. Outline ... (SP/JDBC implementations) •StatisticManager

35

(0, [145, 27, 33, …])(5, [23, 11, 150, …])(10, [28, 16, 50, …])…

Page 36: Assignment 2 Solution - GitHub Pages · 2019-06-05 · Assignment 2 Solution Introduction to Database Systems DataLab CS, NTHU. Outline ... (SP/JDBC implementations) •StatisticManager

Outline

• UpdateItemPrice transaction (SP/JDBC implementations)

• StatisticManager

• An example of Experiment Results

36

Page 37: Assignment 2 Solution - GitHub Pages · 2019-06-05 · Assignment 2 Solution Introduction to Database Systems DataLab CS, NTHU. Outline ... (SP/JDBC implementations) •StatisticManager

An Example of Experiments

37