Xiao Liu created HBASE-30533:
--------------------------------
Summary: TestMemcachedBlockCache.testCache fails after HBASE-30521
Key: HBASE-30533
URL: https://issues.apache.org/jira/browse/HBASE-30533
Project: HBase
Issue Type: Bug
Reporter: Xiao Liu
Assignee: Xiao Liu
Fix For: 4.0.0-alpha-1, 2.7.0, 3.1.0, 3.0.1, 2.6.8
{\{TestMemcachedBlockCache.testCache}} consistently fails on the nightly builds
of all branches that HBASE-30521 went in to, e.g. [master
#1520|https://ci-hbase.apache.org/job/HBase%20Nightly/job/master/1520/]:
{noformat}
java.lang.IllegalStateException: Not a JSON Object: null
at
org.apache.hbase.thirdparty.com.google.gson.JsonElement.getAsJsonObject(JsonElement.java:164)
at
org.apache.hadoop.hbase.io.hfile.CacheTestUtils.testConvertToJSON(CacheTestUtils.java:391)
at
org.apache.hadoop.hbase.io.hfile.TestMemcachedBlockCache.testCache(TestMemcachedBlockCache.java:134)
{noformat}
The test creates the cache as an anonymous subclass of
\{{MemcachedBlockCache}}. Gson excludes anonymous and local classes, so
\{{BlockCacheUtil.toJSON}} returns \{{"null"}} for it. This went unnoticed
because \{{CacheTestUtils.testConvertToJSON}} only checked that the returned
string was not null, until HBASE-30521 started parsing it as a JSON object. The
PR build of HBASE-30521 did not catch it since only the hbase-server tests were
run.
Turn the anonymous subclass into an inner class so the cache is serialized like
a real \{{MemcachedBlockCache}}.
--
This message was sent by Atlassian Jira
(v10.3.26#10030026)