-
Notifications
You must be signed in to change notification settings - Fork 154
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
WIP: 64bit nanosecond jmapids #5177
base: master
Are you sure you want to change the base?
WIP: 64bit nanosecond jmapids #5177
Conversation
be60440
to
5599d95
Compare
63fc02b
to
4fb40bd
Compare
5d8190f
to
2e5b103
Compare
33bef57
to
deb2012
Compare
deb2012
to
8141e3d
Compare
This isn't complete yet but could probably use a sanity check. Reviewing commit-by-commit would probably be the easiest. |
@ksmurchison since this is a WIP review, could you please let me know the main file or functional areas you would like me to sanity check? |
You should probably look at conversations.c and jmap_mail.c |
Thanks, will do. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I gave conversations.c and jmap_mail.c a read. It looks to implement the requirements, I just have a question about refcounts as well as some thoughts about function names.
imap/conversations.c
Outdated
const char *data, *p; | ||
int r; | ||
|
||
if (strlen(jidrep) != CONV_JMAPID_SIZE) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this better return an internal error? Or is there any scenario where the caller might legitimately pass a jidrep that doesn't match the expected size?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess the JMAP code should be checking the id early, and this function can assume that its well-formed.
Should I remove this check?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would rather keep that check but either return CYRUSDB_INTERNAL (and assume that this gets logged properly by the caller), or log the incorrect size here and return NOTFOUND. My point is: if calling that with an invalid size is actually an error by the caller, then this function should not hide that just behind a NOTFOUND.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do you have a preference for the log level?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if it's an error to pass anything else but a validly sized id, then let's log it as ERROR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess I will have to audit every place where _guid_from_id() is called to see if it tries to validate the emailid.
I added the check just to short-circuit doing a DB lookup, because we know its going to fail.
imap/jmap_mail.c
Outdated
return msgid + 1; | ||
static char guidrep[2*MESSAGE_GUID_SIZE+1]; | ||
|
||
int r = conversations_lookup_jmapid(cstate, emailid + 1, guidrep); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
non-actionable comment: I get why this is done here, but it sucks to have a db call introduced into a function that formerly only had the cost of simple pointer arithmetic.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But that's why it was a function and not just emailid+1 inline right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Already the emailid+1 was really a code smell and I figured doing that in a single function at least contains that. It's not a big deal to call into conversations now, I guess, at least I don't see this being called in a hot loop (or is it?)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It shouldn't be
694df67
to
b57c6b2
Compare
store the encoded nanosecond value as a J(MAPID) key that maps to the GUID of an email
use a "virtual" annotation to pass this value via replication
b57c6b2
to
9f2e29a
Compare
9f2e29a
to
e46abdc
Compare
TODO: