Thanks for the response. I'm glad to hear that this problem has been resolved.
Since our GeoMesa installation is nontrivial, I would rather wait until the fix is merged into the baseline. Any idea on when that might be?
Sent from my mobile device.
Hi Beau,
I think that this issue has been fixed with some of our recent refactoring. The following pseudo-code worked for me against a local accumulo mini-cluster. Could you try your test again with the latest branch? (note, you might need to pull a PR that hasn't been
merged yet that fixes a bug in deleting:
https://github.com/locationtech/geomesa/pull/141)
Thanks,
Emilio
void deleteThenAdd() {
DataStore dataStore = DataStoreFinder.getDataStore(params);
SimpleFeatureStore featureStore = (SimpleFeatureStore) dataStore.getFeatureSource(sftName);
String filterString = "...";
Filter filter = CQL.toFilter(filterString);
Query query = new Query(sftName, filter);
// query returns a single feature
SimpleFeature feature = this.query(featureStore, query);
logger.info("removing feature");
featureStore.removeFeatures(filter);
// this query returns 0 features
this.query(featureStore, query);
logger.info("re-adding feature");
DefaultFeatureCollection featureCollection = new DefaultFeatureCollection(sftName, feature.getFeatureType);
feature.getUserData.put(Hints.USE_PROVIDED_FID, true);
featureCollection.add(feature);
featureStore.addFeatures(featureCollection);
// returns the single feature again
this.query(featureStore, query);
}
SimpleFeature query(SimpleFeatureStore featureStore, Query query) {
int count = 0
SimpleFeature first = null
// execute the query
SimpleFeatureIterator features = featureStore.getFeatures(query).features();
while (features.hasNext()) {
count = count + 1;
if (first == null) {
first = features.next();
} else {
features.next();
}
}
logger.info("queried " + count + " features");
return first
}
On 07/21/2014 01:14 PM, Beau Lalonde wrote:
Anthony,
Thanks for the reply.
In my test and also in our real system we have witnessed this problem writing to accumulo from a single client (not using a map-reduce job). I should mention that accumulo is not on the same machine as the client that we are using to write.
In our real system I am confident that there is elapsed system time between the remove and add calls - in our junit test (partial code in original post), there might not be much elapsed time because of the simplicity of the test.
Thanks for your help,
Beau
Sent from my mobile device.
Beau,
Yes, you definitely can add/remove/add without problems in Accumulo. The only time you cannot do it without strange behaviour is if you set the timestamp exactly the same for each 'add'. GeoMesa does not explicitly set the timestamp, so it should get the
current system time for each mutation. Can you tell me a bit more about how you are writing to GeoMesa? Is it from the same client (with consistent system time) each time or is it from within a map-reduce job? If the latter, do you have ntpd setup to synchronize
system time? I'll put together a test to see if we can reproduce your issue.
Thanks,
Anthony
_______________________________________________
geomesa-users mailing list
geomesa-users@xxxxxxxxxxxxxxxx
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
http://www.locationtech.org/mailman/listinfo/geomesa-users