Hajautetut tietokannat Talvi 2015 Laskuharjoitus 5. T-106.5241 Distributed Databases Winter 2015 Tutorial 5 1/5 Sivupalvelimet ja yhteislevyjärjestelmät; kertausta Page Servers, Shared-Disk Systems; Review Perustuu seuraviin artikkeleihin: Based on the following articles C. Mohan & I. Narang 1994: ARIES/CSA: a method for database recovery in client-server architectures. Proc. of the 1994 ACM SIGMOD Internat. Conf. on Management of Data, 55 66. C. Mohan & I. Narang: Recovery and coherency-control protocols for fast intersystem page transfer and fine-granularity locking in a shared disks transaction environment. VLDB 1991, Proc. of the 17th Internat. Conf. on Very Large Data Bases, 1991, 193 207. Vastaukset useisiin kysymyksiin löytyvät myös artikkelista: Crash recovery in client-server EXODUS, Carey et al, Proceedings of the 1992 ACM SIGMOD international conference on Management of data, Pages 165-174. linkistä http://dl.acm.org/citation.cfm?id=130283.130312 The answers to many of these questions can be found in the article above, with the online link. [0] [a] Selvitä työnjako asiakas-palvelin systeemissä. Explain the division of labor in a C/S system. [b] Määrittele kyselypalvelimen toiminta. Määrittele datapalvelimen toiminta. What is query shipping? What is data shipping? [c] Mikä voi romahtaa asiakas-palvelin järjestelmässä? What can crash in a C/S system? [d] Mitä hyötyä saadaan kun aineistoa voidaan pitää asiakkaan Cache-muistissa? What are the benefits of caching data at the client? [e] Mainitse tietopalvelimen etu kyselypalvelimeen verrattuna. Give an advantage of a data server with respect to a query shipping server. [f] Anna lyhyt mutta tarkka määritelmä: (i) tietopalvelin, (ii) asiakkaan WAL-käytäntö.(iii) transaktion rajat ylittävä puskurointi. Give a brief but concise definition for: (i) dataserver, (ii) Client s WAL-policy (iii) intertransaction caching. [1] [a] Vaikkakin älä-varasta käytäntö on yksinkertaisempaa tietokannan elpymisessä (vain sitoutuneet sivut voidaan kirjoittaa tietokannan levylle) tehokkuussyistä käytetään varasta käytäntöä. Mitä se käytännössä mahdollistaa? Even though the No-Steal policy is simpler for recovery (only committed pages get written to the physical DB), the Steal-policy is used for performance reasons. What does it allow in practice?
Hajautetut tietokannat Talvi 2015 Laskuharjoitus 5. T-106.5241 Distributed Databases Winter 2015 Tutorial 5 2/5 [b] Mitä ARIESin käyttämä WAL-protokolla vaatikaan? (kaksi asiaa). What two rules were required by WAL protocol used in ARIES? [c] Missä loki sijaitsee asiakas-palvelinjärjestelmässä, joka perustuu sivupalvelimeen? Tuottavatko asiakkaat mitään lokia? Milloin asiakkaan sivua pidetään päivitettynä( likaisena )? Where is the log located in a C/S system using page-server? Do the clients do any logging? When is the page at the client referred to as dirty/modified? [d] Asiakas-palvelinjärjestelmässä, joka perustuu sivupalvelimeen, mikä on asiakkaalla toimivan tietokantaprosessin päätehtävä? Entä palvelimella toimivan tietokantaprosessin päätehtävä? In a C/S system using page-server, what is the main task of the DB process operating at the client? And the main task for the DB process operating at the server? [e] KERTAUSTA/REVIEW: Täydennä taulukko laittamalla rastit sopiviin kohtiin sekä kommentoi skaalattavuutta (matala, keskitaso, korkea). Fill in the table using check-marks and rate the scalability (low, medium, high). Parallel architecture: Shared? Own Memory Own Disks Scalability Own Database Management Software Shared memory/shared everything Shared Disk Shared Nothing [f] Mitkä ovat puskurieheysprotokollan kaksi päätehtävää yhteislevyjärjestelmässä? What are the two main tasks for the buffer coherency control in shared disk systems? [g] Seuraava teksti on muotoiltu paperista: The following is adapted from : Recovery and Coherency-Control Protocols for Fast Intersystem Page Transfer and Fine-Granularity Locking in a Shared Disks Transaction Environment by C. Mohan and I.Narang at IBM Almaden RC. Täydennä puuttuvat kohdat. Fill-in the blanks. In an Shared-Disk environment, if a modified page is cached in one node (referred to as the owner), then a different node requiring access to that page must get the version of the page from the owner. Special locks (so-called physical P- locks) are used to help in detecting that a cached page in a particular buffer pool is not the latest version of the page. When a transaction T 1 updates a record on page P i in node N 1, the transaction updates the of that page P i. When Ti then commits, the current Page_LSN of P i is sent to the. The Lock Manager registers the page_lsn in the P-lock entry for P i, before unlocking the page s usual logical locks. When T 2 in N 2 locks a record in Pi, it requests the page_lsn for page P i. When LM returns this page_lsn as part of, Node N 2 can then detect if its version, if any, of P i is not current. If P i at node N 2 is not current, then the Lock Manager will assist node N2 in getting the current version of page Pi from the, Node N 1. [h] Mitä tietoa globaali lukkotaulu, joka sijaitsee palvelimella pitää sisällään? A global lock table stored at the Server contains what information?
Hajautetut tietokannat Talvi 2015 Laskuharjoitus 5. T-106.5241 Distributed Databases Winter 2015 Tutorial 5 3/5 [2] Sivupalvelinjärjestelmän asiakkaan c transaktio T pyytää S-lukkoa avainarvoon x. Missä tilanteessa lukko voidaan myöntää paikallisesti, so. ilman, että c:n täytyy kommunikoida palvelimen kanssa? Keksi jokin keino vähentää S-lukkojen varauksessa tarvittavaa kommunikointia asiakkaan ja palvelimen välillä. In a page-server system, transaction T for client c requests an S lock for key value x. In which situations can the lock be granted locally without for c having to communicate with the server? Suggest a way for reducing the communication between Client and Server due to the requesting of S-locks. [3] Oletetaan, että kolmikerrosmallissa a) asiakaskoneessa toimiva esityspalvelu (esim. selain), b) tietokantapalvelin romahtaa kesken jonkin transaktion suorituksen. Mitä jäljelle jääneissä palvelimissa tapahtuu? Entä jos romahtamisen sijaan kyseinen kone menettääkin vain tilapäisesti verkkoyhteytensä muihin palvelimiin? Assume that in a three-tiered model, a) the presentation services at the client machine (e.g. the browser) b) the database server crashes during a transaction. What happens in the remaining servers? What if instead of a crash, the machine in question just temporarily loses its network connection to other servers? [4] [a] Tosi vai epätosi? True or False? Ina shared disk environment using the Fast scheme, the page being shipped might contain updates from more than one node. [b] Mikä on ns. sumea tarkistuspiste? What is a fuzzy checkpoint is assumed? [c] Mikä on TOISTO-vaiheen tarkoitus ARIES elvytyksessä? Entä PERUUTUS vaiheen? What is the purpose of REDO phase in ARIES? What about the UNDO-phase? [d] Luettele kaksi tapaa, jolla ARIES voi tunnistaa sivun olevan päivitetty ( likainen ) kun se suorittaa elvytystä. List two ways in which ARIES can identify a page as having been modified ( dirty ) when doing recovery- [e] Mitä tapahtuisi jos ARIES ei osaisi tunnistaa oikein sivun olevan päivitetty? What would happen if ARIES could not correctly identify a page as being modified? [f] Selosta miten kyseinen tilanne voisi syntyä Asiakas-Palvelin ympäristössä ja esitä siihen yksinkertainen ratkaisu. Explain how such a situation might arise in a C/S environment and give a simple solution.
Hajautetut tietokannat Talvi 2015 Laskuharjoitus 5. T-106.5241 Distributed Databases Winter 2015 Tutorial 5 4/5 [5] Kertausta Review [a] Jos n=6 and p=4 montako pistettä voi enintään romahtaa? Vihje: Määritä ensin q, kirjoitusvallan koko. If n=6 and p=4 what is the maximum nr of sites that can fail? Hint: Define first q, the size of the write quorum. [b] Kuvitellaan kaksi transaktiota Ti and Tj, jotka molemmat siirtävät varoja tililtä x pisteessä S1 tiliin y pisteessä S2. Koska meitä kiinnostaa vain luku ja kirjoitusoperaatiot, molemmat transaktiot voidaan esittää seuraavilla operaatioilla: Assume two transactions Ti and Tj which both transfer funds from an account x located at site S1 to an account y located at site S2. As we are interested only in the read and write operations, the two transactions could be described by the following sequence of operations: T 1 : Ri[x] Wi[x] Ri(y) Wi[y] T 2 : Rj[x] Wj[x] Rj[y] Wj[y] Eli kukin transaktio lukee x:n, pienentää sen arvoa, kirjoittaa uuden arvon, lukee y;n, kasvattaa sen arvoa, ja kirjoittaa uuden arvon. Oletetaan, että nämä kaksi transaktiota aktivoituvat lähes samanaikaisesti, ja oletetaan seuraava suoritus jokaisessa pisteessä: This indicates that each transaction reads x, decrements its value, writes the new value, reads y, increments its value, and writes the new value. Assume that these two transactions are activated almost simultaneously and consider the following execution at each site: Site 1 Site 2 Ri(x) Wi(x) Rj(x) Wj(x) Ri(y) Wi(y) Rj(y) Wj(y) Tässä suorituksessa, se, että Ri(y) on operaation Rj(x) vieressä tarkoittaa siis, että molemmat operaatiot alkavat samanaikaisesti. Joten Tj aloittaa x:n lukemisen heti kun Ti on kirjoittanut x:n, vaikka Ti ei olisikaan vielä valmis. In this representation of execution, the fact that operation Ri(y) appears next to Rj(x) means that these two operations start at the same time. Therefore, Tj begins reading x immediately after Ti has written x, although Ti has not yet terminated. Hajautettu suoritus on sarjallistuva jos kaikki suoritukset osallistujapisteissä ovat sarjallistuvia ja kaikki pisteet sarjallistuttavat transaktionsa samassa järjestyksessä. Onko yllä oleva hajautettu suoritus sarjallistuva? Jos on, mikä on globaalin sarjallistuvuuden suoritusjärjestys? Jos se ei ole sarjallistuva, miksei se ole? A distributed execution is serializable if executions at the participant sites are all serializable and all sites serialize the transactions in the same order. Is the above distributed execution schedule serializable? If so, what
Hajautetut tietokannat Talvi 2015 Laskuharjoitus 5. T-106.5241 Distributed Databases Winter 2015 Tutorial 5 5/5 is the global serialization order? If not, why not? ii) Voiko tämän hajautetun suorituksen järjestystä toteuttaa ankaralla 2-vaihe lukituskäytännöllä (ei ole väliä onko kyseessä keskitetty vaiko hajautettu 2PL)? Jos mahdollista, esitä lukitus/lukkojen vapautussekvenssi. Jos ei, selitä miksi. Can this distributed execution schedule be generated by a strict 2-phase locking protocol (it does not matter whether a centralized or a distributed 2PL mechanism is used)? If it can, indicate the locking/unlocking sequence. If it cannot, explain why not. [c] Mikä transaktion ominaisuus on se, jota vahvistetaan hajautetulla sitoutumisprotokollalla? Selitä lyhyesti. Which transactional property is enforced by distributed commit protocols? Explain briefly. [d] Kaksivaiheisessa sitoutumisessa, osallistuja voi olla estynyt. Miksi tätä ongelmaa ei voida kokonaan poistaa, esim. antamalla osallistujien valita uusi koordinaattori? In the Two-Phase Commit Protocol (2PC), why can blocking never be completely eliminated, even when the participants elect a new coordinator? [6] [a] Ylikansallisen suuryrityksen henkilöstötietokannan relaatio on ositettu vaakasuorasti osastoittain (department), joita yrityksellä on useita kymmeniä eri maissa. Yrityksen päätoimipisteessä (osastolla 1) on pääkonttorin työntekijöiden monikot sisältävän palasen lisäksi toisinne kaikista muista palasista, ts. päätoimipisteessä on relaatio kokonaisena. Anna suoritus suunnitelmat seuraaville, osastolla 10 käynnistetyille kyselyille: The employee relation employee (for a multinational company has been horizontally fragmented by department, of which are there several tens in different countries. At the headquarters (department nr 1) are stored not just the fragments for the employees but also replicas of all other fragments, meaning the whole relation is fully available at the headquarters. employee (ssn, name, address, salary, job, department_number) Give query execution plans for the following queries generated at department nr 10 : i) select * from employee where department_number = 25. ii) select avg(salary) from employee. iii) select department_number, avg(salary) from employee where department_number = 10 or department_number = 25 group by department_number. iv) select avg(salary) from employee where department_number = 10 or department_number = 25. v) select avg(salary) from employee where department_number = 10 or department_number = 1.