Skip to content
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

HDDS-1499. OzoneManager Cache. #798

Merged
merged 8 commits into from May 20, 2019
Merged

HDDS-1499. OzoneManager Cache. #798

merged 8 commits into from May 20, 2019

Conversation

bharatviswa504
Copy link
Contributor

No description provided.

@hadoop-yetus
Copy link

💔 -1 overall

Vote Subsystem Runtime Comment
0 reexec 29 Docker mode activated.
_ Prechecks _
+1 dupname 0 No case conflicting files found.
+1 @author 0 The patch does not contain any @author tags.
+1 test4tests 0 The patch appears to include 4 new or modified test files.
_ trunk Compile Tests _
0 mvndep 63 Maven dependency ordering for branch
+1 mvninstall 405 trunk passed
+1 compile 195 trunk passed
+1 checkstyle 52 trunk passed
+1 mvnsite 0 trunk passed
+1 shadedclient 815 branch has no errors when building and testing our client artifacts.
+1 javadoc 128 trunk passed
0 spotbugs 235 Used deprecated FindBugs config; considering switching to SpotBugs.
+1 findbugs 411 trunk passed
_ Patch Compile Tests _
0 mvndep 28 Maven dependency ordering for patch
+1 mvninstall 404 the patch passed
+1 compile 210 the patch passed
+1 javac 210 the patch passed
-0 checkstyle 31 hadoop-hdds: The patch generated 1 new + 0 unchanged - 0 fixed = 1 total (was 0)
+1 mvnsite 0 the patch passed
+1 whitespace 0 The patch has no whitespace issues.
+1 shadedclient 654 patch has no errors when building and testing our client artifacts.
+1 javadoc 117 the patch passed
+1 findbugs 433 the patch passed
_ Other Tests _
-1 unit 136 hadoop-hdds in the patch failed.
-1 unit 867 hadoop-ozone in the patch failed.
+1 asflicense 36 The patch does not generate ASF License warnings.
5197
Reason Tests
Failed junit tests hadoop.ozone.client.rpc.TestOzoneClientRetriesOnException
Subsystem Report/Notes
Docker Client=17.05.0-ce Server=17.05.0-ce base: https://builds.apache.org/job/hadoop-multibranch/job/PR-798/1/artifact/out/Dockerfile
GITHUB PR #798
Optional Tests dupname asflicense compile javac javadoc mvninstall mvnsite unit shadedclient findbugs checkstyle
uname Linux e994bc971635 4.4.0-139-generic #165-Ubuntu SMP Wed Oct 24 10:58:50 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux
Build tool maven
Personality personality/hadoop.sh
git revision trunk / 1a696cc
Default Java 1.8.0_191
checkstyle https://builds.apache.org/job/hadoop-multibranch/job/PR-798/1/artifact/out/diff-checkstyle-hadoop-hdds.txt
unit https://builds.apache.org/job/hadoop-multibranch/job/PR-798/1/artifact/out/patch-unit-hadoop-hdds.txt
unit https://builds.apache.org/job/hadoop-multibranch/job/PR-798/1/artifact/out/patch-unit-hadoop-ozone.txt
Test Results https://builds.apache.org/job/hadoop-multibranch/job/PR-798/1/testReport/
Max. process+thread count 4725 (vs. ulimit of 5500)
modules C: hadoop-hdds/common hadoop-hdds/server-scm hadoop-ozone/ozone-manager hadoop-ozone/ozone-recon U: .
Console output https://builds.apache.org/job/hadoop-multibranch/job/PR-798/1/console
versions git=2.7.4 maven=3.3.9 findbugs=3.1.0-RC1
Powered by Apache Yetus 0.10.0 http://yetus.apache.org

This message was automatically generated.

@hadoop-yetus
Copy link

💔 -1 overall

