Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
briar
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Julian Dehm
briar
Commits
4afcf2e4
Unverified
Commit
4afcf2e4
authored
9 years ago
by
akwizgran
Browse files
Options
Downloads
Patches
Plain Diff
Added logging to track down deletion bug.
parent
5bb8e95b
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
briar-core/src/org/briarproject/clients/MessageQueueManagerImpl.java
+12
-0
12 additions, 0 deletions
...src/org/briarproject/clients/MessageQueueManagerImpl.java
with
12 additions
and
0 deletions
briar-core/src/org/briarproject/clients/MessageQueueManagerImpl.java
+
12
−
0
View file @
4afcf2e4
...
@@ -27,6 +27,7 @@ import java.util.logging.Logger;
...
@@ -27,6 +27,7 @@ import java.util.logging.Logger;
import
javax.inject.Inject
;
import
javax.inject.Inject
;
import
static
java
.
util
.
logging
.
Level
.
INFO
;
import
static
org
.
briarproject
.
api
.
clients
.
QueueMessage
.
QUEUE_MESSAGE_HEADER_LENGTH
;
import
static
org
.
briarproject
.
api
.
clients
.
QueueMessage
.
QUEUE_MESSAGE_HEADER_LENGTH
;
import
static
org
.
briarproject
.
api
.
sync
.
SyncConstants
.
MESSAGE_HEADER_LENGTH
;
import
static
org
.
briarproject
.
api
.
sync
.
SyncConstants
.
MESSAGE_HEADER_LENGTH
;
...
@@ -179,6 +180,11 @@ class MessageQueueManagerImpl implements MessageQueueManager {
...
@@ -179,6 +180,11 @@ class MessageQueueManagerImpl implements MessageQueueManager {
long
queuePosition
=
ByteUtils
.
readUint64
(
m
.
getRaw
(),
long
queuePosition
=
ByteUtils
.
readUint64
(
m
.
getRaw
(),
MESSAGE_HEADER_LENGTH
);
MESSAGE_HEADER_LENGTH
);
QueueState
queueState
=
loadQueueState
(
txn
,
m
.
getGroupId
());
QueueState
queueState
=
loadQueueState
(
txn
,
m
.
getGroupId
());
if
(
LOG
.
isLoggable
(
INFO
))
{
LOG
.
info
(
"Received message with position "
+
queuePosition
+
", expecting "
+
queueState
.
incomingPosition
);
}
if
(
queuePosition
<
queueState
.
incomingPosition
)
{
if
(
queuePosition
<
queueState
.
incomingPosition
)
{
// A message with this queue position has already been seen
// A message with this queue position has already been seen
LOG
.
warning
(
"Deleting message with duplicate position"
);
LOG
.
warning
(
"Deleting message with duplicate position"
);
...
@@ -186,10 +192,12 @@ class MessageQueueManagerImpl implements MessageQueueManager {
...
@@ -186,10 +192,12 @@ class MessageQueueManagerImpl implements MessageQueueManager {
db
.
deleteMessageMetadata
(
txn
,
m
.
getId
());
db
.
deleteMessageMetadata
(
txn
,
m
.
getId
());
}
else
if
(
queuePosition
>
queueState
.
incomingPosition
)
{
}
else
if
(
queuePosition
>
queueState
.
incomingPosition
)
{
// The message is out of order, add it to the pending list
// The message is out of order, add it to the pending list
LOG
.
info
(
"Message is out of order, adding to pending list"
);
queueState
.
pending
.
put
(
queuePosition
,
m
.
getId
());
queueState
.
pending
.
put
(
queuePosition
,
m
.
getId
());
saveQueueState
(
txn
,
m
.
getGroupId
(),
queueState
);
saveQueueState
(
txn
,
m
.
getGroupId
(),
queueState
);
}
else
{
}
else
{
// The message is in order, pass it to the delegate
// The message is in order, pass it to the delegate
LOG
.
info
(
"Message is in order, delivering"
);
QueueMessage
q
=
new
QueueMessage
(
m
.
getId
(),
m
.
getGroupId
(),
QueueMessage
q
=
new
QueueMessage
(
m
.
getId
(),
m
.
getGroupId
(),
m
.
getTimestamp
(),
queuePosition
,
m
.
getRaw
());
m
.
getTimestamp
(),
queuePosition
,
m
.
getRaw
());
delegate
.
incomingMessage
(
txn
,
q
,
meta
);
delegate
.
incomingMessage
(
txn
,
q
,
meta
);
...
@@ -200,6 +208,10 @@ class MessageQueueManagerImpl implements MessageQueueManager {
...
@@ -200,6 +208,10 @@ class MessageQueueManagerImpl implements MessageQueueManager {
byte
[]
raw
=
db
.
getRawMessage
(
txn
,
id
);
byte
[]
raw
=
db
.
getRawMessage
(
txn
,
id
);
meta
=
db
.
getMessageMetadata
(
txn
,
id
);
meta
=
db
.
getMessageMetadata
(
txn
,
id
);
q
=
queueMessageFactory
.
createMessage
(
id
,
raw
);
q
=
queueMessageFactory
.
createMessage
(
id
,
raw
);
if
(
LOG
.
isLoggable
(
INFO
))
{
LOG
.
info
(
"Delivering pending message with position "
+
q
.
getQueuePosition
());
}
delegate
.
incomingMessage
(
txn
,
q
,
meta
);
delegate
.
incomingMessage
(
txn
,
q
,
meta
);
}
}
saveQueueState
(
txn
,
m
.
getGroupId
(),
queueState
);
saveQueueState
(
txn
,
m
.
getGroupId
(),
queueState
);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment