From dev-return-9381-archive-asf-public=cust-asf.ponee.io@curator.apache.org Wed Nov 7 02:38:07 2018 Return-Path: X-Original-To: archive-asf-public@cust-asf.ponee.io Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by mx-eu-01.ponee.io (Postfix) with SMTP id 3FA20180658 for ; Wed, 7 Nov 2018 02:38:07 +0100 (CET) Received: (qmail 94880 invoked by uid 500); 7 Nov 2018 01:38:06 -0000 Mailing-List: contact dev-help@curator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@curator.apache.org Delivered-To: mailing list dev@curator.apache.org Received: (qmail 94869 invoked by uid 99); 7 Nov 2018 01:38:05 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 07 Nov 2018 01:38:05 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id D1291E1203; Wed, 7 Nov 2018 01:38:04 +0000 (UTC) From: njhill To: dev@curator.apache.org Reply-To: dev@curator.apache.org References: In-Reply-To: Subject: [GitHub] curator pull request #281: [CURATOR-483] Fix path used when re-creating sequ... Content-Type: text/plain Message-Id: <20181107013804.D1291E1203@git1-us-west.apache.org> Date: Wed, 7 Nov 2018 01:38:04 +0000 (UTC) Github user njhill commented on a diff in the pull request: https://github.com/apache/curator/pull/281#discussion_r231356314 --- Diff: curator-recipes/src/main/java/org/apache/curator/framework/recipes/nodes/PersistentNode.java --- @@ -445,7 +445,8 @@ private void createNode() try { String existingPath = nodePath.get(); - String createPath = (existingPath != null && !useProtection) ? existingPath : basePath; + String createPath = existingPath == null || (useProtection && !isSequential(mode)) ? basePath + : (useProtection ? basePath + existingPath.substring(existingPath.length()-10) : existingPath); --- End diff -- Thanks @cammckenzie. I reworked this to use if statements and defined a constant for the 10 number. I couldn't find such a constant defined elsewhere; it's hardcoded in the zookeeper code: https://github.com/apache/zookeeper/blob/master/zookeeper-server/src/main/java/org/apache/zookeeper/server/PrepRequestProcessor.java#L662. I also removed the redundant added static `isSequential(CreateMode)` method, didn't notice that this is already a method on the enum. ---