Vote Subsystem Runtime Comment
0 reexec 42 Docker mode activated.
_ Prechecks _
+1 dupname 1 No case conflicting files found.
+1 @author 0 The patch does not contain any @author tags.
+1 test4tests 0 The patch appears to include 4 new or modified test files.
_ trunk Compile Tests _
0 mvndep 25 Maven dependency ordering for branch
+1 mvninstall 398 trunk passed
+1 compile 209 trunk passed
+1 checkstyle 53 trunk passed
+1 mvnsite 0 trunk passed
+1 shadedclient 863 branch has no errors when building and testing our client artifacts.
+1 javadoc 120 trunk passed
0 spotbugs 240 Used deprecated FindBugs config; considering switching to SpotBugs.
+1 findbugs 420 trunk passed
_ Patch Compile Tests _
0 mvndep 24 Maven dependency ordering for patch
+1 mvninstall 406 the patch passed
+1 compile 205 the patch passed
+1 javac 205 the patch passed
-0 checkstyle 29 hadoop-hdds: The patch generated 1 new + 0 unchanged - 0 fixed = 1 total (was 0)
+1 mvnsite 0 the patch passed
+1 whitespace 0 The patch has no whitespace issues.
+1 shadedclient 725 patch has no errors when building and testing our client artifacts.
+1 javadoc 126 the patch passed
+1 findbugs 451 the patch passed
_ Other Tests _
-1 unit 155 hadoop-hdds in the patch failed.
-1 unit 1197 hadoop-ozone in the patch failed.
+1 asflicense 32 The patch does not generate ASF License warnings.
5651
Reason Tests
Failed junit tests hadoop.ozone.web.client.TestKeysRatis
hadoop.hdds.scm.pipeline.TestSCMPipelineManager
hadoop.ozone.container.TestContainerReplication
hadoop.ozone.client.rpc.TestCommitWatcher
Subsystem Report/Notes
Docker Client=17.05.0-ce Server=17.05.0-ce base: https://builds.apache.org/job/hadoop-multibranch/job/PR-798/2/artifact/out/Dockerfile
GITHUB PR #798
Optional Tests dupname asflicense compile javac javadoc mvninstall mvnsite unit shadedclient findbugs checkstyle
uname Linux e291fdb1560b 4.4.0-141-generic #167~14.04.1-Ubuntu SMP Mon Dec 10 13:20:24 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux
Build tool maven
Personality personality/hadoop.sh
git revision trunk / 1a696cc
Default Java 1.8.0_191
checkstyle https://builds.apache.org/job/hadoop-multibranch/job/PR-798/2/artifact/out/diff-checkstyle-hadoop-hdds.txt
unit https://builds.apache.org/job/hadoop-multibranch/job/PR-798/2/artifact/out/patch-unit-hadoop-hdds.txt
unit https://builds.apache.org/job/hadoop-multibranch/job/PR-798/2/artifact/out/patch-unit-hadoop-ozone.txt
Test Results https://builds.apache.org/job/hadoop-multibranch/job/PR-798/2/testReport/
Max. process+thread count 4612 (vs. ulimit of 5500)
modules C: hadoop-hdds/common hadoop-hdds/server-scm hadoop-ozone/ozone-manager hadoop-ozone/ozone-recon U: .
Console output https://builds.apache.org/job/hadoop-multibranch/job/PR-798/2/console
versions git=2.7.4 maven=3.3.9 findbugs=3.1.0-RC1
Powered by Apache Yetus 0.10.0 http://yetus.apache.org

This message was automatically generated.

@hadoop-yetus
Copy link

💔 -1 overall

Vote Subsystem Runtime Comment
0 reexec 41 Docker mode activated.
_ Prechecks _
+1 dupname 0 No case conflicting files found.
+1 @author 0 The patch does not contain any @author tags.
+1 test4tests 0 The patch appears to include 4 new or modified test files.
_ trunk Compile Tests _
0 mvndep 22 Maven dependency ordering for branch
+1 mvninstall 398 trunk passed
+1 compile 201 trunk passed
+1 checkstyle 56 trunk passed
+1 mvnsite 0 trunk passed
+1 shadedclient 970 branch has no errors when building and testing our client artifacts.
+1 javadoc 129 trunk passed
0 spotbugs 241 Used deprecated FindBugs config; considering switching to SpotBugs.
+1 findbugs 432 trunk passed
_ Patch Compile Tests _
0 mvndep 24 Maven dependency ordering for patch
+1 mvninstall 402 the patch passed
+1 compile 227 the patch passed
+1 javac 227 the patch passed
+1 checkstyle 65 the patch passed
+1 mvnsite 0 the patch passed
+1 whitespace 0 The patch has no whitespace issues.
+1 shadedclient 778 patch has no errors when building and testing our client artifacts.
+1 javadoc 131 the patch passed
+1 findbugs 478 the patch passed
_ Other Tests _
-1 unit 167 hadoop-hdds in the patch failed.
-1 unit 1605 hadoop-ozone in the patch failed.
-1 asflicense 35 The patch generated 1 ASF License warnings.
6340
Reason Tests
Failed junit tests hadoop.hdds.scm.pipeline.TestRatisPipelineProvider
hadoop.hdds.scm.safemode.TestSCMSafeModeWithPipelineRules
hadoop.ozone.container.TestContainerReplication
hadoop.ozone.client.rpc.TestCloseContainerHandlingByClient
hadoop.ozone.client.rpc.TestReadRetries
hadoop.ozone.client.rpc.TestContainerStateMachine
hadoop.ozone.client.rpc.TestOzoneRpcClient
Subsystem Report/Notes
Docker Client=17.05.0-ce Server=17.05.0-ce base: https://builds.apache.org/job/hadoop-multibranch/job/PR-798/3/artifact/out/Dockerfile
GITHUB PR #798
Optional Tests dupname asflicense compile javac javadoc mvninstall mvnsite unit shadedclient findbugs checkstyle
uname Linux c340489b69ee 4.4.0-141-generic #167~14.04.1-Ubuntu SMP Mon Dec 10 13:20:24 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux
Build tool maven
Personality personality/hadoop.sh
git revision trunk / 7f0e2c6
Default Java 1.8.0_191
unit https://builds.apache.org/job/hadoop-multibranch/job/PR-798/3/artifact/out/patch-unit-hadoop-hdds.txt
unit https://builds.apache.org/job/hadoop-multibranch/job/PR-798/3/artifact/out/patch-unit-hadoop-ozone.txt
Test Results https://builds.apache.org/job/hadoop-multibranch/job/PR-798/3/testReport/
asflicense https://builds.apache.org/job/hadoop-multibranch/job/PR-798/3/artifact/out/patch-asflicense-problems.txt
Max. process+thread count 4533 (vs. ulimit of 5500)
modules C: hadoop-hdds/common hadoop-hdds/server-scm hadoop-ozone/ozone-manager hadoop-ozone/ozone-recon U: .
Console output https://builds.apache.org/job/hadoop-multibranch/job/PR-798/3/console
versions git=2.7.4 maven=3.3.9 findbugs=3.1.0-RC1
Powered by Apache Yetus 0.10.0 http://yetus.apache.org

