diff --git a/collector/src/main/java/com/navercorp/pinpoint/collector/dao/hbase/HbaseApiMetaDataDao.java b/collector/src/main/java/com/navercorp/pinpoint/collector/dao/hbase/HbaseApiMetaDataDao.java index a57cdb5c2796..a98b37fb75a2 100644 --- a/collector/src/main/java/com/navercorp/pinpoint/collector/dao/hbase/HbaseApiMetaDataDao.java +++ b/collector/src/main/java/com/navercorp/pinpoint/collector/dao/hbase/HbaseApiMetaDataDao.java @@ -34,6 +34,7 @@ /** * @author emeroad + * @author minwoo.jung */ @Repository public class HbaseApiMetaDataDao implements ApiMetaDataDao { @@ -68,7 +69,7 @@ public void insert(TApiMetaData apiMetaData) { buffer.put(-1); } final byte[] apiMetaDataBytes = buffer.getBuffer(); - put.addColumn(HBaseTables.API_METADATA_CF_API, apiMetaDataBytes, null); + put.addColumn(HBaseTables.API_METADATA_CF_API, HBaseTables.API_METADATA_CF_API_QUALI_SIGNATURE, apiMetaDataBytes); hbaseTemplate.put(HBaseTables.API_METADATA, put); } diff --git a/collector/src/main/java/com/navercorp/pinpoint/collector/dao/hbase/HbaseSqlMetaDataCompatibility.java b/collector/src/main/java/com/navercorp/pinpoint/collector/dao/hbase/HbaseSqlMetaDataCompatibility.java index d231d7574ca1..d60ad02041d6 100644 --- a/collector/src/main/java/com/navercorp/pinpoint/collector/dao/hbase/HbaseSqlMetaDataCompatibility.java +++ b/collector/src/main/java/com/navercorp/pinpoint/collector/dao/hbase/HbaseSqlMetaDataCompatibility.java @@ -31,6 +31,7 @@ * @author minwoo.jung */ //@Repository +@Deprecated public class HbaseSqlMetaDataCompatibility implements SqlMetaDataDao { private final Logger logger = LoggerFactory.getLogger(this.getClass()); diff --git a/collector/src/main/java/com/navercorp/pinpoint/collector/dao/hbase/HbaseSqlMetaDataDao.java b/collector/src/main/java/com/navercorp/pinpoint/collector/dao/hbase/HbaseSqlMetaDataDao.java index c0d4673ebb78..e07619b0e68e 100644 --- a/collector/src/main/java/com/navercorp/pinpoint/collector/dao/hbase/HbaseSqlMetaDataDao.java +++ b/collector/src/main/java/com/navercorp/pinpoint/collector/dao/hbase/HbaseSqlMetaDataDao.java @@ -33,6 +33,7 @@ /** * @author emeroad + * @author minwoo.jung */ //@Repository public class HbaseSqlMetaDataDao implements SqlMetaDataDao { diff --git a/collector/src/main/java/com/navercorp/pinpoint/collector/dao/hbase/HbaseSqlMetaDataPastVersionDao.java b/collector/src/main/java/com/navercorp/pinpoint/collector/dao/hbase/HbaseSqlMetaDataPastVersionDao.java index 1d9e1f41b921..bf0c672df9ae 100644 --- a/collector/src/main/java/com/navercorp/pinpoint/collector/dao/hbase/HbaseSqlMetaDataPastVersionDao.java +++ b/collector/src/main/java/com/navercorp/pinpoint/collector/dao/hbase/HbaseSqlMetaDataPastVersionDao.java @@ -33,8 +33,10 @@ /** * @author emeroad + * @author minwoo.jung */ //@Repository +@Deprecated public class HbaseSqlMetaDataPastVersionDao implements SqlMetaDataDao { private final Logger logger = LoggerFactory.getLogger(this.getClass()); diff --git a/collector/src/main/java/com/navercorp/pinpoint/collector/dao/hbase/HbaseStringMetaDataDao.java b/collector/src/main/java/com/navercorp/pinpoint/collector/dao/hbase/HbaseStringMetaDataDao.java index 11288a5961cb..ee506926cbf1 100644 --- a/collector/src/main/java/com/navercorp/pinpoint/collector/dao/hbase/HbaseStringMetaDataDao.java +++ b/collector/src/main/java/com/navercorp/pinpoint/collector/dao/hbase/HbaseStringMetaDataDao.java @@ -33,6 +33,7 @@ /** * @author emeroad + * @author minwoo.jung */ @Repository public class HbaseStringMetaDataDao implements StringMetaDataDao { @@ -62,8 +63,7 @@ public void insert(TStringMetaData stringMetaData) { Put put = new Put(rowKey); String stringValue = stringMetaData.getStringValue(); byte[] sqlBytes = Bytes.toBytes(stringValue); - // added sqlBytes into qualifier intentionally not to conflict hashcode - put.addColumn(HBaseTables.STRING_METADATA_CF_STR, sqlBytes, null); + put.addColumn(HBaseTables.STRING_METADATA_CF_STR, HBaseTables.STRING_METADATA_CF_STR_QUALI_STRING, sqlBytes); hbaseTemplate.put(HBaseTables.STRING_METADATA, put); } diff --git a/commons-hbase/src/main/java/com/navercorp/pinpoint/common/hbase/HBaseTables.java b/commons-hbase/src/main/java/com/navercorp/pinpoint/common/hbase/HBaseTables.java index 0eafe4480157..74776724b9a5 100644 --- a/commons-hbase/src/main/java/com/navercorp/pinpoint/common/hbase/HBaseTables.java +++ b/commons-hbase/src/main/java/com/navercorp/pinpoint/common/hbase/HBaseTables.java @@ -68,9 +68,11 @@ public final class HBaseTables { public static final String STRING_METADATA = "StringMetaData"; public static final byte[] STRING_METADATA_CF_STR = Bytes.toBytes("Str"); + public static final byte[] STRING_METADATA_CF_STR_QUALI_STRING = Bytes.toBytes("P_string"); public static final String API_METADATA = "ApiMetaData"; public static final byte[] API_METADATA_CF_API = Bytes.toBytes("Api"); + public static final byte[] API_METADATA_CF_API_QUALI_SIGNATURE = Bytes.toBytes("P_api_signature"); public static final String MAP_STATISTICS_CALLER = "ApplicationMapStatisticsCaller"; public static final byte[] MAP_STATISTICS_CALLER_CF_COUNTER = Bytes.toBytes("C"); diff --git a/web/src/main/java/com/navercorp/pinpoint/web/dao/hbase/HbaseSqlMetaDataCompatibility.java b/web/src/main/java/com/navercorp/pinpoint/web/dao/hbase/HbaseSqlMetaDataCompatibility.java index 39bd2001f560..b2488905c6fd 100644 --- a/web/src/main/java/com/navercorp/pinpoint/web/dao/hbase/HbaseSqlMetaDataCompatibility.java +++ b/web/src/main/java/com/navercorp/pinpoint/web/dao/hbase/HbaseSqlMetaDataCompatibility.java @@ -1,3 +1,18 @@ +/* + * Copyright 2014 NAVER Corp. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package com.navercorp.pinpoint.web.dao.hbase; import java.util.ArrayList; @@ -12,6 +27,10 @@ import com.navercorp.pinpoint.common.hbase.HBaseTables; import com.navercorp.pinpoint.web.dao.SqlMetaDataDao; +/** + * @author minwoo.jung + */ +@Deprecated public class HbaseSqlMetaDataCompatibility implements SqlMetaDataDao { private final Logger logger = LoggerFactory.getLogger(this.getClass()); diff --git a/web/src/main/java/com/navercorp/pinpoint/web/dao/hbase/HbaseSqlMetaDataPastVersionDao.java b/web/src/main/java/com/navercorp/pinpoint/web/dao/hbase/HbaseSqlMetaDataPastVersionDao.java index b68002c072f6..f496819b3937 100644 --- a/web/src/main/java/com/navercorp/pinpoint/web/dao/hbase/HbaseSqlMetaDataPastVersionDao.java +++ b/web/src/main/java/com/navercorp/pinpoint/web/dao/hbase/HbaseSqlMetaDataPastVersionDao.java @@ -35,6 +35,7 @@ * @author minwoo.jung */ //@Repository +@Deprecated public class HbaseSqlMetaDataPastVersionDao implements SqlMetaDataDao { @Autowired diff --git a/web/src/main/java/com/navercorp/pinpoint/web/mapper/ApiMetaDataMapper.java b/web/src/main/java/com/navercorp/pinpoint/web/mapper/ApiMetaDataMapper.java index 594b3caf8c0c..417c7d5fa2ee 100644 --- a/web/src/main/java/com/navercorp/pinpoint/web/mapper/ApiMetaDataMapper.java +++ b/web/src/main/java/com/navercorp/pinpoint/web/mapper/ApiMetaDataMapper.java @@ -23,11 +23,13 @@ import com.navercorp.pinpoint.common.bo.ApiMetaDataBo; import com.navercorp.pinpoint.common.buffer.Buffer; import com.navercorp.pinpoint.common.buffer.FixedBuffer; +import com.navercorp.pinpoint.common.hbase.HBaseTables; import com.sematext.hbase.wd.RowKeyDistributorByHashPrefix; import org.apache.hadoop.hbase.Cell; import org.apache.hadoop.hbase.CellUtil; import org.apache.hadoop.hbase.client.Result; +import org.apache.hadoop.hbase.util.Bytes; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; @@ -37,6 +39,7 @@ /** * @author emeroad + * @author minwoo.jung */ @Component public class ApiMetaDataMapper implements RowMapper> { @@ -46,6 +49,8 @@ public class ApiMetaDataMapper implements RowMapper> { @Autowired @Qualifier("metadataRowKeyDistributor") private RowKeyDistributorByHashPrefix rowKeyDistributorByHashPrefix; + + private final static String API_METADATA_CF_API_QUALI_SIGNATURE = Bytes.toString(HBaseTables.API_METADATA_CF_API_QUALI_SIGNATURE); @Override public List mapRow(Result result, int rowNum) throws Exception { @@ -60,7 +65,15 @@ public List mapRow(Result result, int rowNum) throws Exception { apiMetaDataBo.readRowKey(rowKey); byte[] qualifier = CellUtil.cloneQualifier(cell); - Buffer buffer = new FixedBuffer(qualifier); + byte[] value = null; + + if (API_METADATA_CF_API_QUALI_SIGNATURE.equals(Bytes.toString(qualifier))) { + value = CellUtil.cloneValue(cell); + } else { + value = qualifier; + } + + Buffer buffer = new FixedBuffer(value); String apiInfo = buffer.readPrefixedString(); int lineNumber = buffer.readInt(); apiMetaDataBo.setApiInfo(apiInfo); diff --git a/web/src/main/java/com/navercorp/pinpoint/web/mapper/StringMetaDataMapper.java b/web/src/main/java/com/navercorp/pinpoint/web/mapper/StringMetaDataMapper.java index 928c42b5f298..2e90124f829a 100644 --- a/web/src/main/java/com/navercorp/pinpoint/web/mapper/StringMetaDataMapper.java +++ b/web/src/main/java/com/navercorp/pinpoint/web/mapper/StringMetaDataMapper.java @@ -17,6 +17,7 @@ package com.navercorp.pinpoint.web.mapper; import com.navercorp.pinpoint.common.bo.StringMetaDataBo; +import com.navercorp.pinpoint.common.hbase.HBaseTables; import com.sematext.hbase.wd.RowKeyDistributorByHashPrefix; import org.apache.hadoop.hbase.Cell; @@ -40,7 +41,9 @@ public class StringMetaDataMapper implements RowMapper> { @Autowired @Qualifier("metadataRowKeyDistributor") private RowKeyDistributorByHashPrefix rowKeyDistributorByHashPrefix; - + + private final static String STRING_METADATA_CF_STR_QUALI_STRING = Bytes.toString(HBaseTables.STRING_METADATA_CF_STR_QUALI_STRING); + @Override public List mapRow(Result result, int rowNum) throws Exception { if (result.isEmpty()) { @@ -54,6 +57,11 @@ public List mapRow(Result result, int rowNum) throws Exception StringMetaDataBo sqlMetaDataBo = new StringMetaDataBo(); sqlMetaDataBo.readRowKey(rowKey); String stringValue = Bytes.toString(cell.getQualifierArray(), cell.getQualifierOffset(), cell.getQualifierLength()); + + if (STRING_METADATA_CF_STR_QUALI_STRING.equals(stringValue)) { + stringValue = Bytes.toString(cell.getValueArray(), cell.getValueOffset(), cell.getValueLength()); + } + sqlMetaDataBo.setStringValue(stringValue); stringMetaDataList.add(sqlMetaDataBo); }