Permalink
Browse files

Removes WalrusStatistics and the walrus-stats.log file. Fixes EUCA-4724.

WalrusStatistics and StorageStatistics are no longer used since reporting
has become the source for usage. The log files are no longer needed.
  • Loading branch information...
1 parent 43d4bbc commit 0deaa6f04460acb369ac968a55fc495bdebaac73 Zach Hill committed Mar 5, 2013
@@ -1,151 +0,0 @@
-/*************************************************************************
- * Copyright 2009-2012 Eucalyptus Systems, Inc.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; version 3 of the License.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see http://www.gnu.org/licenses/.
- *
- * Please contact Eucalyptus Systems, Inc., 6755 Hollister Ave., Goleta
- * CA 93117, USA or visit http://www.eucalyptus.com/licenses/ if you need
- * additional information or have any questions.
- *
- * This file may incorporate work covered under the following copyright
- * and permission notice:
- *
- * Software License Agreement (BSD License)
- *
- * Copyright (c) 2008, Regents of the University of California
- * All rights reserved.
- *
- * Redistribution and use of this software in source and binary forms,
- * with or without modification, are permitted provided that the
- * following conditions are met:
- *
- * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *
- * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer
- * in the documentation and/or other materials provided with the
- * distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
- * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
- * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE. USERS OF THIS SOFTWARE ACKNOWLEDGE
- * THE POSSIBLE PRESENCE OF OTHER OPEN SOURCE LICENSED MATERIAL,
- * COPYRIGHTED MATERIAL OR PATENTED MATERIAL IN THIS SOFTWARE,
- * AND IF ANY SUCH MATERIAL IS DISCOVERED THE PARTY DISCOVERING
- * IT MAY INFORM DR. RICH WOLSKI AT THE UNIVERSITY OF CALIFORNIA,
- * SANTA BARBARA WHO WILL THEN ASCERTAIN THE MOST APPROPRIATE REMEDY,
- * WHICH IN THE REGENTS' DISCRETION MAY INCLUDE, WITHOUT LIMITATION,
- * REPLACEMENT OF THE CODE SO IDENTIFIED, LICENSING OF THE CODE SO
- * IDENTIFIED, OR WITHDRAWAL OF THE CODE CAPABILITY TO THE EXTENT
- * NEEDED TO COMPLY WITH ANY SUCH LICENSES OR RIGHTS.
- ************************************************************************/
-
-package edu.ucsb.eucalyptus.cloud.entities;
-
-import javax.persistence.Column;
-import org.hibernate.annotations.Entity;
-import javax.persistence.GeneratedValue;
-import javax.persistence.Id;
-import javax.persistence.PersistenceContext;
-import javax.persistence.Table;
-import org.hibernate.annotations.Cache;
-import org.hibernate.annotations.CacheConcurrencyStrategy;
-import com.eucalyptus.entities.AbstractPersistent;
-
-@Entity @javax.persistence.Entity
-@PersistenceContext(name="eucalyptus_storage")
-@Table( name = "storage_stats_info" )
-@Cache( usage = CacheConcurrencyStrategy.TRANSACTIONAL )
-public class StorageStatsInfo extends AbstractPersistent {
- @Column(name = "storage_name")
- private String name;
- @Column( name = "number_volumes" )
- private Integer numberOfVolumes;
- @Column( name = "total_space_used" )
- private Long totalSpaceUsed;
-
- public StorageStatsInfo() {}
-
- public StorageStatsInfo(final String name) {
- this.name = name;
- }
-
- public StorageStatsInfo(final String name,
- Integer numberOfVolumes,
- Long totalSpaceUsed) {
- this.name = name;
- this.numberOfVolumes = numberOfVolumes;
- this.totalSpaceUsed = totalSpaceUsed;
- }
-
- public String getName() {
- return name;
- }
-
- public void setName(String name) {
- this.name = name;
- }
-
- public Integer getNumberOfVolumes() {
- return numberOfVolumes;
- }
-
- public void setNumberOfVolumes(Integer numberOfVolumes) {
- this.numberOfVolumes = numberOfVolumes;
- }
-
- public Long getTotalSpaceUsed() {
- return totalSpaceUsed;
- }
-
- public void setTotalSpaceUsed(Long totalSpaceUsed) {
- this.totalSpaceUsed = totalSpaceUsed;
- }
-
- @Override
- public int hashCode() {
- final int prime = 31;
- int result = 1;
- result = prime * result + ((name == null) ? 0 : name.hashCode());
- return result;
- }
-
- @Override
- public boolean equals(Object obj) {
- if (this == obj)
- return true;
- if (obj == null)
- return false;
- if (getClass() != obj.getClass())
- return false;
- StorageStatsInfo other = (StorageStatsInfo) obj;
- if (name == null) {
- if (other.name != null)
- return false;
- } else if (!name.equals(other.name))
- return false;
- return true;
- }
-
-
-}
@@ -127,22 +127,6 @@
<param name="ConversionPattern" value="%d{EEE MMM d HH:mm:ss yyyy} %5p [%C.%M(%F):%L] %m%n" />
</layout>
</appender>
- <appender name="walrus-stats-log" class="org.apache.log4j.RollingFileAppender">
- <param name="File" value="${euca.log.dir}/walrus-stats.log" />
- <param name="MaxFileSize" value="10MB" />
- <param name="MaxBackupIndex" value="10" />
- <layout class="org.apache.log4j.PatternLayout">
- <param name="ConversionPattern" value="Timestamp: %d{ISO8601} %m%n" />
- </layout>
- </appender>
- <appender name="sc-stats-log" class="org.apache.log4j.RollingFileAppender">
- <param name="File" value="${euca.log.dir}/sc-stats.log" />
- <param name="MaxFileSize" value="10MB" />
- <param name="MaxBackupIndex" value="10" />
- <layout class="org.apache.log4j.PatternLayout">
- <param name="ConversionPattern" value="Timestamp: %d{ISO8601} %m%n" />
- </layout>
- </appender>
<appender name="upgrade" class="org.apache.log4j.FileAppender">
<param name="File" value="${euca.log.dir}/upgrade.log" />
<layout class="org.apache.log4j.PatternLayout">
@@ -312,14 +296,6 @@
<priority value="FATAL" />
<appender-ref ref="cloud-exhaust" />
</category>
- <category name="edu.ucsb.eucalyptus.cloud.ws.WalrusStatistics" additivity="true">
- <priority value="INFO" />
- <appender-ref ref="walrus-stats-log" />
- </category>
- <category name="edu.ucsb.eucalyptus.cloud.ws.BlockStorageStatistics" additivity="true">
- <priority value="INFO" />
- <appender-ref ref="sc-stats-log" />
- </category>
<category name="org.apache.commons.httpclient" additivity="true">
<priority value="ERROR" />
<appender-ref ref="${euca.log.appender}" />
@@ -232,11 +232,8 @@
private StorageManager storageManager;
private WalrusImageManager walrusImageManager;
- private static WalrusStatistics walrusStatistics = null;
- public static void configure() {
- walrusStatistics = new WalrusStatistics();
- }
+ public static void configure() {}
public WalrusManager(StorageManager storageManager, WalrusImageManager walrusImageManager) {
this.storageManager = storageManager;
@@ -439,9 +436,6 @@ public CreateBucketResponseType createBucket(CreateBucketType request)
db.add(bucket);
db.commit();
storageManager.createBucket(bucketName);
- if (WalrusProperties.trackUsageStatistics)
- walrusStatistics.incrementBucketCount();
-
} catch (IOException ex) {
LOG.error(ex, ex);
throw new BucketAlreadyExistsException(bucketName);
@@ -558,10 +552,7 @@ public DeleteBucketResponseType deleteBucket(DeleteBucketType request) throws Eu
// Actually remove the bucket from the backing store
try {
storageManager.deleteBucket(bucketName);
- if (WalrusProperties.trackUsageStatistics) {
- walrusStatistics.decrementBucketCount();
- }
-
+
/* Send an event to reporting to report this S3 usage. */
//fireBucketUsageEvent(S3BucketAction.BUCKETDELETE, bucketFound.getNaturalId(),
@@ -1025,10 +1016,6 @@ public PutObjectResponseType putObject(PutObjectType request) throws EucalyptusC
foundObject.setDeleted(false);
reply.setSize(size);
- if (WalrusProperties.trackUsageStatistics) {
- walrusStatistics.updateBytesIn(size);
- walrusStatistics.updateSpaceUsed(size);
- }
if (logData != null) {
logData.setObjectSize(size);
updateLogData(bucket, logData);
@@ -1408,10 +1395,6 @@ public PutObjectInlineResponseType putObjectInline(
foundObject.setEtag(md5);
foundObject.setSize(size);
- if (WalrusProperties.trackUsageStatistics) {
- walrusStatistics.updateBytesIn(size);
- walrusStatistics.updateSpaceUsed(size);
- }
// Add meta data if specified
if (request.getMetaData() != null)
foundObject.replaceMetaData(request.getMetaData());
@@ -1736,7 +1719,6 @@ public void run() {
try {
storageManager.deleteObject(bucketName, objectName);
if (WalrusProperties.trackUsageStatistics && (size > 0))
- walrusStatistics.updateSpaceUsed(-size);
/* Send an event to reporting to report this S3 usage. */
if ( size > 0 ) {
@@ -2494,9 +2476,7 @@ public GetObjectResponseType getObject(GetObjectType request) throws EucalyptusC
+ ".torrent;", request
.getIsCompressed(),
null, logData);
- if (WalrusProperties.trackUsageStatistics) {
- walrusStatistics.updateBytesOut(torrentLength);
- }
+
return null;
} else {
//No torrent exists
@@ -2553,9 +2533,6 @@ public GetObjectResponseType getObject(GetObjectType request) throws EucalyptusC
//fireUsageEvent For Get Object
} else {
// support for large objects
- if (WalrusProperties.trackUsageStatistics) {
- walrusStatistics.updateBytesOut(objectInfo.getSize());
- }
storageManager.sendObject(request,
httpResponse, bucketName, objectName, size,
etag, DateUtils.format(lastModified
@@ -2759,9 +2736,6 @@ public GetObjectExtendedResponseType getObjectExtended(GetObjectExtendedType req
: WalrusProperties.NULL_VERSION_ID;
}
if (request.getGetData()) {
- if (WalrusProperties.trackUsageStatistics) {
- walrusStatistics.updateBytesOut(size);
- }
storageManager.sendObject(request,
httpResponse, bucketName, objectName,
byteRangeStart, byteRangeEnd + 1, size, etag,
@@ -3048,10 +3022,6 @@ public CopyObjectResponseType copyObject(CopyObjectType request)
storageManager.copyObject(sourceBucket,
sourceObjectName, destinationBucket,
destinationObjectName);
- if (WalrusProperties.trackUsageStatistics)
- walrusStatistics
- .updateSpaceUsed(sourceObjectInfo
- .getSize());
} catch (Exception ex) {
LOG.error(ex);
db.rollback();
@@ -3768,8 +3738,6 @@ public void fastDeleteBucket(DeleteBucketType request) throws EucalyptusCloudExc
// Actually remove the bucket from the backing store
try {
storageManager.deleteBucket(bucketName);
- if (WalrusProperties.trackUsageStatistics)
- walrusStatistics.decrementBucketCount();
} catch (IOException ex) {
// set exception code in reply
LOG.error(ex);
Oops, something went wrong.

0 comments on commit 0deaa6f

Please sign in to comment.