Couchbase 1.8.0 some queries - couchbase

Few queries regarding couchbase 1.8.0
Does putting blank value deletes the key or the key remains as it is
Is there any way to get all the keys from a bucket. Is there any ways to flush keys from a bucket from Admin panel.
Thanks

No, blank is a "value", and you cannot send null (at least from Java). So you need to remove it using a delete operation or a TTL.
Not in 1.8, in Couchbase 2.x you can create a simple view that emit(meta.id) and query this view.

Related

Kafka Connect MySQL

I am using Kafka connect to upsert records into MySql. However, the default option is INSERT .. ON DUPLICATE KEY REPLACE .. I am wondering if there is a way to change this - i.e: on duplicate keys, I would like to add the columns together.
Looking at the docs I would say the answer is no. INSERT or UPSERT is your choice.
You could address this in the database, or with a Kafka Streams app to perform the logical processing (adding fields together) as required.

Pushing a Mongo or MySQL DB from a dev environment to prod -- Ignoring rows that exist

I've been trying to find a way to take a database and "push" it up to a server, but have it ignore rows that collide (effectively, only inserting rows that have unique keys). Is this possible? I've tried Googling it a bit to no avail.
A lot depends on your exact use case, but you could try mongoexport and mongoimport to perform this for each collection. mongoimport supports a --upsert flag that allows you to update existing documents that already exist if that is desired behavior. If not it should reject documents with the same unique key.

MySQL Workbench - Fix Index Names Warning

I have a new client that is running a Symfony application with 170 or so MySQL tables. He recently updated his MySQL Workbench to the latest revision and is now getting a warning pop-up when he launched the application
FIX INDEX NAMES
Index names identical to FK names were found in the model, which is not allowed for MySQL5.5 and later. Would you like to rename the indexes?
I am not a DBA but I understand that the index and primary key names are clashing. What are the implications of renaming these indexes vs. just ignoring?
The Symfony app he is running uses the Doctrine ORM, would any queries or the model need to be updated should the indexes be renamed?
Using the InnoDB engine
Thanks
MySQL Workbench checks at opening a model if there are any duplicate index names and offers to rename them to be unique. Letting it doing this has not bad side effect. In fact it is even necessary to be able to apply the model to a server. Otherwise the server will refuse to create tables that contain an index with a name that was already taken.
So in short: it's a good idea to let Workbench fix this bug (since duplicate key names are nothing but a bug).

Primary Key generation MySQL Hibernate

I have an application deployed across 2 instances.
Database: MySQL
ORM: Hibernate
However, I need to implement an Oracle sequence like behaviour. Since MySQL doesn't have any, I simply created a table with an AUTO_INCREMENT and a method to return the value from it. It's thread-safe , so its not a problem when I deploy this application on 1 server. However, I dont think this thread-safe behaviour will hold true across multiple JVMs.
What to do in this case?
It is safe to use across multiple JVMs. MySQL issues each ID once. Use getGeneratedKeys() on a ResultSet to retrieve the generated ID.

What is the best way to make two instances in Solr which use identical schemas?

I got indexed a Mysql database using Solr and everything is perfect. Now i got another database which uses exactly the same schema as my first database but with different data in it.
What i want is to use Solr to index also the second database using the same solr schema that i created for my first database since are completely the same!
I read that Solr cores allows you to run multiple instances that use different configuration sets and indexes, but in my case i got the same exactly configuration, the only thing that changes is the database name.
My question is what is the best way two create two Solr instances that use the same configuration?
Cheers
You could use two cores and share a schema. Just read the Wiki. But in practice you might want to keep the flexibility and just copy the schema for a second core.
How about using only one solr instance but have a field in the schema that contains a value which indicates which db/source the record came from.