Database Recovery Mechanism For Android Devices Pratik Patodi M. - - PowerPoint PPT Presentation

database recovery mechanism for android devices
SMART_READER_LITE
LIVE PREVIEW

Database Recovery Mechanism For Android Devices Pratik Patodi M. - - PowerPoint PPT Presentation

Outline Introduction Literature survey Shadow Paging Adaptive Logging Conclusion and Future Work References Database Recovery Mechanism For Android Devices Pratik Patodi M. Tech Project under the guidance of Prof. Deepak B. Phatak


slide-1
SLIDE 1

Outline Introduction Literature survey Shadow Paging Adaptive Logging Conclusion and Future Work References

Database Recovery Mechanism For Android Devices

Pratik Patodi

  • M. Tech Project

under the guidance of

  • Prof. Deepak B. Phatak

Computer Science & Engineering Indian Institute of Technology, Bombay

Nov 3, 2012

Database Recovery Mechanism For Android Devices 1

slide-2
SLIDE 2

Outline Introduction Literature survey Shadow Paging Adaptive Logging Conclusion and Future Work References

1 Introduction

Android Motivation Problem Scope

2 Literature survey

Rollback Journal Write Ahead Logging

3 Shadow Paging

Overview Challenges

4 Adaptive Logging

Working

5 Conclusion and Future Work 6 References

Outline Database Recovery Mechanism For Android Devices 2

slide-3
SLIDE 3

Outline Introduction Literature survey Shadow Paging Adaptive Logging Conclusion and Future Work References Outline Database Recovery Mechanism For Android Devices 3

slide-4
SLIDE 4

Introduction

slide-5
SLIDE 5

Outline Introduction Literature survey Shadow Paging Adaptive Logging Conclusion and Future Work References

Introduction

“What is Android?”

  • An Open Source Operating System based upon the Linux kernel 2.6

provides[Bhu10]:

  • Comprehensive Library Set.
  • Multimedia User Interface.
  • Phone Application.

Introduction Database Recovery Mechanism For Android Devices 5

slide-6
SLIDE 6

Outline Introduction Literature survey Shadow Paging Adaptive Logging Conclusion and Future Work References

Introduction

“What is Android?”

  • An Open Source Operating System based upon the Linux kernel 2.6

provides[Bhu10]:

  • Comprehensive Library Set.
  • Multimedia User Interface.
  • Phone Application.
  • It consists of 4 layers:
  • Linux Kernel.
  • Libraries and Android Runtime.
  • Application Framework.
  • Applications.

Introduction Database Recovery Mechanism For Android Devices 5

slide-7
SLIDE 7

Outline Introduction Literature survey Shadow Paging Adaptive Logging Conclusion and Future Work References

Android Architecture

Figure: System Architecture [Arc]

Introduction Database Recovery Mechanism For Android Devices 6

slide-8
SLIDE 8

Outline Introduction Literature survey Shadow Paging Adaptive Logging Conclusion and Future Work References

Introduction

“DataBase”

  • Need of DataBase:
  • Android- Open Source.
  • Applications require to store and update data.
  • Manage Data Efficiently - DataBase.

Introduction Database Recovery Mechanism For Android Devices 7

slide-9
SLIDE 9

Outline Introduction Literature survey Shadow Paging Adaptive Logging Conclusion and Future Work References

Introduction

“DataBase”

  • Need of DataBase:
  • Android- Open Source.
  • Applications require to store and update data.
  • Manage Data Efficiently - DataBase.
  • Requirements of Database[Nor07]:
  • Embeddable in applications.
  • Small footprint.
  • In-Memory DBMS.
  • No code in the database.

Introduction Database Recovery Mechanism For Android Devices 7

slide-10
SLIDE 10

Outline Introduction Literature survey Shadow Paging Adaptive Logging Conclusion and Future Work References

Introduction

  • SQLite
  • Native Android Database.
  • Executes SQL like commands.
  • Provides Rollback Journal and Write ahead logging.

(Update-in-place)

Introduction Database Recovery Mechanism For Android Devices 8

slide-11
SLIDE 11

Outline Introduction Literature survey Shadow Paging Adaptive Logging Conclusion and Future Work References

