-
Notifications
You must be signed in to change notification settings - Fork 4.8k
HIVE-29281: Make proactive cache eviction work with catalog #6379
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -17,11 +17,10 @@ | |
| */ | ||
| package org.apache.hadoop.hive.llap.cache; | ||
|
|
||
| import java.util.HashMap; | ||
| import java.util.LinkedHashMap; | ||
| import java.util.Map; | ||
|
|
||
| import org.apache.hadoop.hive.common.io.CacheTag; | ||
| import org.apache.hadoop.hive.metastore.Warehouse; | ||
|
|
||
| import org.junit.BeforeClass; | ||
| import org.junit.Test; | ||
|
|
@@ -127,7 +126,7 @@ public void testCacheTagComparison() { | |
| public void testEncodingDecoding() throws Exception { | ||
| LinkedHashMap<String, String> partDescs = new LinkedHashMap<>(); | ||
| partDescs.put("pytha=goras", "a2+b2=c2"); | ||
| CacheTag tag = CacheTag.build("math.rules", partDescs); | ||
| CacheTag tag = CacheTag.build(Warehouse.DEFAULT_CATALOG_NAME + ".math.rules", partDescs); | ||
Neer393 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| CacheTag.SinglePartitionCacheTag stag = ((CacheTag.SinglePartitionCacheTag)tag); | ||
| assertEquals("pytha=goras=a2+b2=c2", stag.partitionDescToString()); | ||
| assertEquals(1, stag.getPartitionDescMap().size()); | ||
|
|
@@ -136,7 +135,7 @@ public void testEncodingDecoding() throws Exception { | |
| partDescs.clear(); | ||
| partDescs.put("mutli=one", "one=/1"); | ||
| partDescs.put("mutli=two/", "two=2"); | ||
| tag = CacheTag.build("math.rules", partDescs); | ||
| tag = CacheTag.build(Warehouse.DEFAULT_CATALOG_NAME + ".math.rules", partDescs); | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. why not handle DEFAULT_CATALOG_NAME inside |
||
| CacheTag.MultiPartitionCacheTag mtag = ((CacheTag.MultiPartitionCacheTag)tag); | ||
| assertEquals("mutli=one=one=/1/mutli=two/=two=2", mtag.partitionDescToString()); | ||
| assertEquals(2, mtag.getPartitionDescMap().size()); | ||
|
|
@@ -168,6 +167,10 @@ private static LlapCacheableBuffer createMockBuffer(long size, CacheTag cacheTag | |
| } | ||
|
|
||
| public static CacheTag cacheTagBuilder(String dbAndTable, String... partitions) { | ||
| String[] parts = dbAndTable.split("\\."); | ||
| if(parts.length < 3) { | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nit: space |
||
| dbAndTable = Warehouse.DEFAULT_CATALOG_NAME + "." + dbAndTable; | ||
| } | ||
| if (partitions != null && partitions.length > 0) { | ||
| LinkedHashMap<String, String> partDescs = new LinkedHashMap<>(); | ||
| for (String partition : partitions) { | ||
|
|
@@ -215,33 +218,33 @@ private static void evictSomeTestBuffers() { | |
| private static final String EXPECTED_CACHE_STATE_WHEN_FULL = | ||
| "\n" + | ||
| "Cache state: \n" + | ||
| "default : 2/2, 2101248/2101248\n" + | ||
| "default.testtable : 2/2, 2101248/2101248\n" + | ||
| "otherdb : 7/7, 1611106304/1611106304\n" + | ||
| "otherdb.testtable : 4/4, 231424/231424\n" + | ||
| "otherdb.testtable/p=v1 : 3/3, 100352/100352\n" + | ||
| "otherdb.testtable/p=v1/pp=vv1 : 2/2, 34816/34816\n" + | ||
| "otherdb.testtable/p=v1/pp=vv2 : 1/1, 65536/65536\n" + | ||
| "otherdb.testtable/p=v2 : 1/1, 131072/131072\n" + | ||
| "otherdb.testtable/p=v2/pp=vv1 : 1/1, 131072/131072\n" + | ||
| "otherdb.testtable2 : 2/2, 537133056/537133056\n" + | ||
| "otherdb.testtable2/p=v3 : 2/2, 537133056/537133056\n" + | ||
| "otherdb.testtable3 : 1/1, 1073741824/1073741824"; | ||
| "hive.default : 2/2, 2101248/2101248\n" + | ||
| "hive.default.testtable : 2/2, 2101248/2101248\n" + | ||
| "hive.otherdb : 7/7, 1611106304/1611106304\n" + | ||
| "hive.otherdb.testtable : 4/4, 231424/231424\n" + | ||
| "hive.otherdb.testtable/p=v1 : 3/3, 100352/100352\n" + | ||
| "hive.otherdb.testtable/p=v1/pp=vv1 : 2/2, 34816/34816\n" + | ||
| "hive.otherdb.testtable/p=v1/pp=vv2 : 1/1, 65536/65536\n" + | ||
| "hive.otherdb.testtable/p=v2 : 1/1, 131072/131072\n" + | ||
| "hive.otherdb.testtable/p=v2/pp=vv1 : 1/1, 131072/131072\n" + | ||
| "hive.otherdb.testtable2 : 2/2, 537133056/537133056\n" + | ||
| "hive.otherdb.testtable2/p=v3 : 2/2, 537133056/537133056\n" + | ||
| "hive.otherdb.testtable3 : 1/1, 1073741824/1073741824"; | ||
|
|
||
| private static final String EXPECTED_CACHE_STATE_AFTER_EVICTION = | ||
| "\n" + | ||
| "Cache state: \n" + | ||
| "default : 0/2, 0/2101248\n" + | ||
| "default.testtable : 0/2, 0/2101248\n" + | ||
| "otherdb : 5/7, 1074202624/1611106304\n" + | ||
| "otherdb.testtable : 3/4, 198656/231424\n" + | ||
| "otherdb.testtable/p=v1 : 2/3, 67584/100352\n" + | ||
| "otherdb.testtable/p=v1/pp=vv1 : 1/2, 2048/34816\n" + | ||
| "otherdb.testtable/p=v1/pp=vv2 : 1/1, 65536/65536\n" + | ||
| "otherdb.testtable/p=v2 : 1/1, 131072/131072\n" + | ||
| "otherdb.testtable/p=v2/pp=vv1 : 1/1, 131072/131072\n" + | ||
| "otherdb.testtable2 : 1/2, 262144/537133056\n" + | ||
| "otherdb.testtable2/p=v3 : 1/2, 262144/537133056\n" + | ||
| "otherdb.testtable3 : 1/1, 1073741824/1073741824"; | ||
| "hive.default : 0/2, 0/2101248\n" + | ||
| "hive.default.testtable : 0/2, 0/2101248\n" + | ||
| "hive.otherdb : 5/7, 1074202624/1611106304\n" + | ||
| "hive.otherdb.testtable : 3/4, 198656/231424\n" + | ||
| "hive.otherdb.testtable/p=v1 : 2/3, 67584/100352\n" + | ||
| "hive.otherdb.testtable/p=v1/pp=vv1 : 1/2, 2048/34816\n" + | ||
| "hive.otherdb.testtable/p=v1/pp=vv2 : 1/1, 65536/65536\n" + | ||
| "hive.otherdb.testtable/p=v2 : 1/1, 131072/131072\n" + | ||
| "hive.otherdb.testtable/p=v2/pp=vv1 : 1/1, 131072/131072\n" + | ||
| "hive.otherdb.testtable2 : 1/2, 262144/537133056\n" + | ||
| "hive.otherdb.testtable2/p=v3 : 1/2, 262144/537133056\n" + | ||
| "hive.otherdb.testtable3 : 1/1, 1073741824/1073741824"; | ||
|
|
||
| } | ||
Uh oh!
There was an error while loading. Please reload this page.