Continuent Developer Community
Welcome, Guest
Please Login or Register.    Lost Password?
Replicating between different schemas (1 viewing) (1) Guest
Go to bottom Post Reply Favoured: 0
TOPIC: Replicating between different schemas
#664
Chris Picton (User)
Fresh Boarder
Posts: 8
graphgraph
User Offline Click here to see the profile of this user
Re:Replicating between different schemas 5 Months ago Karma: 0  
Thanks for the help so far

I have another question regarding row replication.

The Column Values are returned as
Code:

java.util.ArrayList<java.util.ArrayList<OneRowChange.ColumnVal>>
Why an array of arrays, when we only have a single row (OneRowChange) Is it possible to get multiple rows returned in a single OneRowChange event. Also, can I specify only some rows in a RowChangeEvent, instead of having to put them all in (ie, if the table I am replicating to has extra columns compared to the source table). Can I just specify those cols in the OneRowChange column values, and leave the others undef? Another option would be to edit the insert/update statement which would be generated by the OneRowChange. Is this possible?
 
Report to moderator   Logged Logged  
 
Last Edit: 2010/04/06 05:26 By chris@picton.nom.za.
  The administrator has disabled public write access.
#674
Robert Hodges (Moderator)
Moderator
Posts: 218
graph
User Offline Click here to see the profile of this user
Location: Berkeley California
Re:Replicating between different schemas 5 Months ago Karma: 1  
Hi Chris,

First of all the OneRowChange format is definitely a little incrutable. We need to revisit it at some point.

Can you provide an example of the code you are trying to execute? This would make it a bit easier to understand the problem you are looking at.

I'm going to be testing column suppression for a talk I'm doing at the MySQL UC and will post what I find. The big issue with this whole thing is that MySQL only gives us column numbers and not names, which makes it difficult to drop intervening columns. Putting in names has been on my list for a while but unfortunately we don't have data in the binlog itself that allows this. (I just thought of an idea to solve this using a slave-side filter, though...)

Finally, there's no convenient way to edit the SQL used in the Applier, if I understand your question correctly. We use prepared statements that are generated from table metadata. The logic to do this is located in class JdbcApplier if you want to take a closer look.

If you don't mind a little effort I will work with you to get this figured out. I should be able to post more information by the end of the weekend.

Cheers, Robert
 
Report to moderator   Logged Logged  
 
Robert Hodges
Continuent CTO
  The administrator has disabled public write access.
#675
Chris Picton (User)
Fresh Boarder
Posts: 8
graphgraph
User Offline Click here to see the profile of this user
Re:Replicating between different schemas 5 Months ago Karma: 0  
What I am currently doing is to use ROW replication on the master, process the rows on the slave and, for the tables that need it, replace the RowChangeData with a StatementData object:

(PS: your forum 'code' tags appear to strip newlines for the code and any text thereafter)

Code:

DBMSData dataElem = data.get(dataIndex); if (dataElem instanceof RowChangeData && I have to do changes to a particular table) { ... ... q = "SOME query built from dataElem"; StatementData newStmt = new StatementData(); newStmt.setDefaultSchema(schema); newStmt.setQuery(q); data.set(dataIndex, newStmt); }
This allows me to change ROW entries into queries which only modify some of the fields in the table. Can the filter code on the slave access a connection to the slave database, so I can do lookups against secondary tables while getting ROW records and transforming them into queries on the current table? Would your slave side filter read and cache column names, so they can be applied to your incoming rows? Regards Chris
 
Report to moderator   Logged Logged  
  The administrator has disabled public write access.
Go to top Post Reply
Powered by FireBoardget the latest posts directly to your desktop