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 cust-asf.ponee.io (Postfix) with SMTP id 386A2160C13 for ; Mon, 25 Dec 2017 10:02:36 +0100 (CET) Received: (qmail 90652 invoked by uid 500); 25 Dec 2017 09:02:35 -0000 Mailing-List: contact commits-help@cloudstack.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@cloudstack.apache.org Delivered-To: mailing list commits@cloudstack.apache.org Received: (qmail 90642 invoked by uid 99); 25 Dec 2017 09:02:35 -0000 Received: from ec2-52-202-80-70.compute-1.amazonaws.com (HELO gitbox.apache.org) (52.202.80.70) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 25 Dec 2017 09:02:35 +0000 From: GitBox To: commits@cloudstack.apache.org Subject: [GitHub] niteshsarda commented on issue #2373: CLOUDSTACK-10202:createSnapshotPolicy API create multiple entries in DB for same parameters. Message-ID: <151419255470.8085.18333483949885769980.gitbox@gitbox.apache.org> archived-at: Mon, 25 Dec 2017 09:02:36 -0000 niteshsarda commented on issue #2373: CLOUDSTACK-10202:createSnapshotPolicy API create multiple entries in DB for same parameters. URL: https://github.com/apache/cloudstack/pull/2373#issuecomment-353851302 @marcaurele : One of our customer have reported this scenario, where they have multiple management servers and when parallel request comes for snapshot policy creation for same volume, then multiple entries are created in DB for same volume. As per the code, only one snapshot policy entry should be created in database for each volume. Whenever, another request of snapshot policy comes for the same volume, then existing entry should be updated. Same behavior is observed, when volume have existing snapshot policy and parallel threads are executed, then only single entry is getting updated every time. This is because, we have lock available in code in else block. Whereas, in case of first snapshot policy creation for volume, DB lock is not available, hence it creates multiple DB entries. As multiple management servers might send API requests in parallel for same volume, we should handle this from our code and allow to create only one entry in DB for each volume. Also, I apologize for confusing title of the PR, I have updated the same, to make it more clear and relevant to the fix. ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: users@infra.apache.org With regards, Apache Git Services