70 likes | 178 Views
Migration Strategy ( hcg_* to TT->TS<-VW). Proposed 96s523 chgen project Hcg-structs used by chgen and pr-util.a Difficult to understand and maintain Reverse-engineer --> equiv. data model Add to schema.h and pr_loaded view Update, continuously track hcg_structs
E N D
Migration Strategy(hcg_* to TT->TS<-VW) • Proposed 96s523 chgen project • Hcg-structs used by chgen and pr-util.a • Difficult to understand and maintain • Reverse-engineer --> equiv. data model • Add to schema.h and pr_loaded view • Update, continuously track hcg_structs • Specify and check runtime invariants • Incrementally convert each client • Maintain duality during coexistence • At 100% cut-over, can eliminate hcg_*.
Current hcg- Structures hcg_ts-list: Array [0.HXCG_NUM_TABLES] of ts_list_type: ts_list_type: Array[0 ..MAXVERSIONS- 1] of ts_list_elt_type]: ts_list_elt_type: maxrow // largest row number[or pkey?] value in version rcount // total number of table rows in version hcg_view_list_type: // holds version# of each table in each named view { int num_views // at most MAXVIEWS (= 10) Array[0..MAXVIEWS] of view_elt_type viewname[30] char // runtime value - must search by name mode char // r=read; w=write; a=append version_list: Array[0..HCG_NUM_TABLES-1] of version_list_elt: version_list_elt: char //unsigned int [0..MAXVERSION <=255] }hcg_view_list
hcg_table hierarchy Views and table versions for each table root level (one row in each) hcg_view_list num_views I2 hcg_ts_list 1:HCG_NUM_TABLES 1:MAXVIEWS (one row per table) ts_list view_element_type viewname c30 mode c1 (one row per view) _ _ _ 1:MAXVERSIONS ts_type maxrow rcount 1:HCG_NUM_TABLES (one row per view name and table version) version_list_elt versionNo c1 (per table version in loaded views?) Proposal: Merge top tables; merge bottom tables.
Hcg-equivalent Data Model SV Schema Version schemaName c30 schemaVersion i2 num_tables i2 ... This model adds tables VV and TS to the genv9 schema SV-->TT-->TA TT Table Type ttabbrev c4 maxver i2 rcount i2 VV ViewVersion viewName c30 mode c1 num_tables i2 Tables VV, TS and VS contain the same attributes that chgen now declares and maintains as the hcg_* structures in schemaname.h. (Exception: version rcount becomes vrcount.) TS TableStats versionNo i2 maxrow i2 vrcount i2 TA Table Attribute ... ... (as in chgen v9) ...
Path Extensions to MetaSchema SV • Schema tables TT andTA do not capture the schema topology. • Network paths are defined by fkeys and connect tables. • Fkey (FK) is a sub-class of TA. • Path (PA) is a sequence of fkeys. • Many PAths share fkeys. • Table IK (Intermediate fKey) associates FK’s and PAths. • From table PA, access macros can be defined. • Each path has an orientation; IK identifies path’s first or last fkey. • Problem: redundant: wasted space. TT TA PA FK IK
Alternate Path Data Model (2) • Paths are either direct (one fkey) or composite (multi-fkey) • Each PAth has exactly one fkey (FK) component. • PAths are linear sequences, with a ‘head’ FK and a ‘tail’ composite ‘rest-of-path’ (recursive List) CP. • This leads to a cyclic schema: • PA-->FK:CP-->PA...->FK. • Eventually the PA shrinks to an fkey and CP vanishes (mincard = 0). • Chgen cannot handle alternate paths, only unique ones. • FK has an implicit TTid ref to parent, (not via TA to its TT container). SV TT mutex TA PA 1:1 1:1 1:1 0:1 CP FK
Alternate Path Data Model (3) (Not Verified) SV • Paths are either direct (one fkey) or composite (fkey-sequence). • Each PAth has exactly one fkey (FK) ‘head’ component. • PAths are recursive lists: a ‘head’ fkey is followed by a ‘tail’ composite sub-path. • Upward paths branch out at each node which has In-degree >1. • Fkeys become part of more than one PAth; therefore, FK--->PA is 1:1::1:M. • The dashed TT-->PA relation is redundant. TT TA rest-of -path upward -link FK alternate upward paths PA pathLength 1:1 1:1 0:1 1:M PT (PathTail)