public class DifferenceLogger extends Object
用于 Phase 1-2 期间验证新实现的正确性。
| Constructor and Description |
|---|
DifferenceLogger() |
| Modifier and Type | Method and Description |
|---|---|
String |
generateReport()
生成统计报告
|
double |
getNewPutErrorRate(long totalOperations)
获取新实现的错误率
|
double |
getSearchDifferenceRate(long totalSearches)
获取搜索差异率
|
Map<String,Long> |
getStatistics()
获取统计信息
|
boolean |
hasSeriousErrors()
检查是否有严重错误(用于测试)
|
void |
logLegacyPutError(TSQLSchemaObject object,
Throwable e)
记录旧实现的 put 错误
|
void |
logNewPutError(TSQLSchemaObject object,
Throwable e)
记录新实现的 put 错误
|
void |
logNewSearchError(String catalog,
String schema,
String objectName,
ESQLDataObjectType type,
Throwable e)
记录新实现的 search 错误
|
void |
logSearchDifference(String catalog,
String schema,
String objectName,
ESQLDataObjectType type,
TSQLSchemaObject legacyResult,
TSQLSchemaObject newResult)
记录搜索结果差异
|
void |
logSearchMiss(String catalog,
String schema,
String objectName,
ESQLDataObjectType type)
记录搜索 miss(新实现未找到对象)
|
void |
reset()
重置统计
|
public DifferenceLogger()
public void logLegacyPutError(TSQLSchemaObject object, Throwable e)
object - the schema objecte - the exceptionpublic void logNewPutError(TSQLSchemaObject object, Throwable e)
object - the schema objecte - the exceptionpublic void logSearchDifference(String catalog, String schema, String objectName, ESQLDataObjectType type, TSQLSchemaObject legacyResult, TSQLSchemaObject newResult)
catalog - catalog nameschema - schema nameobjectName - object nametype - object typelegacyResult - legacy implementation resultnewResult - new implementation resultpublic void logSearchMiss(String catalog, String schema, String objectName, ESQLDataObjectType type)
catalog - catalog nameschema - schema nameobjectName - object nametype - object typepublic void logNewSearchError(String catalog, String schema, String objectName, ESQLDataObjectType type, Throwable e)
catalog - catalog nameschema - schema nameobjectName - object nametype - object typee - the exceptionpublic Map<String,Long> getStatistics()
public void reset()
public String generateReport()
public boolean hasSeriousErrors()
public double getNewPutErrorRate(long totalOperations)
totalOperations - total number of operationspublic double getSearchDifferenceRate(long totalSearches)
totalSearches - total number of searches