Transcript
Page 1: Hot or  Not? How  to Release Changes Without Impacting Customers

CONFIDENTIAL and not for reproduction without prior written consent. © of The Sporting Exchange Limited.

David Webster

HOT OR NOT?HOW TO RELEASE CHANGES WITHOUT IMPACTING CUSTOMERS

April 2014

Page 2: Hot or  Not? How  to Release Changes Without Impacting Customers

CONFIDENTIAL and not for reproduction without prior written consent. © of The Sporting Exchange Limited.

WHAT IS THIS SESSION NOT ABOUT?

2

Page 3: Hot or  Not? How  to Release Changes Without Impacting Customers

CONFIDENTIAL and not for reproduction without prior written consent. © of The Sporting Exchange Limited.

WHAT THIS SESSION IS ABOUT?

3

HOW DO WE MAKE CODE AND TABLE CHANGES TO AN ORACLE DATABASE WITHOUT IMPACTING ANY OF THE USERS?

HOW DO WE DO THAT EVEN ON A REALLY COMPLEX DATABASE WITH 1000S OF USERS/SESSIONS?

Page 4: Hot or  Not? How  to Release Changes Without Impacting Customers

CONFIDENTIAL and not for reproduction without prior written consent. © of The Sporting Exchange Limited.

WHAT IS THIS SESSION ABOUT, SPECIFICALLY?

4

• Why put code in the DB?• How to change that code while the DB

is active.• Under what circumstances is that

challenging? (24x7, high executions, daemons, DB Links, dependencies)

• What can we do about it?

• ELEPHANT IN THE ROOM : EDITIONS

Page 5: Hot or  Not? How  to Release Changes Without Impacting Customers

CONFIDENTIAL and not for reproduction without prior written consent. © of The Sporting Exchange Limited.

JUST BEFORE I START….

5

ALL TESTS ARE ON 11.2.0.3

HOT OR NOT….

HOT DOESN’T MEAN HOT, COLD DOESN’T MEAN COLD

Page 6: Hot or  Not? How  to Release Changes Without Impacting Customers

CONFIDENTIAL and not for reproduction without prior written consent. © of The Sporting Exchange Limited.

ABOUT BETFAIR

6

Page 7: Hot or  Not? How  to Release Changes Without Impacting Customers

CONFIDENTIAL and not for reproduction without prior written consent. © of The Sporting Exchange Limited.

ABOUT BETFAIR

7

PIONEERED ONLINE PERSON-TO-PERSON BETTING. BETFAIR IS THE BROKER, THE EBAY OF BETTING, NOT THE “HOUSE”

COMPANY STARTED IN 1999 WITH 2 FOUNDERS

OVER 1500 EMPLOYEES ACROSS THE WORLD

DATA CENTRES ACROSS EUROPE, IN AUSTRALIA AND US

FULL OFFERING OF BETTING PRODUCTS, INCLUDING SPORTSBOOK, POKER, CASINO AND ARCADE.

Page 8: Hot or  Not? How  to Release Changes Without Impacting Customers

CONFIDENTIAL and not for reproduction without prior written consent. © of The Sporting Exchange Limited.

ABOUT DAVID WEBSTER

8

15 YEARS WORKING WITH ORACLE

SITE RELIABILITY ENGINEER – ORACLE PERFORMANCE

BLOG : HTTP://ANOTHERDAVEWEBSTER.WORDPRESS.COM/

Page 9: Hot or  Not? How  to Release Changes Without Impacting Customers

CONFIDENTIAL and not for reproduction without prior written consent. © of The Sporting Exchange Limited.

WHY PUT CODE IN THE DATABASE?

9

• CENTRALISED LOGIC AND VERSIONING (I KNOW…)

• PL/SQL APIS. ABSTRACTION AND ENCAPSULATION

• PERFORMANCE

• DEPENDENCY TRACKING

• OTHERS……

Page 10: Hot or  Not? How  to Release Changes Without Impacting Customers

CONFIDENTIAL and not for reproduction without prior written consent. © of The Sporting Exchange Limited.

WHY SHOULD I NOT PUT CODE IN THE DATABASE?

10

• PERFORMANCE…..DIGRESSION ALERT!!!PREFETCH & READ CONSISTENCY

• MAKES RELEASING CODE MORE DIFFICULT!

Page 11: Hot or  Not? How  to Release Changes Without Impacting Customers

CONFIDENTIAL and not for reproduction without prior written consent. © of The Sporting Exchange Limited.

WHAT MAKES OUR EXCHANGE A COMPLEX DB?

11

1. IT’S 4 DATABASES

2. OVER 100K EXECUTIONS A SECOND

3. 1000S OF SESSIONS, 100S OF CLIENTS

4. LOTS AND LOTS OF CODE

5. BACKGROUND JOBS

6. 24X7 OPERATION

Page 12: Hot or  Not? How  to Release Changes Without Impacting Customers

CONFIDENTIAL and not for reproduction without prior written consent. © of The Sporting Exchange Limited.

(RE)COMPILING PACKAGES

12

Q : WHAT DOES ORACLE NEED TO COMPILE A PACKAGE BODY?A : ORACLE REQUIRES AN EXCLUSIVE LOCK ON THE OBJECT

Q : DOES ANYTHING GET INVALIDATED WHEN I COMPILE A BODY?A : NO

Q : WHAT ABOUT A PACKAGE SPEC?A : COMPILING A PACKAGE SPEC INVALIDATES CALLING BODIES*

Q : IS MY (RE)COMPILATION LIMITED TO THE CODE THAT I CHANGE?A : NO…..

COMPILE ONLY WHAT YOU NEED

AVOID INVALIDATING PACKAGES