Introduction

  • SQLite
  • Native Android Database.
  • Executes SQL like commands.
  • Provides Rollback Journal and Write ahead logging.

(Update-in-place)

  • Flash memory
  • Internal + External
  • Non-volatile, shock-resistant, and uses little power.
  • Rewrite = Erase + Write.
  • Fixed number of writes.

Introduction Database Recovery Mechanism For Android Devices 8

slide-12
SLIDE 12

Outline Introduction Literature survey Shadow Paging Adaptive Logging Conclusion and Future Work References

Introduction

“Motivation”

Introduction Database Recovery Mechanism For Android Devices 9

slide-13
SLIDE 13

Outline Introduction Literature survey Shadow Paging Adaptive Logging Conclusion and Future Work References

Problem Scope

Aim Replace update-in-place technique update-out-of-place for Android devices.

  • Update-in-place: Technique in which data is updated in the same

place where it is stored.

  • Update-out-of-place: Technique in which data is updated in the

copy of the original page. Technique Shadow paging

Introduction Database Recovery Mechanism For Android Devices 10

slide-14
SLIDE 14

Literature survey

slide-15
SLIDE 15

Outline Introduction Literature survey Shadow Paging Adaptive Logging Conclusion and Future Work References

Rollback Journal

“Initial State”

Figure: Initial State [Ato]

Literature survey Database Recovery Mechanism For Android Devices 12

slide-16
SLIDE 16

Outline Introduction Literature survey Shadow Paging Adaptive Logging Conclusion and Future Work References

Rollback Journal

“Acquiring A Read Lock”

Figure: Acquiring A Read Lock [Ato]

Literature survey Database Recovery Mechanism For Android Devices 13

slide-17
SLIDE 17

Outline Introduction Literature survey Shadow Paging Adaptive Logging Conclusion and Future Work References

Rollback Journal

“Reading Information Out Of The Database”

Figure: Reading Information Out Of The Database [Ato]

Literature survey Database Recovery Mechanism For Android Devices 14

slide-18
SLIDE 18

Outline Introduction Literature survey Shadow Paging Adaptive Logging Conclusion and Future Work References

Rollback Journal

“Obtaining A Reserved Lock”

Figure: Obtaining A Reserved Lock [Ato]

Literature survey Database Recovery Mechanism For Android Devices 15

slide-19
SLIDE 19

Outline Introduction Literature survey Shadow Paging Adaptive Logging Conclusion and Future Work References

Rollback Journal

“Creating A Rollback Journal File”

Figure: Rollback Journal [Ato]

Literature survey Database Recovery Mechanism For Android Devices 16

slide-20
SLIDE 20

Outline Introduction Literature survey Shadow Paging Adaptive Logging Conclusion and Future Work References

Rollback Journal

“Changing Database Pages In User Space”

Figure: Changing Database Pages In User Space[Ato]

Literature survey Database Recovery Mechanism For Android Devices 17

slide-21
SLIDE 21

Outline Introduction Literature survey Shadow Paging Adaptive Logging Conclusion and Future Work References

Rollback Journal

“Flushing The Rollback Journal File To Mass Storage”

Figure: Flushing The Rollback Journal File To Mass Storage[Ato]

Literature survey Database Recovery Mechanism For Android Devices 18

slide-22
SLIDE 22

Outline Introduction Literature survey Shadow Paging Adaptive Logging Conclusion and Future Work References

Rollback Journal

“Obtaining An Exclusive Lock”

Figure: Obtaining An Exclusive Lock [Ato]

Literature survey Database Recovery Mechanism For Android Devices 19

slide-23
SLIDE 23

Outline Introduction Literature survey Shadow Paging Adaptive Logging Conclusion and Future Work References

Rollback Journal

“Writing Changes To The Database File”

Figure: Writing Changes To The Database File [Ato]

Literature survey Database Recovery Mechanism For Android Devices 20

slide-24
SLIDE 24

Outline Introduction Literature survey Shadow Paging Adaptive Logging Conclusion and Future Work References

Rollback Journal

“Flushing Changes To Mass Storage”

Figure: Flushing Changes To Mass Storage [Ato]

Literature survey Database Recovery Mechanism For Android Devices 21