This message was automatically generated.

* @return - TableStore.
* @throws IOException on Failure
*/
<KEY, VALUE> Table<KEY, VALUE> getTable(String name,
Class<KEY> keyType, Class<VALUE> valueType) throws IOException;
Class<KEY> keyType, Class<VALUE> valueType,
TableCache.CACHETYPE cachetype) throws IOException;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we need an external visible TableCache.CACHETYPE ? shouldn't this be an implementation detail of the Tables that have Cache?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added this because for a few tables like bucket and volume table plan is to maintain full table information, for other tables we maintain a partial cache, whereas for few tables we don't want to maintain cache at all. (This is a common interface for all tables in Ozone SCM/OM. So, having this option will help to know which kind of cache need to be used for the table.)

As these are frequently used for validation of almost every operation in OM. So, this might improve validation like bucket/volume exists or not checks.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed the cache type.

* If the cacheKey already exists, it will override the entry.
* @param cacheKey
* @param cacheValue
*/
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

well, I was really hoping that the fact that there is a cache is not visible to the layer that is reading and writing.
Is there a reason why that should be exposed to calling applications?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Once after the operation is executed in applyTransaction just before releasing the lock and sending a response to the client we need to add the response into cache. So that next subsequent read/write requests validation can be done with cache/db data.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thx makes sense.

