Toggle navigation
Toggle navigation
This project
Loading...
Sign in
홍길동
/
onos
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Snippets
Network
Create a new issue
Builds
Commits
Issue Boards
Authored by
Madan Jampani
2014-11-09 01:37:51 -0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
348a9fead4188b3631f37df18b20b9040700c0b1
348a9fea
1 parent
40f50b96
1. MapDBLog log size calculation bug fix.
2. Minor logging improvements.
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
29 additions
and
10 deletions
core/store/dist/src/main/java/org/onlab/onos/store/service/impl/InternalWriteResult.java
core/store/dist/src/main/java/org/onlab/onos/store/service/impl/MapDBLog.java
utils/netty/src/main/java/org/onlab/netty/NettyMessagingService.java
core/store/dist/src/main/java/org/onlab/onos/store/service/impl/InternalWriteResult.java
View file @
348a9fe
...
...
@@ -2,6 +2,8 @@ package org.onlab.onos.store.service.impl;
import
org.onlab.onos.store.service.WriteResult
;
import
com.google.common.base.MoreObjects
;
/**
* Result of a write operation executed on the DatabaseStateMachine.
*/
...
...
@@ -34,4 +36,12 @@ public class InternalWriteResult {
public
WriteResult
result
()
{
return
result
;
}
@Override
public
String
toString
()
{
return
MoreObjects
.
toStringHelper
(
getClass
())
.
add
(
"status"
,
status
)
.
add
(
"result"
,
result
)
.
toString
();
}
}
...
...
core/store/dist/src/main/java/org/onlab/onos/store/service/impl/MapDBLog.java
View file @
348a9fe
...
...
@@ -2,6 +2,7 @@ package org.onlab.onos.store.service.impl;
import
static
com
.
google
.
common
.
base
.
Preconditions
.
checkArgument
;
import
static
com
.
google
.
common
.
base
.
Preconditions
.
checkState
;
import
static
org
.
slf4j
.
LoggerFactory
.
getLogger
;
import
java.io.File
;
import
java.io.IOException
;
...
...
@@ -22,6 +23,7 @@ import org.mapdb.Serializer;
import
org.mapdb.TxBlock
;
import
org.mapdb.TxMaker
;
import
org.onlab.onos.store.serializers.StoreSerializer
;
import
org.slf4j.Logger
;
import
com.google.common.collect.Lists
;
...
...
@@ -30,6 +32,8 @@ import com.google.common.collect.Lists;
*/
public
class
MapDBLog
implements
Log
{
private
final
Logger
log
=
getLogger
(
getClass
());
private
final
File
dbFile
;
private
TxMaker
txMaker
;
private
final
StoreSerializer
serializer
;
...
...
@@ -273,7 +277,11 @@ public class MapDBLog implements Log {
size
.
addAndGet
(-
1
*
deletedBytes
);
byte
[]
entryBytes
=
serializer
.
encode
(
entry
);
byte
[]
existingEntry
=
log
.
put
(
index
,
entryBytes
);
size
.
addAndGet
(
entryBytes
.
length
-
existingEntry
.
length
);
if
(
existingEntry
!=
null
)
{
size
.
addAndGet
(
entryBytes
.
length
-
existingEntry
.
length
);
}
else
{
size
.
addAndGet
(
entryBytes
.
length
);
}
db
.
compact
();
}
});
...
...
utils/netty/src/main/java/org/onlab/netty/NettyMessagingService.java
View file @
348a9fe
...
...
@@ -15,14 +15,6 @@
*/
package
org
.
onlab
.
netty
;
import
java.io.IOException
;
import
java.net.UnknownHostException
;
import
java.util.concurrent.ConcurrentHashMap
;
import
java.util.concurrent.ConcurrentMap
;
import
java.util.concurrent.TimeUnit
;
import
java.util.concurrent.TimeoutException
;
import
java.util.concurrent.atomic.AtomicLong
;
import
io.netty.bootstrap.Bootstrap
;
import
io.netty.bootstrap.ServerBootstrap
;
import
io.netty.buffer.PooledByteBufAllocator
;
...
...
@@ -44,6 +36,14 @@ import io.netty.channel.socket.SocketChannel;
import
io.netty.channel.socket.nio.NioServerSocketChannel
;
import
io.netty.channel.socket.nio.NioSocketChannel
;
import
java.io.IOException
;
import
java.net.UnknownHostException
;
import
java.util.concurrent.ConcurrentHashMap
;
import
java.util.concurrent.ConcurrentMap
;
import
java.util.concurrent.TimeUnit
;
import
java.util.concurrent.TimeoutException
;
import
java.util.concurrent.atomic.AtomicLong
;
import
org.apache.commons.pool.KeyedPoolableObjectFactory
;
import
org.apache.commons.pool.impl.GenericKeyedObjectPool
;
import
org.slf4j.Logger
;
...
...
@@ -307,7 +307,8 @@ public class NettyMessagingService implements MessagingService {
futureResponse
.
set
(
message
.
payload
());
}
else
{
log
.
warn
(
"Received a reply for message id:[{}]. "
+
"But was unable to locate the request handle"
,
message
.
id
());
+
" from {}. But was unable to locate the"
+
" request handle"
,
message
.
id
(),
message
.
sender
());
}
}
finally
{
NettyMessagingService
.
this
.
responseFutures
.
invalidate
(
message
.
id
());
...
...
Please
register
or
login
to post a comment