slide-25
SLIDE 25

Outline Introduction Literature survey Shadow Paging Adaptive Logging Conclusion and Future Work References

Rollback Journal

“Deleting The Rollback Journal”

Figure: Deleting The Rollback Journal [Ato]

Literature survey Database Recovery Mechanism For Android Devices 22

slide-26
SLIDE 26

Outline Introduction Literature survey Shadow Paging Adaptive Logging Conclusion and Future Work References

Rollback Journal

“Releasing The Lock”

Figure: Releasing The Lock [Ato]

Literature survey Database Recovery Mechanism For Android Devices 23

slide-27
SLIDE 27

Outline Introduction Literature survey Shadow Paging Adaptive Logging Conclusion and Future Work References

Rollback

“When Something Goes Wrong...”

Figure: When Something Goes Wrong... [Ato]

Literature survey Database Recovery Mechanism For Android Devices 24

slide-28
SLIDE 28

Outline Introduction Literature survey Shadow Paging Adaptive Logging Conclusion and Future Work References

Rollback

“Hot Rollback Journals”

Figure: Hot Rollback Journals [Ato]

Literature survey Database Recovery Mechanism For Android Devices 25

slide-29
SLIDE 29

Outline Introduction Literature survey Shadow Paging Adaptive Logging Conclusion and Future Work References

Rollback

“Obtaining An Exclusive Lock On The Database”

Figure: Obtaining An Exclusive Lock On The Database [Ato]

Literature survey Database Recovery Mechanism For Android Devices 26

slide-30
SLIDE 30

Outline Introduction Literature survey Shadow Paging Adaptive Logging Conclusion and Future Work References

Rollback

“Rolling Back Incomplete Changes”

Figure: Rolling Back Incomplete Changes [Ato]

Literature survey Database Recovery Mechanism For Android Devices 27

slide-31
SLIDE 31

Outline Introduction Literature survey Shadow Paging Adaptive Logging Conclusion and Future Work References

Rollback

“Deleting The Hot Journal”

Figure: Deleting The Hot Journal [Ato]

Literature survey Database Recovery Mechanism For Android Devices 28

slide-32
SLIDE 32

Outline Introduction Literature survey Shadow Paging Adaptive Logging Conclusion and Future Work References

Rollback

“Continue As If The Uncompleted Writes Had Never Happened”

Figure: Continue As If The Uncompleted Writes Had Never Happened [Ato]

Literature survey Database Recovery Mechanism For Android Devices 29

slide-33
SLIDE 33

Outline Introduction Literature survey Shadow Paging Adaptive Logging Conclusion and Future Work References

Write Ahead Logging

How Write Ahead Logging(WAL) works

  • WAL is opposite of Rollback Journal[WAL]
  • Original content are not modified.
  • Logs are written in separate WAL file.

Literature survey Database Recovery Mechanism For Android Devices 30

slide-34
SLIDE 34

Outline Introduction Literature survey Shadow Paging Adaptive Logging Conclusion and Future Work References

Write Ahead Logging

How Write Ahead Logging(WAL) works

  • WAL is opposite of Rollback Journal[WAL]
  • Original content are not modified.
  • Logs are written in separate WAL file.
  • Checkpoint
  • Size of WAL file >threshold
  • Original file is updated.

(update-in-place)

Literature survey Database Recovery Mechanism For Android Devices 30

slide-35
SLIDE 35

Shadow Paging

slide-36
SLIDE 36

Outline Introduction Literature survey Shadow Paging Adaptive Logging Conclusion and Future Work References

Shadow Paging

How Shadow Paging works

  • A copy of the original page is being created,shadow page.

Shadow Paging Database Recovery Mechanism For Android Devices 32

slide-37
SLIDE 37

Outline Introduction Literature survey Shadow Paging Adaptive Logging Conclusion and Future Work References

Shadow Paging

How Shadow Paging works

  • A copy of the original page is being created,shadow page.
  • All updates in shadow page.

Shadow Paging Database Recovery Mechanism For Android Devices 32

slide-38
SLIDE 38

Outline Introduction Literature survey Shadow Paging Adaptive Logging Conclusion and Future Work References