this.rawTable = rawTable;
this.codecRegistry = codecRegistry;
this.keyType = keyType;
this.valueType = valueType;
if (cachetype == TableCache.CACHETYPE.FULLCACHE) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is impossible for the user to tell you apriori if they want a full cache or partial cache. When you start a cluster you always want a full cache. We should get a cache size -- or get a percentage of memory from the OM cache size and use that if needed. Or for time being rely on the RocksDB doing the right thing.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, Anu for the comment, removed the cache type.

} else {
// Doing this because, if the Cache Value Last operation is deleted
// means it will eventually removed from DB. So, we should return null.
if (cacheValue.getLastOperation() != CacheValue.OperationType.DELETED) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we even cache the deleted Operations? Delete is not in the performance critical path at all. If you can instruct the system to make the full commit or flush the buffer when there is a delete op you don't need to keep this extra state in the cache. yes, repeated deletes will call state machine call back. When do we actually flush / clear this entry?

}
}
} else {
return getFromTable(key);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure if you need this get again ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For tables where the cache is disabled, we need to do as before just read from DB and return data.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Understood the comment, updated the code to remove getTable in multiple places.

@Private
@Evolving
public class PartialTableCache<CACHEKEY, CACHEVALUE>
implements TableCache<CACHEKEY, CACHEVALUE>{
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure if you have seen this, https://github.com/facebook/rocksdb/wiki/Block-Cache

We already do this cache control in the RockDB. I am not sure if we should do this twice. Unless you have a lookup problem which cannot be solved by hashing or prefix lookup, we will have more efficient usage of memory by relying on the underlying layer and more over having a unified cache layer will lead to better cache layer utilization.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The cache is maintained for correctness purpose for reads and validation of subsequent requests. The cache will be cleared once we flush to DB.

return cache.size();
}

private void evictCache(long epoch) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't a key be evicted if it was a delete operation and the state machine commit has taken place ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes Key will be evicted once double buffer flushes to disk.

Copy link
Contributor

@hanishakoneru hanishakoneru left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @bharatviswa504 for working on this.

@@ -60,6 +62,9 @@ void putWithBatch(BatchOperation batch, KEY key, VALUE value)
* Returns the value mapped to the given key in byte array or returns null
* if the key is not found.
*
* First it will check from cache, if it has entry return the value
* otherwise, get from the RocksDB table.
*
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The RDBTable implementation of Table does not check the cache. We should probably move this statement to TypedTable which implements the cache.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done


// If currentEntry epoch is greater than epoch, we have deleted all
// entries less than specified epoch. So, we can break.
if (currentEntry.getEpoch() > epoch) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can avoid the 2nd if check and put it in else block.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

GenericTestUtils.waitFor(() ->
((TypedTable<String, String>) testTable).getCache().size() == 4,
100, 5000);
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we also check that the cache entries remaining in the cache are the expected entries.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

@Override
public void put(CACHEKEY cacheKey, CACHEVALUE value) {
cache.put(cacheKey, value);
CacheValue cacheValue = (CacheValue) cache.get(cacheKey);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of casting the cache.get() object to CacheValue, I think CACHEVALUE itself should extend CacheValue so that it is guaranteed that the Value part of TableCache is an instance of CacheValue.class. Same for CACHEKEY also.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

@hadoop-yetus
Copy link

💔 -1 overall

Vote Subsystem Runtime Comment
0 reexec 29 Docker mode activated.
_ Prechecks _
+1 dupname 1 No case conflicting files found.
+1 @author 0 The patch does not contain any @author tags.
+1 test4tests 0 The patch appears to include 4 new or modified test files.
_ trunk Compile Tests _
0 mvndep 60 Maven dependency ordering for branch
+1 mvninstall 393 trunk passed
+1 compile 199 trunk passed
+1 checkstyle 51 trunk passed
+1 mvnsite 0 trunk passed
+1 shadedclient 823 branch has no errors when building and testing our client artifacts.
+1 javadoc 126 trunk passed
0 spotbugs 236 Used deprecated FindBugs config; considering switching to SpotBugs.
+1 findbugs 409 trunk passed
_ Patch Compile Tests _
0 mvndep 27 Maven dependency ordering for patch
+1 mvninstall 411 the patch passed
+1 compile 207 the patch passed
+1 javac 207 the patch passed
+1 checkstyle 57 the patch passed
+1 mvnsite 0 the patch passed
+1 whitespace 0 The patch has no whitespace issues.
+1 shadedclient 656 patch has no errors when building and testing our client artifacts.
+1 javadoc 126 the patch passed
+1 findbugs 429 the patch passed
_ Other Tests _
-1 unit 135 hadoop-hdds in the patch failed.
-1 unit 1247 hadoop-ozone in the patch failed.
+1 asflicense 32 The patch does not generate ASF License warnings.
5576
Reason Tests
Failed junit tests hadoop.ozone.web.client.TestBuckets
hadoop.ozone.TestMiniOzoneCluster
Subsystem Report/Notes
Docker Client=17.05.0-ce Server=17.05.0-ce base: https://builds.apache.org/job/hadoop-multibranch/job/PR-798/4/artifact/out/Dockerfile
GITHUB PR #798
Optional Tests dupname asflicense compile javac javadoc mvninstall mvnsite unit shadedclient findbugs checkstyle
uname Linux 235d56cf079b 4.4.0-139-generic #165-Ubuntu SMP Wed Oct 24 10:58:50 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux
Build tool maven
Personality personality/hadoop.sh
git revision trunk / 0c5fa2e
Default Java 1.8.0_191
unit https://builds.apache.org/job/hadoop-multibranch/job/PR-798/4/artifact/out/patch-unit-hadoop-hdds.txt
unit https://builds.apache.org/job/hadoop-multibranch/job/PR-798/4/artifact/out/patch-unit-hadoop-ozone.txt
Test Results https://builds.apache.org/job/hadoop-multibranch/job/PR-798/4/testReport/
Max. process+thread count 5055 (vs. ulimit of 5500)
modules C: hadoop-hdds/common hadoop-hdds/server-scm hadoop-ozone/ozone-manager hadoop-ozone/ozone-recon U: .
Console output https://builds.apache.org/job/hadoop-multibranch/job/PR-798/4/console
versions git=2.7.4 maven=3.3.9 findbugs=3.1.0-RC1
Powered by Apache Yetus 0.10.0 http://yetus.apache.org

This message was automatically generated.

@bharatviswa504
Copy link
Contributor Author

Thank You @hanishakoneru for the review.
I have addressed review comments.

@hadoop-yetus
Copy link

💔 -1 overall

Vote Subsystem Runtime Comment
0 reexec 34 Docker mode activated.
_ Prechecks _
+1 dupname 0 No case conflicting files found.
+1 @author 0 The patch does not contain any @author tags.
+1 test4tests 0 The patch appears to include 4 new or modified test files.
_ trunk Compile Tests _
0 mvndep 64 Maven dependency ordering for branch
+1 mvninstall 415 trunk passed
+1 compile 205 trunk passed
+1 checkstyle 53 trunk passed
+1 mvnsite 0 trunk passed
+1 shadedclient 802 branch has no errors when building and testing our client artifacts.
+1 javadoc 130 trunk passed
0 spotbugs 237 Used deprecated FindBugs config; considering switching to SpotBugs.
+1 findbugs 417 trunk passed
_ Patch Compile Tests _
0 mvndep 26 Maven dependency ordering for patch
+1 mvninstall 396 the patch passed
+1 compile 204 the patch passed
+1 javac 204 the patch passed
+1 checkstyle 58 the patch passed
+1 mvnsite 0 the patch passed
+1 whitespace 0 The patch has no whitespace issues.
+1 shadedclient 721 patch has no errors when building and testing our client artifacts.
+1 javadoc 113 the patch passed
+1 findbugs 428 the patch passed
_ Other Tests _
-1 unit 132 hadoop-hdds in the patch failed.
-1 unit 1136 hadoop-ozone in the patch failed.
+1 asflicense 32 The patch does not generate ASF License warnings.
5514
Reason Tests
Failed junit tests hadoop.hdds.scm.pipeline.TestRatisPipelineProvider
Subsystem Report/Notes
Docker Client=17.05.0-ce Server=17.05.0-ce base: https://builds.apache.org/job/hadoop-multibranch/job/PR-798/5/artifact/out/Dockerfile
GITHUB PR #798
Optional Tests dupname asflicense compile javac javadoc mvninstall mvnsite unit shadedclient findbugs checkstyle
uname Linux 3f5f3b7f3979 4.4.0-139-generic #165-Ubuntu SMP Wed Oct 24 10:58:50 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux
Build tool maven
Personality personality/hadoop.sh
git revision trunk / 90add05
Default Java 1.8.0_191
unit https://builds.apache.org/job/hadoop-multibranch/job/PR-798/5/artifact/out/patch-unit-hadoop-hdds.txt
unit https://builds.apache.org/job/hadoop-multibranch/job/PR-798/5/artifact/out/patch-unit-hadoop-ozone.txt
Test Results https://builds.apache.org/job/hadoop-multibranch/job/PR-798/5/testReport/
Max. process+thread count 4521 (vs. ulimit of 5500)
modules C: hadoop-hdds/common hadoop-hdds/server-scm hadoop-ozone/ozone-manager hadoop-ozone/ozone-recon U: .
Console output https://builds.apache.org/job/hadoop-multibranch/job/PR-798/5/console
versions git=2.7.4 maven=3.3.9 findbugs=3.1.0-RC1
Powered by Apache Yetus 0.10.0 http://yetus.apache.org

This message was automatically generated.

Copy link
Contributor

@arp7 arp7 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added a few comments. Overall the patch looks quite good to me.

}

/**
* Last happened Operation.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bharat, what if we support further operation types in future? I was thinking whether we really need this lastOperation field.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed this lastOperation field.

/**
* Defines type of cache need to be used by OM RocksDB tables.
*/
enum CACHETYPE {
Copy link
Contributor

@arp7 arp7 May 14, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One feedback from Anu was to not differentiate between full and partial cache while initializing so caller does not have to make a choice.

Instead we try to limit cache size by configuration and load as many entries as possible. If we cannot load all entries then we could set a flag that it is a partial cache. The implementation will certainly be a bit more complex.

I don't have a strong opinion either way. I am +1 with current approach also.

On second thought I am leaning towards removing this distinction.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually, this cache is used for correctness reasons for further operations validation and read operation correctness. (As when double buffer comes in to the place we don't commit to DB immediately)

And also we are cleaning up the cache after flush, so I am not sure what is the use of loading entries. This cache is mainly for correctness reasons.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay let's skip the full cache then for now. We can add it later as an optimization. All caches will be partial, and if an entry is not found in the cache we always go to RocksDB. It should simplify the patch a bit. What do you think?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The logic for get() actually takes care of that, I feel for bucket/volume table having full cache will be useful as this is used for all the request validation's. So, if we have in cache this will be a quick operation instead of disk access.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed FullCache, and have the only implementation for TableCache i.e PartialCache.


@Override
public void cleanup(long epoch) {
// Do nothing
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you throw NotImplementedYetException here to make it clear that the implementation is pending.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As for full table cache, we never want to cleanup, it is a do nothing operation.
Added to the java doc.

@@ -245,42 +247,50 @@ protected DBStoreBuilder addOMTablesAndCodecs(DBStoreBuilder builder) {
*/
protected void initializeOmTables() throws IOException {
userTable =
this.store.getTable(USER_TABLE, String.class, VolumeList.class);
this.store.getTable(USER_TABLE, String.class, VolumeList.class,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is one argument for why we should not have partial/full distinction. 🙂 It makes initialization of the tables a little clunky.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As for some tables where SCM does not need to have cache, so that is the reason for introducing CacheType.
And also for some tables like deletedtable, where this is used by background thread inOM, these does not need cache.

And as for volume/bucket table we plan to have entire table info, and cleanup for them is no-op, even after flush to db, where as for partial cache the cache entries will be cleaned up. This is the only difference between full table cache vs partial table cache.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done. Now caller's no need to specify CacheType.

if (cacheValue.getLastOperation() != CacheValue.OperationType.DELETED) {
return cacheValue.getValue();
} else {
return null;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of making delete operation a special case, in case of delete we can just push a null value into the cache. So it will automatically return null.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, we can pass null value to CacheValue actual value. This will work.
Done.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks. Also instead of null we can pass in Optional.absent(), same thing but makes it very clear that the value can be missing.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

@bharatviswa504
Copy link
Contributor Author

Thank You @arp7 for the review.
Few of the review comments I have addressed them, for other's provided reply for the comments.

@hadoop-yetus
Copy link

💔 -1 overall

Vote Subsystem Runtime Comment
0 reexec 34 Docker mode activated.
_ Prechecks _
+1 dupname 0 No case conflicting files found.
+1 @author 0 The patch does not contain any @author tags.
+1 test4tests 0 The patch appears to include 4 new or modified test files.
_ trunk Compile Tests _
0 mvndep 27 Maven dependency ordering for branch
+1 mvninstall 392 trunk passed
+1 compile 201 trunk passed
+1 checkstyle 52 trunk passed
+1 mvnsite 0 trunk passed
+1 shadedclient 810 branch has no errors when building and testing our client artifacts.
+1 javadoc 132 trunk passed
0 spotbugs 234 Used deprecated FindBugs config; considering switching to SpotBugs.
+1 findbugs 415 trunk passed
_ Patch Compile Tests _
0 mvndep 27 Maven dependency ordering for patch
+1 mvninstall 388 the patch passed
+1 compile 206 the patch passed
+1 javac 206 the patch passed
+1 checkstyle 61 the patch passed
+1 mvnsite 0 the patch passed
+1 whitespace 0 The patch has no whitespace issues.
+1 shadedclient 664 patch has no errors when building and testing our client artifacts.
+1 javadoc 128 the patch passed
+1 findbugs 435 the patch passed
_ Other Tests _
-1 unit 147 hadoop-hdds in the patch failed.
-1 unit 846 hadoop-ozone in the patch failed.
+1 asflicense 40 The patch does not generate ASF License warnings.
5192
Subsystem Report/Notes
Docker Client=17.05.0-ce Server=17.05.0-ce base: https://builds.apache.org/job/hadoop-multibranch/job/PR-798/6/artifact/out/Dockerfile
GITHUB PR #798
Optional Tests dupname asflicense compile javac javadoc mvninstall mvnsite unit shadedclient findbugs checkstyle
uname Linux cba0149be2ba 4.4.0-138-generic #164-Ubuntu SMP Tue Oct 2 17:16:02 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux
Build tool maven
Personality personality/hadoop.sh
git revision trunk / 9569015
Default Java 1.8.0_212
unit https://builds.apache.org/job/hadoop-multibranch/job/PR-798/6/artifact/out/patch-unit-hadoop-hdds.txt
unit https://builds.apache.org/job/hadoop-multibranch/job/PR-798/6/artifact/out/patch-unit-hadoop-ozone.txt
Test Results https://builds.apache.org/job/hadoop-multibranch/job/PR-798/6/testReport/
Max. process+thread count 5138 (vs. ulimit of 5500)
modules C: hadoop-hdds/common hadoop-hdds/server-scm hadoop-ozone/ozone-manager hadoop-ozone/ozone-recon U: .
Console output https://builds.apache.org/job/hadoop-multibranch/job/PR-798/6/console
versions git=2.7.4 maven=3.3.9 findbugs=3.1.0-RC1
Powered by Apache Yetus 0.10.0 http://yetus.apache.org

This message was automatically generated.

@bharatviswa504
Copy link
Contributor Author

Thank You @arp7 for offline discussion.
I have addressed review the comments.

@hadoop-yetus
Copy link

💔 -1 overall

Vote Subsystem Runtime Comment
0 reexec 35 Docker mode activated.
_ Prechecks _
+1 dupname 1 No case conflicting files found.
+1 @author 0 The patch does not contain any @author tags.
+1 test4tests 0 The patch appears to include 4 new or modified test files.
_ trunk Compile Tests _
0 mvndep 62 Maven dependency ordering for branch
+1 mvninstall 387 trunk passed
+1 compile 204 trunk passed
+1 checkstyle 52 trunk passed
+1 mvnsite 0 trunk passed
+1 shadedclient 811 branch has no errors when building and testing our client artifacts.
+1 javadoc 125 trunk passed
0 spotbugs 239 Used deprecated FindBugs config; considering switching to SpotBugs.
+1 findbugs 416 trunk passed
_ Patch Compile Tests _
0 mvndep 24 Maven dependency ordering for patch
+1 mvninstall 392 the patch passed
+1 compile 193 the patch passed
+1 javac 193 the patch passed
+1 checkstyle 55 the patch passed
+1 mvnsite 0 the patch passed
+1 whitespace 0 The patch has no whitespace issues.
+1 shadedclient 664 patch has no errors when building and testing our client artifacts.
+1 javadoc 126 the patch passed
+1 findbugs 431 the patch passed
_ Other Tests _
-1 unit 138 hadoop-hdds in the patch failed.
-1 unit 1068 hadoop-ozone in the patch failed.
+1 asflicense 42 The patch does not generate ASF License warnings.
5323
Reason Tests
Failed junit tests hadoop.hdds.scm.pipeline.TestPipelineClose
Subsystem Report/Notes
Docker Client=17.05.0-ce Server=17.05.0-ce base: https://builds.apache.org/job/hadoop-multibranch/job/PR-798/8/artifact/out/Dockerfile
GITHUB PR #798
Optional Tests dupname asflicense compile javac javadoc mvninstall mvnsite unit shadedclient findbugs checkstyle
uname Linux 97f2fd6b2c5c 4.4.0-139-generic #165-Ubuntu SMP Wed Oct 24 10:58:50 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux
Build tool maven
Personality personality/hadoop.sh
git revision trunk / 77170e7
Default Java 1.8.0_191
unit https://builds.apache.org/job/hadoop-multibranch/job/PR-798/8/artifact/out/patch-unit-hadoop-hdds.txt
unit https://builds.apache.org/job/hadoop-multibranch/job/PR-798/8/artifact/out/patch-unit-hadoop-ozone.txt
Test Results https://builds.apache.org/job/hadoop-multibranch/job/PR-798/8/testReport/
Max. process+thread count 4479 (vs. ulimit of 5500)
modules C: hadoop-hdds/common hadoop-hdds/server-scm hadoop-ozone/ozone-manager hadoop-ozone/ozone-recon U: .
Console output https://builds.apache.org/job/hadoop-multibranch/job/PR-798/8/console
versions git=2.7.4 maven=3.3.9 findbugs=3.1.0-RC1
Powered by Apache Yetus 0.10.0 http://yetus.apache.org

This message was automatically generated.

@chinphing
Copy link

chinphing commented May 16, 2019

Seems like cache.put is never called except testcases, cache will always be empty.

@bharatviswa504
Copy link
Contributor Author

Seems like cache.put is never called except testcases, cache will always be empty.

This jira add's Table Cache, this is not integrated to OM Code, in further jira's it will be integrated, and we shall call this API put.

Jira description also has the same information.

@hadoop-yetus
Copy link

💔 -1 overall

Vote Subsystem Runtime Comment
0 reexec 58 Docker mode activated.
_ Prechecks _
+1 dupname 1 No case conflicting files found.
+1 @author 0 The patch does not contain any @author tags.
+1 test4tests 0 The patch appears to include 4 new or modified test files.
_ trunk Compile Tests _
0 mvndep 84 Maven dependency ordering for branch
+1 mvninstall 576 trunk passed
+1 compile 238 trunk passed
+1 checkstyle 61 trunk passed
+1 mvnsite 0 trunk passed
+1 shadedclient 1015 branch has no errors when building and testing our client artifacts.
+1 javadoc 149 trunk passed
0 spotbugs 288 Used deprecated FindBugs config; considering switching to SpotBugs.
+1 findbugs 534 trunk passed
_ Patch Compile Tests _
0 mvndep 29 Maven dependency ordering for patch
+1 mvninstall 533 the patch passed
+1 compile 256 the patch passed
+1 javac 256 the patch passed
+1 checkstyle 68 the patch passed
+1 mvnsite 0 the patch passed
+1 whitespace 0 The patch has no whitespace issues.
+1 shadedclient 774 patch has no errors when building and testing our client artifacts.
+1 javadoc 153 the patch passed
+1 findbugs 584 the patch passed
_ Other Tests _
-1 unit 188 hadoop-hdds in the patch failed.
-1 unit 1100 hadoop-ozone in the patch failed.
+1 asflicense 36 The patch does not generate ASF License warnings.
6581
Reason Tests
Failed junit tests hadoop.ozone.client.rpc.TestBlockOutputStream
hadoop.ozone.client.rpc.TestBCSID
hadoop.ozone.client.rpc.TestOzoneClientRetriesOnException
hadoop.ozone.client.rpc.TestKeyInputStream
hadoop.ozone.client.rpc.TestOzoneAtRestEncryption
hadoop.ozone.client.rpc.TestSecureOzoneRpcClient
hadoop.ozone.container.common.statemachine.commandhandler.TestDeleteContainerHandler
hadoop.ozone.client.rpc.TestOzoneRpcClient
Subsystem Report/Notes
Docker Client=17.05.0-ce Server=17.05.0-ce base: https://builds.apache.org/job/hadoop-multibranch/job/PR-798/9/artifact/out/Dockerfile
GITHUB PR #798
Optional Tests dupname asflicense compile javac javadoc mvninstall mvnsite unit shadedclient findbugs checkstyle
uname Linux deac2877b50b 4.4.0-141-generic #167~14.04.1-Ubuntu SMP Mon Dec 10 13:20:24 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux
Build tool maven
Personality personality/hadoop.sh
git revision trunk / 4cb3da6
Default Java 1.8.0_212
unit https://builds.apache.org/job/hadoop-multibranch/job/PR-798/9/artifact/out/patch-unit-hadoop-hdds.txt
unit https://builds.apache.org/job/hadoop-multibranch/job/PR-798/9/artifact/out/patch-unit-hadoop-ozone.txt
Test Results https://builds.apache.org/job/hadoop-multibranch/job/PR-798/9/testReport/
Max. process+thread count 3554 (vs. ulimit of 5500)
modules C: hadoop-hdds/common hadoop-hdds/server-scm hadoop-ozone/ozone-manager hadoop-ozone/ozone-recon U: .
Console output https://builds.apache.org/job/hadoop-multibranch/job/PR-798/9/console
versions git=2.7.4 maven=3.3.9 findbugs=3.1.0-RC1
Powered by Apache Yetus 0.10.0 http://yetus.apache.org

This message was automatically generated.

@bharatviswa504
Copy link
Contributor Author

Thank You @arp7 for the review.
I have addressed the review comments.

Copy link
Contributor

@anuengineer anuengineer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1, LGTM. Probably should wait for comments from @arp7 and @hanishakoneru

@@ -44,6 +44,7 @@
*/
Table<byte[], byte[]> getTable(String name) throws IOException;


Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: Space only change?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Committing this for now since Anu +1'ed.

* If the cacheKey already exists, it will override the entry.
* @param cacheKey
* @param cacheValue
*/
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thx makes sense.

@arp7
Copy link
Contributor

arp7 commented May 20, 2019

+1 LGTM.

@arp7 arp7 merged commit 0d1d7c8 into apache:trunk May 20, 2019
ajayydv pushed a commit to ajayydv/hadoop that referenced this pull request May 20, 2019
shanthoosh pushed a commit to shanthoosh/hadoop that referenced this pull request Oct 15, 2019
As per subject, this is to keep naming of local tables consistent with other table types.

Author: Wei Song <wsong@linkedin.com>

Reviewers: Prateek Maheshwari <pmaheshwari@linkedin.com>

Closes apache#798 from weisong44/SAMZA-1980 and squashes the following commits:

51c17ff4 [Wei Song] Renamed LocalStoreBackedTable to LocalTable
9c12120 [Wei Song] Merge remote-tracking branch 'upstream/master'
89bfc14 [Wei Song] Merge remote-tracking branch 'upstream/master'
a53e562 [Wei Song] SAMZA-1964 Make getTableSpec() in RemoteTableDescriptor reentrant
c9e8bf7 [Wei Song] Merge remote-tracking branch 'upstream/master'
7c777fe [Wei Song] Merge remote-tracking branch 'upstream/master'
a06e8ec [Wei Song] Merge remote-tracking branch 'upstream/master'
2c679c3 [Wei Song] Merge remote-tracking branch 'upstream/master'
a56c28d [Wei Song] Merge remote-tracking branch 'upstream/master'
097958c [Wei Song] Merge remote-tracking branch 'upstream/master'
05822f0 [Wei Song] Merge remote-tracking branch 'upstream/master'
f748050 [Wei Song] Merge remote-tracking branch 'upstream/master'
7706ab1 [Wei Song] Merge remote-tracking branch 'upstream/master'
f5731b1 [Wei Song] Merge remote-tracking branch 'upstream/master'
1e5de45 [Wei Song] Merge remote-tracking branch 'upstream/master'
c85604e [Wei Song] Merge remote-tracking branch 'upstream/master'
242d844 [Wei Song] Merge remote-tracking branch 'upstream/master'
ec7d840 [Wei Song] Merge remote-tracking branch 'upstream/master'
e19b4dc [Wei Song] Merge remote-tracking branch 'upstream/master'
8ee7844 [Wei Song] Merge remote-tracking branch 'upstream/master'
1c6a2ea [Wei Song] Merge remote-tracking branch 'upstream/master'
a6c94ad [Wei Song] Merge remote-tracking branch 'upstream/master'
41299b5 [Wei Song] Merge remote-tracking branch 'upstream/master'
239a095 [Wei Song] Merge remote-tracking branch 'upstream/master'
eca0020 [Wei Song] Merge remote-tracking branch 'upstream/master'
5156239 [Wei Song] Merge remote-tracking branch 'upstream/master'
de708f5 [Wei Song] Merge remote-tracking branch 'upstream/master'
df2f8d7 [Wei Song] Merge remote-tracking branch 'upstream/master'
f28b491 [Wei Song] Merge remote-tracking branch 'upstream/master'
4782c61 [Wei Song] Merge remote-tracking branch 'upstream/master'
0440f75 [Wei Song] Merge remote-tracking branch 'upstream/master'
aae0f38 [Wei Song] Merge remote-tracking branch 'upstream/master'
a15a7c9 [Wei Song] Merge remote-tracking branch 'upstream/master'
5cbf9af [Wei Song] Merge remote-tracking branch 'upstream/master'
3f7ed71 [Wei Song] Added self to committer list
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
6 participants