sort crashes when no space for scratch area
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Trafodion |
Fix Committed
|
High
|
Prashanth Vasudev |
Bug Description
We saw this issue few times now especialy when running bulk loader. When there is not enough scatch space sort crashes.
we probably need to give an error messge instead.
#0 0x00000030b9889abb in memcpy () from /lib64/libc.so.6
Missing separate debuginfos, use: debuginfo-install cyrus-sasl-
(gdb) bt
#0 0x00000030b9889abb in memcpy () from /lib64/libc.so.6
#1 0x00007ff3b3b59177 in SQScratchFile:
#2 0x00007ff3b3b5924e in SQScratchFile:
#3 0x00007ff3b3b5ced5 in ScratchSpace:
at ../sort/
#4 0x00007ff3b3b5d131 in SortScratchSpac
#5 0x00007ff3b3b5d265 in SortScratchSpac
waited=0) at ../sort/
#6 0x00007ff3b3b58250 in Record::putToScr (this=0x7ff3a14
scratch=<value optimized out>, waited=<value optimized out>) at ../sort/
#7 0x00007ff3b3b5766c in Qsort::generateARun (this=0x7ff3a5a
#8 0x00007ff3b3b579e6 in Qsort::sortSend (this=0x7ff3a5a
at ../sort/
#9 0x00007ff3b5a794cc in ExSortTcb::sortSend (this=0x7ff3a90
pentry_
allocatedTu
#10 0x00007ff3b5a7b009 in ExSortTcb::workUp (this=0x7ff3a90
#11 0x00007ff3b5af8eb3 in ExScheduler::work (this=0x7ff3a8f
#12 0x00007ff3b5a306b2 in ExEspFragInstan
#13 0x0000000000405cff in runESP (argc=3, argv=0x7fff6172
#14 0x0000000000406103 in main (argc=3, argv=0x7fff6172
Changed in trafodion: | |
assignee: | nobody → Prashanth Vasudev (vasudev-prashanth) |
Changed in trafodion: | |
milestone: | none → r1.1 |
Changed in trafodion: | |
status: | New → In Progress |
After the temp file is created, its initial size is zero bytes. This temp file needs to be fully allocated before it is mmap’ed.
We resize the file by doing a lseek to the end of file followed by a write of one character to file. However write() does not flush this write to disk and also does not force allocation of all the blocks.
1. So instead of lseek and write, we now use posix_fallocate() . Performance is not a concern here since we are in overflow mode, also this happens only once for every new file. Any disk space issues is detected and would return ENOSPC (linux 28) error.
2. Added a try catch block around memcpy, incase of any other errors.