Page 13: Hot or  Not? How  to Release Changes Without Impacting Customers

CONFIDENTIAL and not for reproduction without prior written consent. © of The Sporting Exchange Limited.

GETTING THE LOCK

13

• STOP BACKGROUND JOBS

• NEED A WINDOW

10 200 30 5040 60

Minute

Page 14: Hot or  Not? How  to Release Changes Without Impacting Customers

CONFIDENTIAL and not for reproduction without prior written consent. © of The Sporting Exchange Limited.

PACKAGE STATE

14

WHAT IS PACKAGE STATE?

ORA-04068: existing state of

packages has been discarded

Page 15: Hot or  Not? How  to Release Changes Without Impacting Customers

CONFIDENTIAL and not for reproduction without prior written consent. © of The Sporting Exchange Limited.

PACKAGE STATE

15

CONSTANTS

CONSTANT WORKAROUND

ORA-04068: existing state of

packages has been discarded

Page 16: Hot or  Not? How  to Release Changes Without Impacting Customers

CONFIDENTIAL and not for reproduction without prior written consent. © of The Sporting Exchange Limited.

UNNECESSARY INVALIDATIONS : FGDT

16

Page 17: Hot or  Not? How  to Release Changes Without Impacting Customers

CONFIDENTIAL and not for reproduction without prior written consent. © of The Sporting Exchange Limited.

UNNECESSARY INVALIDATIONS : FGDT

17

FINE GRAINED DEPENDENCY TRACKING

Page 18: Hot or  Not? How  to Release Changes Without Impacting Customers

CONFIDENTIAL and not for reproduction without prior written consent. © of The Sporting Exchange Limited.

UNNECESSARY INVALIDATIONS : FGDT

18

NEEDED NOT NEEDED

Page 19: Hot or  Not? How  to Release Changes Without Impacting Customers

CONFIDENTIAL and not for reproduction without prior written consent. © of The Sporting Exchange Limited.

CHANGING PACKAGE SPECIFICATIONS

19

CHANGING THE PACKAGE SPECIFICATION INVALIDATES ALL CALLING PACKAGES

EXCEPT THAT’S NOT TRUE

Page 20: Hot or  Not? How  to Release Changes Without Impacting Customers

CONFIDENTIAL and not for reproduction without prior written consent. © of The Sporting Exchange Limited.

CHANGING PACKAGE SPECIFICATIONS

20

END MEANS AFTER THE LAST REFERENCED PROCEDURE!

TO BE SAFE, ADD TO THE VERY END

Page 21: Hot or  Not? How  to Release Changes Without Impacting Customers

CONFIDENTIAL and not for reproduction without prior written consent. © of The Sporting Exchange Limited.

CHANGING PACKAGE SPECIFICATIONS

21

Page 22: Hot or  Not? How  to Release Changes Without Impacting Customers

CONFIDENTIAL and not for reproduction without prior written consent. © of The Sporting Exchange Limited.

CHANGING PACKAGE SPECIFICATIONS

22

Page 23: Hot or  Not? How  to Release Changes Without Impacting Customers

CONFIDENTIAL and not for reproduction without prior written consent. © of The Sporting Exchange Limited.

LEFT WITH A MESS?

23

1. WHEN OVERLOADING, REFACTOR INTERNALLY

2. IF YOU CAN’T DELETE, THROW AN ERROR

3. DO A COLD RELEASE

Page 24: Hot or  Not? How  to Release Changes Without Impacting Customers

CONFIDENTIAL and not for reproduction without prior written consent. © of The Sporting Exchange Limited.

DATABASE LINKS

24

1. DON’T USE THEM

2. SESSION-TASTIC

3. CONFUSE THE POOR CBO

4. DON’T USE THEM

5. EDGE CASES AND COMPLEXITY

Page 25: Hot or  Not? How  to Release Changes Without Impacting Customers

CONFIDENTIAL and not for reproduction without prior written consent. © of The Sporting Exchange Limited.

DATABASE LINKS

25

FIXED USER DATABASE LINK

CONNECTED USER DATABASE LINK

Page 26: Hot or  Not? How  to Release Changes Without Impacting Customers

CONFIDENTIAL and not for reproduction without prior written consent. © of The Sporting Exchange Limited.

DATABASE LINKS

26

RED_TIGER

RED_SCOTT BLUE_SCOTT

RED_SCOTT

TABLE

RED_TIGER

Package PACKAGE reads BLUE_SCOTT.TABLE@BLUE

GRANT EXECUTE ON PACKAGE TO RED_TIGER

GRANT SELECT ON TABLE TO RED_SCOTT

GRANT SELECT ON TABLE TO RED_TIGER

Bug 13415892 - UNNECESSARY INVALIDATION OF REMOTE STUBS

Page 27: Hot or  Not? How  to Release Changes Without Impacting Customers

CONFIDENTIAL and not for reproduction without prior written consent. © of The Sporting Exchange Limited.

SUMMARY

27

1. TO COMPILE (OR RECOMPILE) A PACKAGE, YOU NEED AN EXCLUSIVE LOCK

2. PACKAGE STATE LIMITS OPTIONS

3. MINIMISE UNECESSARY COMPILATIONa. SCOPE PL/SQL VARIABLESb. MODIFY SPECIFICATION CAREFULLY

4. BEWARE DATABASE LINKS

Page 28: Hot or  Not? How  to Release Changes Without Impacting Customers

CONFIDENTIAL and not for reproduction without prior written consent. © of The Sporting Exchange Limited.

THANK YOUQ&A

[email protected]

28

Page 29: Hot or  Not? How  to Release Changes Without Impacting Customers

CONFIDENTIAL and not for reproduction without prior written consent. © of The Sporting Exchange Limited.

29


Recommended