RE: strange SELECT results in postgresql slave

2015-05-20 Thread Mark Cassidy
Well the obvious fix is to run PostgreSQL on the same OS and version of OS + 
PostgreSQL.  :)

1.  Have you verified that the PK index was built successfully during the 
restore?   Or, if you used pgbasebackup, then since it is physical not logical 
replication something may be mismatched. Tried re-indexing the PK on server2?

If the pk index is broken for some reason on server 2, then this could explain 
it because Pg may not use indexes at all when doing LIKEs ... even with the % 
at the end ...if your locale isn't appropriate.  So the explain analyze may 
show that the LIKEs are not using the index even if LIKE 'xyz%'.

2. Aside from a bug with Postgres on the Mac, it may possibly be due to a 
locale/encoding problem so that's the second thing I'd check.  Maybe the @ sign 
is throwing it off for the locale? (since the problems seem to be around the 
email addresses on slave 2).  Not sure why LIKE seems to work though in the 
case.

3. Make sure Pg is the same version on all three.
   select version();

Good luck.  (But I would not do streaming replication across different OSs like 
this.)

Sent from my Verizon Wireless 4G LTE smartphone


 Original message 
From: Musall Maik m...@selbstdenker.ag
Date: 05/20/2015 8:25 AM (GMT-05:00)
To: WebObjects-Dev Apple webobjects-dev@lists.apple.com
Subject: strange SELECT results in postgresql slave

Hi,

I know many of you work with PostgreSQL so I'll try this here.

I have a strange case where a SELECT for a primary key returns 0 rows on one 
slave, while it returns the correct 1 row on another slave and on the master. 
It does however return that row on all slaves when queried with LIKE and 
trailing or leading wildcard.

psql version is 9.3.5, because that's what comes with Ubuntu 14.04 LTS
Master runs Ubuntu 14.04 LTS
Slave 1 runs also Ubuntu 14.04 LTS
Slave 2 runs Mac OS X 10.7, pgsql installed via homebrew

Both slaves are configured with streaming replication, and I've been using that 
setup for years, starting with psql 9.1, with no problems so far. Suspecting 
some weird problem, I already re-initialized slave 2 with a fresh backup and 
started replication from the beginning, so the database is fresh from a master 
copy, and is verified to be current.

2015-05-19 20:53:43.937 CEST LOG:  entering standby mode
2015-05-19 20:53:43.974 CEST LOG:  redo starts at 31/3F28
2015-05-19 20:53:45.522 CEST LOG:  consistent recovery state reached at 
31/40CCE6E8
2015-05-19 20:53:45.523 CEST LOG:  database system is ready to accept read only 
connections
2015-05-19 20:53:45.604 CEST LOG:  started streaming WAL from primary at 
31/4100 on timeline 1


So here's the query.

SELECT * FROM MyTable WHERE email = 'f...@example.com';

This returns 1 row on master and slave 1, but 0 on slave 2, while this query:

SELECT * FROM MyTable WHERE email LIKE 'f...@example.com%';

or this one

SELECT * FROM MyTable WHERE email LIKE '%f...@example.com';

returns the correct 1 row on all three systems. Note that this works with the 
wildcard on either end, or also somewhere in the middle, doesn't matter. Note: 
email is the primary key on this table.

This behaviour is the same with any address to be queried, and is also the same 
on a similar second table. This does NOT occur on any other table, which all 
have integer primary keys. There is also no problem when I select for other 
attributes on these tables.

Does anyone have a hint?

Thanks
Maik

 ___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/webobjects-dev/mcassidy%40escholar.com

This email sent to mcass...@escholar.com
 ___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

simple survey for PostgreSQL

2013-03-06 Thread Mark Cassidy
For any of you who may be using PostgreSQL, could you let me know what version 
of the JDBC driver you are using?   The version of PostgreSQL would be nice to 
know, but especially the JDBC driver version would be very helpful.

(We're using jdbc-9.2-1002, and Postgres is 9.1.1.)

Thanks for any info!
Mark


 ___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


ERXPageTracker question

2012-06-14 Thread Mark Cassidy
Hi,

If we used ERXPageTracker with Component Actions would that be sufficient for 
Google Analytics?  --Don't want to use Direct Actions if we can help it.

Thanks for any help,
Mark



 ___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


RE: ERXPageTracker question

2012-06-14 Thread Mark Cassidy
Thx Kieran for the nice example.  That's great.

From: Kieran Kelleher [mailto:kelleh...@gmail.com]
Sent: Thursday, June 14, 2012 12:09 PM
To: Mark Cassidy
Cc: webobjects-dev@lists.apple.com
Subject: Re: ERXPageTracker question

You can just roll your own tracker and track any string you like (build a 
pseudo URL, for example frameworkname/WOComponentname), since component action 
URLs won't be of much use I think.

Here is an example of a custom tracker component that resides in an application 
PageWrapper - it should be obvious how it works. Copy/paste/modify/profit. :-)

