| 1 |
joko |
1.1 |
<HTML> |
| 2 |
|
|
<HEAD> |
| 3 |
|
|
<TITLE>Data::Storage</TITLE> |
| 4 |
|
|
<LINK REV="made" HREF="mailto:"> |
| 5 |
|
|
</HEAD> |
| 6 |
|
|
|
| 7 |
|
|
<BODY> |
| 8 |
|
|
|
| 9 |
|
|
<A NAME="__index__"></A> |
| 10 |
|
|
<!-- INDEX BEGIN --> |
| 11 |
|
|
|
| 12 |
|
|
<UL> |
| 13 |
|
|
|
| 14 |
|
|
<LI><A HREF="#description">DESCRIPTION</A></LI> |
| 15 |
|
|
<LI><A HREF="#requirements">REQUIREMENTS</A></LI> |
| 16 |
|
|
<LI><A HREF="#authors / copyright">AUTHORS / COPYRIGHT</A></LI> |
| 17 |
|
|
<LI><A HREF="#support / warranty">SUPPORT / WARRANTY</A></LI> |
| 18 |
|
|
<LI><A HREF="#bugs">BUGS</A></LI> |
| 19 |
|
|
<LI><A HREF="#user level errors">USER LEVEL ERRORS</A></LI> |
| 20 |
|
|
<UL> |
| 21 |
|
|
|
| 22 |
|
|
<UL> |
| 23 |
|
|
|
| 24 |
|
|
<UL> |
| 25 |
|
|
|
| 26 |
|
|
<LI><A HREF="#mapping">Mapping</A></LI> |
| 27 |
|
|
<LI><A HREF="#dbd::autocsv's rulebase">DBD::AutoCSV's rulebase</A></LI> |
| 28 |
|
|
<LI><A HREF="#check structure of source node">Check structure of source node</A></LI> |
| 29 |
|
|
<LI><A HREF="#modify structure of source node">Modify structure of source node</A></LI> |
| 30 |
|
|
<LI><A HREF="#load source node by ident">Load source node by ident</A></LI> |
| 31 |
|
|
</UL> |
| 32 |
|
|
|
| 33 |
|
|
</UL> |
| 34 |
|
|
|
| 35 |
|
|
</UL> |
| 36 |
|
|
|
| 37 |
|
|
<LI><A HREF="#todo">TODO</A></LI> |
| 38 |
|
|
</UL> |
| 39 |
|
|
<!-- INDEX END --> |
| 40 |
|
|
|
| 41 |
|
|
<HR> |
| 42 |
|
|
<P> |
| 43 |
|
|
<HR> |
| 44 |
|
|
<H1><A NAME="description">DESCRIPTION</A></H1> |
| 45 |
|
|
<P>Data::Transfer::Sync is a module providing a generic synchronization process |
| 46 |
|
|
across arbitrary/multiple storages based on a ident/checksum mechanism. |
| 47 |
|
|
It sits on top of Data::Storage.</P> |
| 48 |
|
|
<P> |
| 49 |
|
|
<HR> |
| 50 |
|
|
<H1><A NAME="requirements">REQUIREMENTS</A></H1> |
| 51 |
|
|
<PRE> |
| 52 |
|
|
For full functionality: |
| 53 |
|
|
Data::Storage |
| 54 |
|
|
Data::Transform |
| 55 |
|
|
Data::Compare |
| 56 |
|
|
... and all their dependencies</PRE> |
| 57 |
|
|
<P> |
| 58 |
|
|
<HR> |
| 59 |
|
|
<H1><A NAME="authors / copyright">AUTHORS / COPYRIGHT</A></H1> |
| 60 |
|
|
<P>The Data::Storage module is Copyright (c) 2002 Andreas Motl. |
| 61 |
|
|
All rights reserved.</P> |
| 62 |
|
|
<P>You may distribute it under the terms of either the GNU General Public |
| 63 |
|
|
License or the Artistic License, as specified in the Perl README file.</P> |
| 64 |
|
|
<P> |
| 65 |
|
|
<HR> |
| 66 |
|
|
<H1><A NAME="support / warranty">SUPPORT / WARRANTY</A></H1> |
| 67 |
|
|
<P>Data::Storage is free software. IT COMES WITHOUT WARRANTY OF ANY KIND.</P> |
| 68 |
|
|
<P> |
| 69 |
|
|
<HR> |
| 70 |
|
|
<H1><A NAME="bugs">BUGS</A></H1> |
| 71 |
|
|
<PRE> |
| 72 |
|
|
When in "import" mode for windows file - DBD::AutoCSV may hang. |
| 73 |
|
|
Hint: Maybe the source node contains an ident-, but no checksum column?</PRE> |
| 74 |
|
|
<P> |
| 75 |
|
|
<HR> |
| 76 |
|
|
<H1><A NAME="user level errors">USER LEVEL ERRORS</A></H1> |
| 77 |
|
|
<P> |
| 78 |
|
|
<H4><A NAME="mapping">Mapping</A></H4> |
| 79 |
|
|
<PRE> |
| 80 |
|
|
- - - - - - - - - - - - - - - - - - - - - - - - - - |
| 81 |
|
|
info: BizWorks::Process::Setup->syncResource( source_node Currency mode PULL erase 0 import 0 )critical: BizWorks::Process::Setup->startSync: Can't access mapping for node "Currency" - please check BizWorks::ResourceMapping. |
| 82 |
|
|
- - - - - - - - - - - - - - - - - - - - - - - - - - |
| 83 |
|
|
You have to create a sub for each node used in synchronization inside named Perl module. The name of this sub _must_ match |
| 84 |
|
|
the name of the node you want to sync. This sub holds mapping metadata to give the engine hints about how |
| 85 |
|
|
to access the otherwise generic nodes. |
| 86 |
|
|
- - - - - - - - - - - - - - - - - - - - - - - - - -</PRE> |
| 87 |
|
|
<P> |
| 88 |
|
|
<H4><A NAME="dbd::autocsv's rulebase">DBD::AutoCSV's rulebase</A></H4> |
| 89 |
|
|
<PRE> |
| 90 |
|
|
|
| 91 |
|
|
- - - - - - - - - - - - - - - - - - - - - - - - - - |
| 92 |
|
|
info: BizWorks::Process::Setup->syncResource( source_node Currency mode PULL erase 0 import 0 ) |
| 93 |
|
|
info: Data::Transfer::Sync->syncNodes: source=L/Currency <- target=R/currencies.csv</PRE> |
| 94 |
|
|
<PRE> |
| 95 |
|
|
|
| 96 |
|
|
Execution ERROR: Error while scanning: Missing first row or scanrule not applied. at C:/home/amo/develop/netfrag.org/nfo/perl/libs/DBD/CSV.p |
| 97 |
|
|
m line 165, <GEN9> line 1. |
| 98 |
|
|
called from C:/home/amo/develop/netfrag.org/nfo/perl/libs/Data/Storage/Handler/DBI.pm at 123.</PRE> |
| 99 |
|
|
<PRE> |
| 100 |
|
|
|
| 101 |
|
|
DBI-Error: DBD::AutoCSV::st fetchrow_hashref failed: Attempt to fetch row from a Non-SELECT statement |
| 102 |
|
|
notice: Data::Transfer::Sync->syncNodes: No nodes to synchronize. |
| 103 |
|
|
- - - - - - - - - - - - - - - - - - - - - - - - - - |
| 104 |
|
|
DBD::AutoCSV contains a rulebase which is spooled down while attempting to guess the style of the csv file regarding |
| 105 |
|
|
parameters like newline (eol), column-seperation-character (sep_char), quoting character (quote_char). |
| 106 |
|
|
If this spool runs out of entries and no style could be resolved, DBD::CSV dies causing this "Execution ERROR" which |
| 107 |
|
|
results in a "DBI-Error" afterwards. |
| 108 |
|
|
- - - - - - - - - - - - - - - - - - - - - - - - - -</PRE> |
| 109 |
|
|
<P> |
| 110 |
|
|
<H4><A NAME="check structure of source node">Check structure of source node</A></H4> |
| 111 |
|
|
<PRE> |
| 112 |
|
|
|
| 113 |
|
|
- - - - - - - - - - - - - - - - - - - - - - - - - - |
| 114 |
|
|
info: Data::Transfer::Sync->syncNodes: source=L/Currency <- target=R/currencies.csv |
| 115 |
|
|
critical: Data::Transfer::Sync->syncNodes: Can not synchronize: No ident found in source node, maybe try to "import" this node first. |
| 116 |
|
|
- - - - - - - - - - - - - - - - - - - - - - - - - - |
| 117 |
|
|
If lowlevel detection succeeds, but no other required informations are found, this message is issued. |
| 118 |
|
|
"Other informations" might be: |
| 119 |
|
|
- column-header-row completely missing |
| 120 |
|
|
- ident column is empty |
| 121 |
|
|
- - - - - - - - - - - - - - - - - - - - - - - - - -</PRE> |
| 122 |
|
|
<P> |
| 123 |
|
|
<H4><A NAME="modify structure of source node">Modify structure of source node</A></H4> |
| 124 |
|
|
<PRE> |
| 125 |
|
|
|
| 126 |
|
|
- - - - - - - - - - - - - - - - - - - - - - - - - - |
| 127 |
|
|
info: Data::Transfer::Sync->syncNodes: source=L/Currency <- target=R/currencies.csv |
| 128 |
|
|
info: Data::Transfer::Sync->_prepareNode_MetaProperties( descent source ) |
| 129 |
|
|
warning: Data::Transfer::Sync->_prepareNode_MetaProperties: node is lacking meta properties - will try to alter... |
| 130 |
|
|
SQL ERROR: Command 'ALTER' not recognized or not supported!</PRE> |
| 131 |
|
|
<PRE> |
| 132 |
|
|
|
| 133 |
|
|
SQL ERROR: Command 'ALTER' not recognized or not supported! |
| 134 |
|
|
- - - - - - - - - - - - - - - - - - - - - - - - - - |
| 135 |
|
|
The Engine found a node which structure does not match the required. It tries to alter this automatically - only when doing "import" - |
| 136 |
|
|
but the DBD driver (in this case DBD::CSV) gets in the way croaking not to be able to do this. |
| 137 |
|
|
This could also appear if your database connection has insufficient rights to modify the database structure. |
| 138 |
|
|
DBD::CSV croaks because it doesn't implement the ALTER command, so please edit your columns manually. |
| 139 |
|
|
Hint: Add columns with the names of your "ident" and "checksum" property specifications. |
| 140 |
|
|
- - - - - - - - - - - - - - - - - - - - - - - - - -</PRE> |
| 141 |
|
|
<P> |
| 142 |
|
|
<H4><A NAME="load source node by ident">Load source node by ident</A></H4> |
| 143 |
|
|
<PRE> |
| 144 |
|
|
- - - - - - - - - - - - - - - - - - - - - - - - - - |
| 145 |
|
|
info: Data::Transfer::Sync->_prepareNode_DummyIdent( descent source ) |
| 146 |
|
|
pcritical: Data::Transfer::Sync->_modifyNode failed: "source" node is empty. |
| 147 |
|
|
- - - - - - - - - - - - - - - - - - - - - - - - - - |
| 148 |
|
|
The source node could not be loaded. Maybe the ident is missing. Please check manually. |
| 149 |
|
|
Hint: Like above, the ident and/or checksum columns may be missing.... |
| 150 |
|
|
- - - - - - - - - - - - - - - - - - - - - - - - - -</PRE> |
| 151 |
|
|
<P> |
| 152 |
|
|
<HR> |
| 153 |
|
|
<H1><A NAME="todo">TODO</A></H1> |
| 154 |
|
|
<PRE> |
| 155 |
|
|
- sub _resolveIdentProvider |
| 156 |
|
|
- wrap _doModifySource and _doTransferTarget around a core function which can change virtually any type of node |
| 157 |
|
|
- split this module up into Sync.pm, Sync/Core.pm, Sync/Compare.pm and Sync/Compare/Checksum.pm |
| 158 |
|
|
- introduce _compareNodes as a core method and wrap it around methods in Sync/Compare/Checksum.pm |
| 159 |
|
|
- introduce Sync/Compare/MyComparisonImplementation.pm |
| 160 |
|
|
- some generic deferring method - e.g. "$self->defer(action)" - to be able to accumulate a bunch of actions for later processing |
| 161 |
|
|
- this implies everything done is _really_ split up into generic actions - how else would we defer them??? |
| 162 |
|
|
- example uses: |
| 163 |
|
|
- fetch whole checksum list from node |
| 164 |
|
|
- remember source ident retransmits |
| 165 |
|
|
- remember: this is convenient - and maybe / of course faster - but we'll loose "per-node-atomic" operations |
| 166 |
|
|
- feature: mechanism to implicit inject checksum property to nodes (alter table / modify schema) |
| 167 |
|
|
- expand statistics / keep track of: |
| 168 |
|
|
- touched/untouched nodes |
| 169 |
|
|
- full sync |
| 170 |
|
|
- just do a push and a pull for now but use stats for touched nodes in between to speed up things |
| 171 |
|
|
- introduce some new metadata flags for a synchronization partner which is (e.g.) of "source" or "target": |
| 172 |
|
|
- isNewNodePropagator |
| 173 |
|
|
- isWriteProtected</PRE> |
| 174 |
|
|
|
| 175 |
|
|
</BODY> |
| 176 |
|
|
|
| 177 |
|
|
</HTML> |