Shadow Paging

How Shadow Paging works

  • A copy of the original page is being created,shadow page.
  • All updates in shadow page.
  • Transaction is said to be COMMITTED, when the pointers are

modified.[Lor77]

Shadow Paging Database Recovery Mechanism For Android Devices 32

slide-39
SLIDE 39

Outline Introduction Literature survey Shadow Paging Adaptive Logging Conclusion and Future Work References

Shadow Paging

How Shadow Paging works

  • A copy of the original page is being created,shadow page.
  • All updates in shadow page.
  • Transaction is said to be COMMITTED, when the pointers are

modified.[Lor77]

  • Failure before COMMIT-shadow page is ignored.

Shadow Paging Database Recovery Mechanism For Android Devices 32

slide-40
SLIDE 40

Outline Introduction Literature survey Shadow Paging Adaptive Logging Conclusion and Future Work References

Shadow Paging

How Shadow Paging works

  • A copy of the original page is being created,shadow page.
  • All updates in shadow page.
  • Transaction is said to be COMMITTED, when the pointers are

modified.[Lor77]

  • Failure before COMMIT-shadow page is ignored.
  • Failure after COMMIT- database already consistent.

Shadow Paging Database Recovery Mechanism For Android Devices 32

slide-41
SLIDE 41

Outline Introduction Literature survey Shadow Paging Adaptive Logging Conclusion and Future Work References

Shadow Paging

Shadow Paging Database Recovery Mechanism For Android Devices 33

slide-42
SLIDE 42

Outline Introduction Literature survey Shadow Paging Adaptive Logging Conclusion and Future Work References

Shadow Paging

Benefits of Shadow Paging

  • Overcome Flash Memory constraints.
  • Update-out-of-place.

Shadow Paging Database Recovery Mechanism For Android Devices 34

slide-43
SLIDE 43

Outline Introduction Literature survey Shadow Paging Adaptive Logging Conclusion and Future Work References

Shadow Paging

Benefits of Shadow Paging

  • Overcome Flash Memory constraints.
  • Update-out-of-place.
  • Simple and Fast.
  • No log is needed.
  • No need to “read and then write”.

Shadow Paging Database Recovery Mechanism For Android Devices 34

slide-44
SLIDE 44

Outline Introduction Literature survey Shadow Paging Adaptive Logging Conclusion and Future Work References

Challenges

Distorted file structure Solution: On flash memory, data location is not important than data access speed.[BCH05] Extra Space Required Solution: A free list can be maintained, Once transaction is committed the original page should be added in free list. storing log records is not required. Large Number of Small Updates Solution: Use Adaptive logging.

Shadow Paging Database Recovery Mechanism For Android Devices 35

slide-45
SLIDE 45

Adaptive Logging

slide-46
SLIDE 46

Outline Introduction Literature survey Shadow Paging Adaptive Logging Conclusion and Future Work References

Adaptive Logging

Overview

  • A-type update.

Adaptive Logging Database Recovery Mechanism For Android Devices 37

slide-47
SLIDE 47

Outline Introduction Literature survey Shadow Paging Adaptive Logging Conclusion and Future Work References

Adaptive Logging

Overview

  • A-type update.
  • S-type update.

Adaptive Logging Database Recovery Mechanism For Android Devices 37

slide-48
SLIDE 48

Outline Introduction Literature survey Shadow Paging Adaptive Logging Conclusion and Future Work References

Adaptive Logging

Overview

  • A-type update.
  • S-type update.
  • Default technique: Log-based.

Adaptive Logging Database Recovery Mechanism For Android Devices 37

slide-49
SLIDE 49

Outline Introduction Literature survey Shadow Paging Adaptive Logging Conclusion and Future Work References

Adaptive Logging

Overview

  • A-type update.
  • S-type update.
  • Default technique: Log-based.
  • Log size >Threshold, Switch to Shadow paging.

Adaptive Logging Database Recovery Mechanism For Android Devices 37

slide-50
SLIDE 50

Outline Introduction Literature survey Shadow Paging Adaptive Logging Conclusion and Future Work References

Adaptive Logging

Figure: Two Update Pattern [KJW10]

Adaptive Logging Database Recovery Mechanism For Android Devices 38

