View Issue Details

IDProjectCategoryView StatusLast Update
0001204SymmetricDSBugpublic2014-02-02 20:53
ReporterjosemaAssigned Tochenson 
Priorityhigh 
Status closedResolutionfixed 
Product Version3.3.5 
Target Version3.5.0Fixed in Version3.5.0 
Summary0001204: Invalid target node on "lookup table data router", trouble cache key resolution
DescriptionWhen routing data using "lookup table data router" lookup table data is cached with and invalid cache name. Data is routed using cached data from another lookup table cached previously.

API code generate a non unique cache key like "org.jumpmind.symmetric.route.LookupTableDataRouter..null"

See correction...

Class: org.jumpmind.symmetric.route.LookupTableDataRouter

...
protected Map<String, Set<String>> getLookupTable(final Map<String, String> params, Router router,
            SimpleRouterContext routingContext) {

Old Code --------------------------------------------------------vvvvvvvvvvvvv
        final String CTX_CACHE_KEY = LOOKUP_TABLE_KEY + "." + params.get("TABLENAME");
Old Code --------------------------------------------------------^^^^^^^^^^^

New Code -------------------------------------------------------vvvvvvvvvvvvvv
        final String CTX_CACHE_KEY = LOOKUP_TABLE_KEY + "." + params.get(PARAM_TABLE);
New Code --------------------------------------------------------^^^^^^^^^^^

        Map<String, Set<String>> lookupMap = (Map<String, Set<String>>) routingContext
                .getContextCache().get(CTX_CACHE_KEY);
        if (lookupMap == null) {
            ISqlTemplate template = symmetricDialect.getPlatform().getSqlTemplate();
            final Map<String, Set<String>> fillMap = new HashMap<String, Set<String>>();
            template.query(String.format("select %s, %s from %s",
                    params.get(PARAM_MAPPED_KEY_COLUMN), params.get(PARAM_EXTERNAL_ID_COLUMN),
                    params.get(PARAM_TABLE)), new ISqlRowMapper<Object>() {
                public Object mapRow(Row rs) {
                    String key = rs.getString(params.get(PARAM_MAPPED_KEY_COLUMN));
                    String value = rs.getString(params.get(PARAM_EXTERNAL_ID_COLUMN));
                    Set<String> ids = fillMap.get(key);
                    if (ids == null) {
                        ids = new HashSet<String>();
                        fillMap.put(key, ids);
                    }
                    ids.add(value);
                    return value;
                }
            });
            lookupMap = fillMap;
            routingContext.getContextCache().put(CTX_CACHE_KEY, lookupMap);
        }
        return lookupMap;
    }
Steps To ReproduceRouting data when router processes many "lookup table" results with alternate resultset values
Additional InformationApplies to all versions.
TagsNo tags attached.

Activities

chenson

2013-05-08 10:38

administrator   ~0000252

Good catch. Thanks.

chenson

2013-07-22 17:52

administrator   ~0000345

prepare for release

Related Changesets

SymmetricDS: master 0dc3e6cb

2013-05-08 10:38:24

chenson

Details Diff
0001204: Invalid target node on "lookup table data router", trouble cache key resolution
0001204
mod - symmetric-core/src/main/java/org/jumpmind/symmetric/route/LookupTableDataRouter.java Diff File

Issue History

Date Modified Username Field Change
2013-05-08 10:33 josema New Issue
2013-05-08 10:37 chenson Assigned To => chenson
2013-05-08 10:37 chenson Status new => assigned
2013-05-08 10:38 chenson Note Added: 0000252
2013-05-08 10:38 chenson Status assigned => resolved
2013-05-08 10:38 chenson Fixed in Version => 3.5.0
2013-05-08 10:38 chenson Resolution open => fixed
2013-05-08 10:38 chenson Target Version => 3.5.0
2013-07-22 17:52 chenson Note Added: 0000345
2013-07-22 17:52 chenson Status resolved => closed
2014-02-02 20:53 Changeset attached => SymmetricDS trunk r7172
2015-07-30 21:49 chenson Changeset attached => SymmetricDS master 0dc3e6cb