Solr
  1. Solr
  2. SOLR-6397

zkcli script put/putfile should allow overwriting an existing znode's data

    Details

      Description

      zkcli doesn't allow me to update a znode that already exists, perhaps using a -f (force) flag?

      Currently, if I want to putfile for a znode that already exists, results in:

      Exception in thread "main" org.apache.zookeeper.KeeperException$NodeExistsException: KeeperErrorCode = NodeExists for /clusterstate.json
      at org.apache.zookeeper.KeeperException.create(KeeperException.java:119)
      at org.apache.zookeeper.KeeperException.create(KeeperException.java:51)
      at org.apache.zookeeper.ZooKeeper.create(ZooKeeper.java:783)
      at org.apache.solr.common.cloud.SolrZkClient$6.execute(SolrZkClient.java:273)
      at org.apache.solr.common.cloud.SolrZkClient$6.execute(SolrZkClient.java:270)
      at org.apache.solr.common.cloud.ZkCmdExecutor.retryOperation(ZkCmdExecutor.java:73)
      at org.apache.solr.common.cloud.SolrZkClient.create(SolrZkClient.java:270)
      at org.apache.solr.cloud.ZkCLI.main(ZkCLI.java:268)

      The workaround is to use ZooKeeper's command-line set command with "`cat <file>`"

        Activity

        Hide
        Mark Miller added a comment -

        Yeah, I think it's just an oversight. I'd probably go without requiring -f myself.

        Show
        Mark Miller added a comment - Yeah, I think it's just an oversight. I'd probably go without requiring -f myself.
        Hide
        Timothy Potter added a comment -

        Fix is trivial - I'll get this one done today while waiting on tests to run

        Show
        Timothy Potter added a comment - Fix is trivial - I'll get this one done today while waiting on tests to run
        Hide
        Marcelo Rodrigues added a comment -

        If this client instance has a "setData" method:
        SolrZkClient zkClient = null;

        how about including a "makepath" call in case the znode doesn't exist and replace the "create" call with "setData"?
        else if (line.getOptionValue(CMD).equals(PUT)) {
        ...
        zkClient.create(arglist.get(0).toString(), arglist.get(1).toString().getBytes("UTF-8") // replace it here

        Apologies in advance for the intrusive comment, just an idea.

        Show
        Marcelo Rodrigues added a comment - If this client instance has a "setData" method: SolrZkClient zkClient = null; how about including a "makepath" call in case the znode doesn't exist and replace the "create" call with "setData"? else if (line.getOptionValue(CMD).equals(PUT)) { ... zkClient.create(arglist.get(0).toString(), arglist.get(1).toString().getBytes("UTF-8") // replace it here Apologies in advance for the intrusive comment, just an idea.
        Hide
        Gili Nachum added a comment -

        One workaround is to delete the znode (cmd clear) then put it in place again (cmd putfile).

        Show
        Gili Nachum added a comment - One workaround is to delete the znode (cmd clear) then put it in place again (cmd putfile).
        Hide
        ASF subversion and git services added a comment -

        Commit 1647828 from Timothy Potter in branch 'dev/trunk'
        [ https://svn.apache.org/r1647828 ]

        SOLR-6397: zkcli script put/putfile should allow overwriting an existing znode's data

        Show
        ASF subversion and git services added a comment - Commit 1647828 from Timothy Potter in branch 'dev/trunk' [ https://svn.apache.org/r1647828 ] SOLR-6397 : zkcli script put/putfile should allow overwriting an existing znode's data
        Hide
        ASF subversion and git services added a comment -

        Commit 1647842 from Timothy Potter in branch 'dev/branches/branch_5x'
        [ https://svn.apache.org/r1647842 ]

        SOLR-6397: zkcli script put/putfile should allow overwriting an existing znode's data

        Show
        ASF subversion and git services added a comment - Commit 1647842 from Timothy Potter in branch 'dev/branches/branch_5x' [ https://svn.apache.org/r1647842 ] SOLR-6397 : zkcli script put/putfile should allow overwriting an existing znode's data
        Hide
        Anshum Gupta added a comment -

        Bulk close after 5.0 release.

        Show
        Anshum Gupta added a comment - Bulk close after 5.0 release.

          People

          • Assignee:
            Timothy Potter
            Reporter:
            Timothy Potter
          • Votes:
            2 Vote for this issue
            Watchers:
            6 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Time Tracking

              Estimated:
              Original Estimate - 1h
              1h
              Remaining:
              Remaining Estimate - 1h
              1h
              Logged:
              Time Spent - Not Specified
              Not Specified

                Development