slide-51
SLIDE 51

Conclusion and Future Work

slide-52
SLIDE 52

Outline Introduction Literature survey Shadow Paging Adaptive Logging Conclusion and Future Work References

Conclusion and Future Work

Conclusion

  • Android Operating System provides a native database engine,

SQLite.

Conclusion and Future Work Database Recovery Mechanism For Android Devices 40

slide-53
SLIDE 53

Outline Introduction Literature survey Shadow Paging Adaptive Logging Conclusion and Future Work References

Conclusion and Future Work

Conclusion

  • Android Operating System provides a native database engine,

SQLite.

  • SQLite uses rollback journal and write ahead logging.

Conclusion and Future Work Database Recovery Mechanism For Android Devices 40

slide-54
SLIDE 54

Outline Introduction Literature survey Shadow Paging Adaptive Logging Conclusion and Future Work References

Conclusion and Future Work

Conclusion

  • Android Operating System provides a native database engine,

SQLite.

  • SQLite uses rollback journal and write ahead logging.
  • Shadow paging is better for flash memory.

Conclusion and Future Work Database Recovery Mechanism For Android Devices 40

slide-55
SLIDE 55

Outline Introduction Literature survey Shadow Paging Adaptive Logging Conclusion and Future Work References

Conclusion and Future Work

Conclusion

  • Android Operating System provides a native database engine,

SQLite.

  • SQLite uses rollback journal and write ahead logging.
  • Shadow paging is better for flash memory.
  • To further optimize use adaptive logging.

Conclusion and Future Work Database Recovery Mechanism For Android Devices 40

slide-56
SLIDE 56

Outline Introduction Literature survey Shadow Paging Adaptive Logging Conclusion and Future Work References

Conclusion and Future Work

Future Work

  • Short term goal

Implement shadow paging in SQLite.

Conclusion and Future Work Database Recovery Mechanism For Android Devices 41

slide-57
SLIDE 57

Outline Introduction Literature survey Shadow Paging Adaptive Logging Conclusion and Future Work References

Conclusion and Future Work

Future Work

  • Short term goal

Implement shadow paging in SQLite.

  • Long term goal

Implement adaptive logging.

Conclusion and Future Work Database Recovery Mechanism For Android Devices 41

slide-58
SLIDE 58

Outline Introduction Literature survey Shadow Paging Adaptive Logging Conclusion and Future Work References

References I

Android Architecture. http://http://www.elinux.org/Android Architecture. [Online; accessed 3-Oct-2012]. Roolback Journal. http://www.sqlite.org/draft/atomiccommit.html. [Online; accessed 3-Oct-2012]. Siwoo Byun, Seongyun Cho, and Moonhaeng Huh. Flash memory shadow paging scheme for portable computers: Design and performance evaluation. ACM Trans. Database Syst., 39(3), October 2005. Vijay K. Madisetti Bhupinder S. Mongia. Reliable real-time applications on android os. http://www.ece.gatech.edu/~vkm/Android_Real_Time.pdf, 2010. Young-Seok Kim, Heegyu Jin, and Kyoung-Gu Woo. Adaptive logging for mobile device.

  • Proc. VLDB Endow., 3(1-2):1481–1492, September 2010.

Raymond A. Lorie. Physical integrity in a large segmented database. ACM Trans. Database Syst., 2(1):91–104, March 1977. Anil Nori. Mobile and embedded databases. In Proceedings of the 2007 ACM SIGMOD international conference on Management of data, SIGMOD ’07, pages 1175–1177, New York, NY, USA, 2007. ACM. References Database Recovery Mechanism For Android Devices 42

slide-59
SLIDE 59

Outline Introduction Literature survey Shadow Paging Adaptive Logging Conclusion and Future Work References

References II

Write-Ahead Logging. http://www.sqlite.org/draft/wal.html. [Online; accessed 3-Oct-2012]. References Database Recovery Mechanism For Android Devices 43

slide-60
SLIDE 60

Outline Introduction Literature survey Shadow Paging Adaptive Logging Conclusion and Future Work References

Architecture

Figure: Architecture [BCH05]

References Database Recovery Mechanism For Android Devices 44