Oracle® TimesTen In-Memory Database TimesTen to TimesTen Replication Guide Release 11.2.1 Part Number E13072-02 |
|
|
View PDF |
This chapter describes the Document Type Definition (DTD) and structure of an XML format replication conflict report file. The TimesTen XML format conflict report is are based on the XML 1.0 specification (http://www.w3.org/TR/REC-xml
). For information on configuring replication to report conflicts, see "Replication conflict detection and resolution".
This chapter includes:
The XML Document Type Definition (DTD) for the replication conflict report is a set of markup declarations that describes the elements and structure of a valid XML file containing a log of replication conflicts. This DTD can be found in the XML header file-the file with the suffix ".xml
"-that is created when replication is configured to report conflicts to an XML file. User applications which understand XML use the DTD to parse the rest of the XML replication conflict report. For more information on reading and understanding XML Document Type Definitions, see http://www.w3.org/TR/REC-xml
.
<?xml version="1.0"?> <!DOCTYPE ttreperrorlog [ <!ELEMENT ttrepconflictreport(conflict*) > <!ELEMENT repconflict header, conflict) > <!ELEMENT header (time, datastore, transmitter, table) > <!ELEMENT time (hour, min, sec, year, month, day) > <!ELEMENT hour (#PCDATA) > <!ELEMENT min (#PCDATA) > <!ELEMENT sec (#PCDATA) > <!ELEMENT year (#PCDATA) > <!ELEMENT month (#PCDATA) > <!ELEMENT day (#PCDATA) > <!ELEMENT datastore (#PCDATA) > <!ELEMENT transmitter (#PCDATA) > <!ELEMENT table (tableowner, tablename) > <!ELEMENT tableowner (#PCDATA) > <!ELEMENT tablename (#PCDATA) > <!ELEMENT scope (#PCDATA) > <!ELEMENT failedtransaction ((insert | update | delete)+) > <!ELEMENT insert (sql) > <!ELEMENT update (sql, keyinfo, newtuple) > <!ELEMENT delete (sql, keyinfo) > <!ELEMENT sql (#PCDATA) > <!ELEMENT keyinfo (column+) > <!ELEMENT newtuple (column+) > <!ELEMENT column (columnname, columntype, columnvalue) > <!ATTLIST column pos CDATA #REQUIRED > <!ELEMENT columnname (#PCDATA) > <!ELEMENT columnvalue (#PCDATA) > <!ATTLIST columnvalue isnull (true | false) "false"> <!ELEMENT existingtuple (column+) > <!ELEMENT conflictingtuple (column+) > <!ELEMENT conflictingtimestamp(#PCDATA) > <!ELEMENT existingtimestamp (#PCDATA) > <!ELEMENT oldtuple (column+) > <!ELEMENT conflict (conflictingtimestamp, existingtimestamp*, existingtuple*, existingtimestamp*, conflictingtuple*, oldtuple*, keyinfo*) > <!ATTLIST conflict type (insert | update | deletedupdate | updatedeleted) #REQUIRED> <!ENTITY logFile SYSTEM "Filename.include"> ]> <ttrepconflictreport> &logFile; </ttrepconflictreport>
The .xml
file for the XML replication conflict report is merely a header, containing the XML Document Type Definition describing the report format as well as a link to a file with the suffix ".include
". This include file is the main body of the report, containing each replication conflict as a separate element. There are three possible types of elements: insert, update and delete/update conflicts. Each conflict type requires a slightly different element structure.
A uniqueness conflict occurs when a replicated insertion fails because a row with an identical key column was inserted more recently. See "Reporting uniqueness conflicts" for a description of the information that is written to the conflict report for a uniqueness conflict.
Example 12-1 illustrates the format of a uniqueness conflict XML element, using the values from Example 11-3.
Example 12-1 Uniqueness conflict element
<repconflict> <header> <time> <hour>13</hour> <min>36</min> <sec>00</sec> <year>2002</year> <month>03</month> <day>25</day> </time> <datastore>/tmp/masterds</datastore> <transmitter>SUBSCRIBERDS</transmitter> <table> <tableowner>REPL</tableowner> <tablename>TAB</tablename> </table> </header> <conflict type="insert"> <conflictingtimestamp>3C9F983D00031128</conflictingtimestamp> <existingtimestamp>3C9F983E000251C0</existingtimestamp> <existingtuple> <column pos="1"> <columnname>COL1</columnname> <columntype>NUMBER(38)</columntype> <columnvalue>2</columnvalue> </column> <column pos="2"> <columnname>COL2</columnname> <columntype>NUMBER(38)</columntype> <columnvalue>2</columnvalue> </column> <columnname>TSTAMP</columnname> <columntype>BINARY(8)</columntype> <columnvalue>3C9F983E000251C0</columnvalue> </column> </existingtuple> <conflictingtuple> <column pos="1"> <columnname>COL1</columnname> <columntype>NUMBER(38)</columntype> <columnvalue>2</columnvalue> </column> <column pos="2"> <columnname>COL2</columnname> <columntype>NUMBER(38)</columntype> <columnvalue>100</columnvalue> </column> <column pos="3"> <columname>TSTAMP</columnname> <columntype>BINARY(8)</columntype> <columnvalue>3C9F983D00031128</columnvalue> </column> </conflictingtuple> <keyinfo> <column pos="1"> <columnname>COL1</columnname> <columntype>NUMBER(38)</columntype> <columnvalue>2</columnvalue> </column> </keyinfo> </conflict> <scope>TRANSACTION</scope> <failedtransaction> <insert> <sql>Insert into table TAB </sql> <column pos="1"> <columnname>COL1</columnname> <columntype>NUMBER(38)</columntype> <columnvalue>2</columnvalue> </column> <column pos="2"> <columnname>COL2</columnname> <columntype>NUMBER(38)</columntype> <columnvalue>100</columnvalue> </column> <column pos="3"> <columnname>TSTAMP</columnname> <columntype>NUMBER(38)</columntype> <columnvalue>3C9F983D00031128</columnvalue> </column> </insert> </failedtransaction> </repconflict>
An update conflict occurs when a replicated update fails because the row was updated more recently. See "Reporting update conflicts" for a description of the information that is written to the conflict report for an update conflict.
Example 12-2 illustrates the format of an update conflict XML element, using the values from Example 11-4.
Example 12-2 Update conflict element
<repconflict> <header> <time> <hour>15</hour> <min>03</min> <sec>18</sec> <year>2002</year> <month>03</month> <day>25</day> </time> <datastore>/tmp/subscriberds</datastore> <transmitter>MASTERDS</transmitter> <table> <tableowner>REPL</tableowner> <tablename>TAB</tablename> </table> </header> <conflict type="update"> <conflictingtimestamp> 3C9FACB6000612B0 </conflictingtimestamp> <existingtimestamp>3C9FACB600085CA0</existingtimestamp> <existingtuple> <column pos="1"> <columnname>COL1</columnname> <columntype>NUMBER(38)</columntype> <columnvalue>6</columnvalue> </column> <column pos="2"> <columnname>COL2</columname> <columntype>NUMBER(38)</columntype> <columnvalue>99</columnvalue> </column> <column pos="3"> <columnname>TSTAMP</columnname> <columntype>BINARY(8)</columntype> <columnvalue>3C9FACB600085CA0></columnvalue> </column> </existingtuple> <conflictingtuple> <column pos="3"> <columnname>TSTAMP</columnname> <columntype>BINARY(8)</columntype> <columnvalue>3C9FACB6000612B0</columnvalue> </column> <column pos="2"> <columnname>COL2</columnname> <columntype>NUMBER(38)</columntype> <columnvalue>50</columnvalue> </column> </conflictingtuple> <oldtuple> <column pos="3"> <columnname>TSTAMP</columnname> <columntype>BINARY(8)</columntype> <columnvalue>3C9FAC85000E01F0</columnvalue> </column> <column pos="2"> <columnname>COL2</columnname> <columntype>NUMBER(38)</columntype> <columnvalue>2</columnvalue> </column> </oldtuple> <keyinfo> <column pos="1"> <columnname>COL1</columnname> <columntype>NUMBER(38)</columntype> <columnvalue>6</columnvalue> </column> </keyinfo> </conflict> <scope>TRANSACTION</scope> <failedtransaction> <update> <<sql>Update table TAB</sql> <<keyinfo> <column pos="1"> <columnname>COL1</columnname> <columntype>NUMBER(38)</columntype> <columnvalue>6</columnvalue> </column> </keyinfo> <column pos="3"> <columnname>TSTAMP</columnname> <columntype>BINARY(8)</columntype> <columnvalue>3C9FACB6000612B0</columnvalue> </column> <column pos="2"> <columnname>COL2</columnname> <columntype>NUMBER(38)</columntype> <columnvalue>50</columnvalue> </column> </update> </failedtransaction> </repconflict>
A delete/update conflict occurs when a replicated update fails because the row to be updated has already been deleted on the data store receiving the update, or when a replicated deletion fails because the row has been updated more recently. See "Reporting DELETE/UPDATE conflicts" for a description of the information that is written to the conflict report for a delete/update conflict.
Example 12-3 illustrates the format of a delete/update conflict XML element in which an update fails because the row has been deleted more recently, using the values from Example 11-5.
Example 12-3 Delete/update conflict element: delete is more recent
<repconflict> <header> <time> <hour>15</hour> <min>27</min> <sec>05</sec> <year>2002</year> <month>03</month> <day>25</day> </time> <datastore>/tmp/masterds</datastore> <transmitter>SUBSCRIBERDS</transmitter> <table> <tableowner>REPL</tableowner> <tablename>TAB</tablename> </table> </header> <conflict type="update"> <conflictingtimestamp> 3C9FB2460000AFC8 </conflictingtimestamp> <conflictingtuple> <column pos="3"> <columnname>TSTAMP</columnname> <columntype>BINARY(8)</columntype> <columnvalue>3C9FB2460000AFC8</columnvalue> </column> <column pos="2"> <columnname>COL2</columnname> <columntype>NUMBER(38)</columntype> <columnvalue>99/columnvalue> </column> </conflictingtuple> <keyinfo> <column pos="1"> <columnname>COL1</columnname> <columntype>NUMBER(38)</columntype> <columnvalue>2</columnvalue> </column> </keyinfo> </conflict> <scope>TRANSACTION</scope> <failedtransaction> <update> <sql>Update table TAB</sql> <keyinfo> <column pos="1"> <columnname>COL1</columnname> <columntype>NUMBER(38)</columntype> <columnvalue>2</columnvalue> </column> </keyinfo> <column pos="3"> <columnname>TSTAMP</columnname> <columntype>BINARY(8)</columntype> <columnvalue>3C9FB2460000AFC8</columnvalue> </column> <column pos="2"> <columnname>COL2</columnname> <columntype>NUMBER(38)</columntype> <columnvalue>99</columnvalue> </column> </update> </failedtransaction> </repconflict>
Example 12-4 illustrates the format of a delete/update conflict XML element in which a deletion fails because the row has been updated more recently, using the values from Example 11-6.
Example 12-4 Delete/update conflict element: update is more recent
<repconflict> <header> <time> <hour>15</hour> <min>27</min> <sec>20</sec> <year>2002</year> <month>03</month> <day>25</day> </time> <datastore>/tmp/masterds</datastore> <transmitter>MASTERDS</transmitter> <table> <tableowner>REPL</tableowner> <tablename>TAB</tablename> </table> </header> <conflict type="delete"> <conflictingtimestamp> 3C9FB258000708C8 </conflictingtimestamp> <existingtimestamp>3C9FB25800086858</existingtimestamp> <existingtuple> <column pos="1"> <columnname>COL1</columnname> <columntype>NUMBER(38)</columntype> <columnvalue>147</columnvalue> </column> <column pos="2"> <columnname>COL2</columnname> <columntype>NUMBER(38)</columntype> <columnvalue>99</columnvalue> </column> <column pos="3"> <columnname>TSTAMP</columnname> <columntype>BINARY(8)</columntype> <columnvalue>3C9FB25800086858</columnvalue> </column> </existingtuple> <keyinfo> <column pos="1"> <columnname>COL1</columnname> <columntype>NUMBER(38)</columntype> <columnvalue>147</columnvalue> </column> </keyinfo> </conflict> <scope>TRANSACTION</scope> <failedtransaction> <delete> <sql>Delete from table TAB</sql> <keyinfo> <column pos="1"> <columnname>COL1</columnname> <columntype>NUMBER(38)</columntype> <columnvalue>147</columnvalue> </column> </keyinfo> </delete> </failedtransaction> </repconflict>