java
---

package wk.cheetah.statistics;

import org.apache.log4j.Logger;

import wk.foundation.WKStringUtilities;
import wk.webobjects.appserver.WKAbstractStatelessComponent;

import com.webobjects.appserver.WOComponent;
import com.webobjects.appserver.WOContext;

public class CTPageTracker extends WKAbstractStatelessComponent {

@SuppressWarnings(unused)
private static final Logger log = 
Logger.getLogger(CTPageTracker.class);

public CTPageTracker(WOContext context) {
super(context);
}


private String _gaScript;

/** @return the script for google analytics page tracking */
public String gaScript() {
if ( _gaScript == null ) {
StringBuilder b = new StringBuilder();
b.append(var _gaq = _gaq || [];\n);
b.append(_gaq.push(['_setAccount', 
'ENTER-YOUR-OWN-ID-HERE']););
b.append(_gaq.push(['_setDomainName', 
'none']););
b.append(_gaq.push(['_setAllowLinker', 
true]););

String pageName = null;
WOComponent page = context().page();
if (page != null) {
String frameworkName = 
page.frameworkName();
if (frameworkName == null) {
frameworkName = 
app;
}
pageName = / + frameworkName 
+ / + WKStringUtilities.lastElementOfString(page.name(), .);
} else {
pageName = UNKNOWN;
}
if (log.isDebugEnabled())
log.debug(pageName =  + 
(pageName == null ? null : pageName.toString()));

b.append(_gaq.push(['_trackPageview',' + 
pageName + ']);\n);
b.append((function() {\n);
b.append(var ga = 
document.createElement('script'); ga.type = 'text/javascript'; ga.async = 
true;\n);
b.append(ga.src = ('https:' == 
document.location.protocol ? 'https://ssl' : 'http://www') + 
'.google-analytics.com/ga.js';\n);
b.append(var s = 
document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, 
s);\n);
b.append(})();\n);

_gaScript = b.toString();
}
return _gaScript;
}
}



html


wo:ERXJavaScript scriptString = $gaScript/wo:ERXJavaScript




On Jun 14, 2012, at 11:51 AM, Mark Cassidy wrote:


Hi,

If we used ERXPageTracker with Component Actions would that be sufficient for 
Google Analytics?  --Don't want to use Direct Actions if we can help it.

Thanks for any help,
Mark



___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  
(Webobjects-dev@lists.apple.commailto:Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/webobjects-dev/kelleherk%40gmail.com

This email sent to kelleh...@gmail.commailto:kelleh...@gmail.com

 ___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


ERXRunnables with their own EOEditingContexts

2012-03-09 Thread Mark Cassidy
Hi,

I'm creating separate threads with ERXTaskThreadPoolExecutor/ERXRunnable's and 
those are working fine using my default EOF access each creating and using an 
EOEditingContext.   However, now I need to access a different database as well 
within the threads.  This is how I am creating the EOEditingContext for this 
additional database - calling a method that does this -
   EOObjectStoreCoordinator objectStoreCoordinator =
  objectStoreForEGMLocation.get(eGMLocationId);
   if(objectStoreCoordinator == null) {
  objectStoreCoordinator = new ERXObjectStoreCoordinator();
  EOModelGroup.setModelGroupForObjectStoreCoordinator(
 objectStoreCoordinator, 
modelGroupForEGMLocation(eGMLocationId));
  objectStoreForEGMLocation.put(eGMLocationId, 
objectStoreCoordinator);
   }
   return ERXEC.newEditingContext(objectStoreCoordinator);

It creates the new database's EOEditingContext fine in each of the threads, 
locks().  But then only one thread runs the SQL in it and then the others are 
stuck at trying to do the SQL access - never show any SQL execution and the 
threads simple wait.   I am doing a
try {  ec.lock();. finally {ec.unlock(); }
for all of them to make sure the individual editingcontexts are properly 
unlocking.

Any idea why they may be blocking/locking using these type of EOEditingContext 
when the defeault editing contexts in these threads work fine?  I am assuming 
that somehow it is the same EOEditingContext.  I printed the hashcode value for 
all of them and they're different but maybe the underlying object cache is the 
same.   Should I create the EOEditingContext differently?

Thanks for any help,
Mark
 ___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com