|
1 | 1 | package io.pwrlabs.database.rocksdb; |
2 | 2 |
|
| 3 | +import com.sun.tools.javac.Main; |
3 | 4 | import io.pwrlabs.hashing.PWRHash; |
4 | 5 | import io.pwrlabs.util.encoders.BiResult; |
5 | 6 | import io.pwrlabs.util.encoders.ByteArrayWrapper; |
|
8 | 9 | import lombok.Getter; |
9 | 10 | import lombok.SneakyThrows; |
10 | 11 | import org.json.JSONObject; |
| 12 | +import org.junit.platform.commons.logging.LoggerFactory; |
11 | 13 | import org.rocksdb.*; |
12 | 14 |
|
13 | 15 | import java.io.File; |
|
27 | 29 | public class MerkleTree { |
28 | 30 |
|
29 | 31 | //region ===================== Statics ===================== |
| 32 | + private static final org.slf4j.Logger logger = org.slf4j.LoggerFactory.getLogger(Main.class); |
| 33 | + |
30 | 34 | static { |
31 | 35 | RocksDB.loadLibrary(); |
32 | 36 | } |
@@ -495,6 +499,7 @@ public void close() throws RocksDBException { |
495 | 499 | } |
496 | 500 |
|
497 | 501 | public MerkleTree clone(String newTreeName) throws RocksDBException, IOException { |
| 502 | + logger.info("Cloning MerkleTree: " + treeName + " to new tree: " + newTreeName); |
498 | 503 | long startTime = System.currentTimeMillis(); |
499 | 504 | errorIfClosed(); |
500 | 505 |
|
@@ -567,8 +572,10 @@ public void update(MerkleTree sourceTree) throws RocksDBException, IOException { |
567 | 572 | && Arrays.equals(getRootHashSavedOnDisk(), sourceTree.getRootHashSavedOnDisk()) |
568 | 573 | ) { |
569 | 574 | //This means that this tree is already a copy of the source tree and we only need to replace the cache |
| 575 | + logger.info("Updating MerkleTree: " + treeName + " with source tree: " + sourceTree.treeName + " by updating the cache"); |
570 | 576 | copyCache(sourceTree); |
571 | 577 | } else { |
| 578 | + logger.info("Updating MerkleTree: " + treeName + " with source tree: " + sourceTree.treeName + " by cloning the tree"); |
572 | 579 | if (metaDataHandle != null) { |
573 | 580 | metaDataHandle.close(); |
574 | 581 | metaDataHandle = null; |
|
0 commit comments