Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 373D3200CE0 for ; Wed, 26 Jul 2017 15:19:07 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 36067168D5F; Wed, 26 Jul 2017 13:19:07 +0000 (UTC) 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 7D0D7168D61 for ; Wed, 26 Jul 2017 15:19:06 +0200 (CEST) Received: (qmail 25823 invoked by uid 500); 26 Jul 2017 13:19:05 -0000 Mailing-List: contact issues-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 issues@cloudstack.apache.org Received: (qmail 25805 invoked by uid 500); 26 Jul 2017 13:19:05 -0000 Delivered-To: apmail-incubator-cloudstack-issues@incubator.apache.org Received: (qmail 25801 invoked by uid 99); 26 Jul 2017 13:19:04 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd4-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 26 Jul 2017 13:19:04 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd4-us-west.apache.org (ASF Mail Server at spamd4-us-west.apache.org) with ESMTP id 1FF19C0293 for ; Wed, 26 Jul 2017 13:19:04 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd4-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: -99.202 X-Spam-Level: X-Spam-Status: No, score=-99.202 tagged_above=-999 required=6.31 tests=[KAM_ASCII_DIVIDERS=0.8, RP_MATCHES_RCVD=-0.001, SPF_PASS=-0.001, USER_IN_WHITELIST=-100] autolearn=disabled Received: from mx1-lw-eu.apache.org ([10.40.0.8]) by localhost (spamd4-us-west.apache.org [10.40.0.11]) (amavisd-new, port 10024) with ESMTP id x3AuWCmaK0bh for ; Wed, 26 Jul 2017 13:19:03 +0000 (UTC) Received: from mailrelay1-us-west.apache.org (mailrelay1-us-west.apache.org [209.188.14.139]) by mx1-lw-eu.apache.org (ASF Mail Server at mx1-lw-eu.apache.org) with ESMTP id 82E205FD02 for ; Wed, 26 Jul 2017 13:19:02 +0000 (UTC) Received: from jira-lw-us.apache.org (unknown [207.244.88.139]) by mailrelay1-us-west.apache.org (ASF Mail Server at mailrelay1-us-west.apache.org) with ESMTP id 56753E0D57 for ; Wed, 26 Jul 2017 13:19:01 +0000 (UTC) Received: from jira-lw-us.apache.org (localhost [127.0.0.1]) by jira-lw-us.apache.org (ASF Mail Server at jira-lw-us.apache.org) with ESMTP id 67FEE23F1D for ; Wed, 26 Jul 2017 13:19:00 +0000 (UTC) Date: Wed, 26 Jul 2017 13:19:00 +0000 (UTC) From: "ASF subversion and git services (JIRA)" To: cloudstack-issues@incubator.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Commented] (CLOUDSTACK-8186) setRemoved(null) does not work as expected MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 archived-at: Wed, 26 Jul 2017 13:19:07 -0000 [ https://issues.apache.org/jira/browse/CLOUDSTACK-8186?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16101656#comment-16101656 ] ASF subversion and git services commented on CLOUDSTACK-8186: ------------------------------------------------------------- Commit 03aca885ae9ce53232d0ba3759d14737ba40f288 in cloudstack's branch refs/heads/4.10 from Wei Zhou [ https://gitbox.apache.org/repos/asf?p=cloudstack.git;h=03aca88 ] CLOUDSTACK-8186: make setRemoved to null possible > setRemoved(null) does not work as expected > ------------------------------------------ > > Key: CLOUDSTACK-8186 > URL: https://issues.apache.org/jira/browse/CLOUDSTACK-8186 > Project: CloudStack > Issue Type: Bug > Security Level: Public(Anyone can view this level - this is the default.) > Reporter: Wei Zhou > Assignee: Wei Zhou > Priority: Critical > > in cloudstack 4.5, there are two locations where set the removed field as null. > [root@localhost cloudstack.git(4.5)]# grep -r "setRemoved(null)" * > engine/schema/src/com/cloud/storage/dao/VMTemplateDaoImpl.java: tmpltZoneVO.setRemoved(null); > framework/cluster/src/com/cloud/cluster/ClusterManagerImpl.java: mshost.setRemoved(null); > As far as I think, the proposal is to clean the removed field in the database. > However, it does not work as expected. > The removed field will be set the current date. > After investigating for a long time, I find it is because the following part in ./framework/db/src/com/cloud/utils/db/GenericDaoBase.java > @DB() > protected void prepareAttribute(final int j, final PreparedStatement pstmt, final Attribute attr, Object value) throws SQLException { > if (attr.is(Attribute.Flag.DaoGenerated) && value == null) { > value = generateValue(attr); > if (attr.field == null) { > pstmt.setObject(j, value); > return; > } > } > ...... > @DB() > protected Object generateValue(final Attribute attr) { > if (attr.is(Attribute.Flag.Created) || attr.is(Attribute.Flag.Removed)) { > return new Date(); > ...... -- This message was sent by Atlassian JIRA (v6.4.14#64029)