remove/unset a zk node data without deleting its children - apache-zookeeper

I am trying to unset a zookeeper node's data through its CLI. The target node has multiple children underneath and I do not want them to be affected by this. So, was wondering if there is any command for this. rm and rmr are not helpful in this case as they remove the entire path.

One of the options is to set an empty string as a value:
set /path/to/node ''
It doesn't unset the data, just overwrites it with an empty string.

Related

Is there a way to generate a unique identifier value only once (if not set) and cannot be edited by user

I want to generate a unique identifier of a specific length and use this value across multiple pods internally. Since the length must be specific, and I'd prefer this to be handled internally rather than be adjustable by a user, I'd prefer to create the unique identifier on install/upgrade (only once if has not been set already) and not be changeable.
I want to use the identifiers internally as part of a naming schema for objects created within a specific deployment. I want to share these objects across other deployments, and need the identifier to determine if a given object belongs to a given deployment.
I was looking into setting a value in Secrets using randAlphaNum. Some problems I face with using Secrets are:
Related to this issue: https://github.com/helm/helm/issues/3053
It looks like the Secret value will be overwritten on upgrade. There is an open PR for a possible fix: https://github.com/helm/helm/pull/5290
But I don't have the ability to upgrade helm/kubernetes atm
Secret value is b64 encoded. I want to pass the value as an environment variable to various pods decoded. It doesn't really matter if the user knows the unique identifier. So, maybe I don't need a Secret? But, again, I don't want the user to be able to edit the value and the value should never change for a given deployment.
Any help or suggestions are appreciated! Thanks
You may then try to use ConfigMap instead. Seems it doesn't change on helm upgrade. Then you can use this guide to pass the value from ConfigMap to the pods.

How to watch for creation of nodes two levels down using Apache Curator?

My goal is, given a CuratorFramework that is decorated with a path to a root node, and a String, to watch for events two levels down any path to that String.
More specifically, I would like to watch for events on any path ROOT/<anything here>/INPUT_STRING. I also need to watch for nodes being added in the middle layer, but I am not interested in the contents of those middle nodes (only that they appeared, so I can watch for a child to be created for the INPUT_STRING).
My idea was to create a NodeCache for each path to ROOT/<added middle node>/INPUT_STRING whenever a middle node is added. I thought I could then watch for middle nodes being added using a PathChildrenCache, but that seems like overkill since I'm not interested in the contents of the middle nodes.
Is there some better way to create a NodeCache for the INPUT_STRING two levels down? Or should I be using a PathChildrenCache, even though I don't care about the contents of the middle nodes?
You can use TreeCache to cache/watch/listen to a tree of ZNodes. I believe that will do what you need. http://curator.apache.org/curator-recipes/tree-cache.html

How to filter out all amenities with osmfilter together with any other tag information they have?

I managed to download a planet file from OSM, and converted it to o5m format with osmconvert, and additional deleted all of the author information from it, to keep the file size smaller. I am trying to fetch every POI from this database from the whole world, so I am not interested in cities, towns, highways, ways, etc, only amenities.
First I tried to achieve this by using osmosis, which as it appears manages to do what I want, only it always runs out of memory, cause the file is too huge to process. (I could split the file up to smaller ones, but I would like to avoid this if possible).
I tried experimenting with osmfilter, there, I managed to filter out every node which has a tag named amenity in it, but I have several problems which I can't solve:
a. if I use the following command:
osmfilter planet.o5m -v --keep-tags="amenity=" -o=amenities.osm
It keeps all nodes, and filters out every tag which doesn't have amenity in it's name.
b. if I use this command:
osmfilter planet.o5m -v --keep-tags="all amenity=" -o=amenities.osm
It now filters out all nodes which doesn't have the amenity tag, but also filters out all additional tags from the matching nodes, which contain information that I need(for example, name of the POI, or description)
c. if I use this command:
osmfilter planet.o5m -v --keep-tags="all amenity= all name=" -o=amenities.osm
Filters out every node which has EITHER name or amenity in it's tags, which leaves me with several named cities or highways(data that I don't need).
I also tried separating this with an AND operator, but it says, that I can't use AND operator when filtering for tags. Any idea how could I achieve the desired result?
End note: I am running a Windows 7 system, so no Linux based program would help me:|
Please try --keep= option instead of --keep-tags option. The latter has no influence on which object will be kept in the file.
For example:
osmfilter planet.o5m --keep="amenity= and name=" -o=amenities.osm
will keep just that objects which have an amenity tag AND a name tag.
Be aware that all dependent objects will also be in the output file. For example, if there is a way object with the requested tags, each node of this way will be in the output file as well. The same is valid for relations and their dependent ways and nodes.
If you do not want this kind of behaviour, please add --ignore-dependencies
Some more information can be found here: https://wiki.openstreetmap.org/wiki/Osmfilter
osmfilter inputfile.osm --keep-nodes="amenity=" --keep-tags="all amenity= name=" --ignore-dependencies -o=outputfile.osm
this is exactly what you are looking for:
keep nodes with the tag amenity (--keep-nodes)
keep only info about amenities and names (--keep-tags)

Swiftstack - Containers not getting removed

Even after deleting containers and objects directly from file system, Swift is listing the containers when executed GET command on it. However, if we try to delete the container with DELETE command then 404: Not Found error message is returned. Please explain whether there is something wrong or is there some kind of cache?
I think the problem came from deleting the containers and/or objects directly from the file system.
Swift's methods for handling write requests for object and container have to be very careful to ensure all the distributed index information remains eventually consistent. Direct modification of the file system is not sufficient. It sounds like the container databases got removed before they had a chance to update the account databases listings - perhaps manually unlinked before all of the object index information was removed?
Normally after a delete request the containers have to hang around for awhile as "tombstones" to ensure the account database gets updated correctly.
As a work around you could recreate them (with a POST) and then re-issue the DELETE; which should successfully allow the DELETE of the new empty containers and update the account database listing directly.
(Note: the container databases themselves, although empty, will still exist on disk as tombstones until the the reclaim_age passes)

Deleting multiple labels in perforce

I am working on a perforce-perl script that creates labels. Due to repeated execution of the script i have created hundreds of labels of the type LABEL_A.180 etc.
I want to know if there is any command or any other way by which I can delete multiple labels at a time?
There is no command or feature in P4V to delete multiple labels. The best approach will be just write another script that finds the labels and then removes them one-by-one.
I do not know the P4Perl API so I'm unable to give you an example, however it will be very similar to existing label creation just with an additional -d flag passed to the p4 label command.
HTH,