Skip to content

Conversation

@ThomasGillespie
Copy link
Contributor

Fix bug where idb rollover fails to find new partition

.lg.o[`idb;"starting idb reload"];
if[writedownmode in `partbyenum`default;
.lg.o[`eod;"initialising wdbhdb for partition: ",string[currentpartition]];
$[.proc.proctype~`sort;{ws:exec w from .servers.getservers[`proctype;`wdb;()!();1b;0b];[first ws](`.wdb.initmissingtables;[1b])}[];initmissingtables[0b]];
Copy link
Member

Choose a reason for hiding this comment

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

what about sortworker processes? do they need to be handled?

why is the arg 1b if running it from sort process but 0b if running directly on wdb?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I don't believe the sortworker procs will ever be involved here but I could be wrong

When the initmissingtables function was called from the wdb with the new set up, it was called before currentpartition is updated to the next day

The new argument for the function allows the function to be called for either the current value of currentpartition or the next one.

Honestly not too sure on this, so I am open to suggestions

Copy link
Member

Choose a reason for hiding this comment

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

When the initmissingtables function was called from the wdb with the new set up, it was called before currentpartition is updated to the next day

Sorry I missed this comment earlier, I'm not really getting it. Why is it called before currentpartition is updated if called from wdb but after if called from sort? is there any chance of a timing issue here where if sort is very fast it could call it before it gets updated etc.?

this feels quite messy to me

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It seems to me that if the sorting is done by the sort proc, then the wdb has already moved on and updated currentpartiton, however when the wdb does the sort currentpartition hasn't been updated as the endofday method is blocked

Copy link
Member

@jonathonmcmurray jonathonmcmurray Nov 27, 2024

Choose a reason for hiding this comment

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

so should the initilisation of next partition perhaps be tied to wdb moving to next partition, rather than being tied to completion of EOD? to me it seems like if wdb is going to be already writing to new partition, we need to have initialised it?

.lg.o[`idb;"starting idb reload"];
if[writedownmode in `partbyenum`default;
.lg.o[`eod;"initialising wdbhdb for partition: ",string[currentpartition]];
$[.proc.proctype~`sort;{ws:exec w from .servers.getservers[`proctype;`wdb;()!();1b;0b];[first ws](`.wdb.initmissingtables;[1b])}[];initmissingtables[0b]];
Copy link
Member

Choose a reason for hiding this comment

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

When the initmissingtables function was called from the wdb with the new set up, it was called before currentpartition is updated to the next day

Sorry I missed this comment earlier, I'm not really getting it. Why is it called before currentpartition is updated if called from wdb but after if called from sort? is there any chance of a timing issue here where if sort is very fast it could call it before it gets updated etc.?

this feels quite messy to me

@ThomasGillespie
Copy link
Contributor Author

There might be a better way to to the initmissingtables to make sure it is right, going to look into this and try to come up with something better

Copy link
Member

@jonathonmcmurray jonathonmcmurray left a comment

Choose a reason for hiding this comment

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

Couple of little things, but looking good

];
};

/- funtion to initialise partition at EOD and notifyidbs to rollover, if .wdb.mode is not a sort mode, initmissingtables done on sort proc
Copy link
Member

Choose a reason for hiding this comment

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

this comment is a bit confusing, we don't seem to be checking .wdb.mode?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

https://github.com/DataIntellectTech/TorQ/pull/681/files#diff-6a3cbc5795f37aeb51ed652b0a6abb04020354619518f84a6c8423d0f888ca55R599
it's this line, if the proc type the function is running on is sort then the wdb mode is not a sort mode

Copy link
Member

Choose a reason for hiding this comment

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

ok, but my point is this comment refers to .wdb.mode, and we're not checking a variable by that name?

.save.postreplay:@[value;`.save.postreplay;{{[d;p] }}]; /-post EOD function, invoked after all the tables have been written down

/ - end of default parameters
- end of default parameters
Copy link
Member

Choose a reason for hiding this comment

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

this shouldn't have been removed

@ThomasGillespie ThomasGillespie merged commit b882e10 into master Nov 28, 2024
@jonathonmcmurray jonathonmcmurray deleted the 672-idb-reload-occurs-before-previous-partition-deleted-in-writedownmodedefault branch November 28, 2024 15:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

IDB reload occurs before previous partition deleted in writedownmode:`default

3 participants