sql-profiled-util.sh 3.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. mkdir /tmp/profile-data
  2. rm -rf $IROOT/ffead-cpp-6.0-sql
  3. if [ "$1" = "batch-old" ]
  4. then
  5. apt remove -yqq libpq-dev
  6. apt autoremove -yqq
  7. rm -f /usr/local/lib/libpq.*
  8. rm -f /usr/include/postgres_ext.h /usr/include/pg_config_ext.h /usr/include/libpq-fe.h
  9. rm -f /usr/lib/x86_64-linux-gnu/libpq.*
  10. cd /tmp
  11. #wget -q https://github.com/an-tao/postgres/archive/batch_mode_ubuntu.tar.gz
  12. #tar -xzf batch_mode_ubuntu.tar.gz
  13. #cd postgres-batch_mode_ubuntu
  14. #./configure --prefix=/usr CFLAGS='-O2 -pipe -march=native'
  15. #make && make install
  16. wget -nv https://github.com/postgres/postgres/archive/b787d4ce6d910080065025bcd5f968544997271f.zip
  17. unzip -q b787d4ce6d910080065025bcd5f968544997271f.zip
  18. cd postgres-b787d4ce6d910080065025bcd5f968544997271f
  19. wget -nv https://www.postgresql.org/message-id/attachment/115223/v22-0001-libpq-batch.patch
  20. git apply ./v22-0001-libpq-batch.patch
  21. ./configure --prefix=/usr CFLAGS='-O3 -march=native -flto'
  22. cd src/interfaces/libpq
  23. make all install -j4
  24. cp ../../../src/include/postgres_ext.h ../../../src/include/pg_config_ext.h libpq-fe.h /usr/include
  25. fi
  26. if [ "$1" = "batch" ]
  27. then
  28. apt remove -yqq libpq-dev
  29. apt autoremove -yqq
  30. rm -f /usr/local/lib/libpq.*
  31. rm -f /usr/include/postgres_ext.h /usr/include/pg_config_ext.h /usr/include/libpq-fe.h
  32. rm -f /usr/lib/x86_64-linux-gnu/libpq.*
  33. PG_CMT=514b4c11d24701d2cc90ad75ed787bf1380af673
  34. wget -nv https://github.com/postgres/postgres/archive/$PG_CMT.zip
  35. unzip -q $PG_CMT.zip
  36. cd postgres-$PG_CMT
  37. ./configure --prefix=/usr CFLAGS='-O3 -march=native -flto'
  38. cd src/interfaces/libpq
  39. make all install -j4
  40. cp ../../../src/include/postgres_ext.h ../../../src/include/pg_config_ext.h /usr/include
  41. fi
  42. if [ "$2" = "clang" ]
  43. then
  44. apt update -yqq && apt install -yqq clang
  45. fi
  46. cd $IROOT/ffead-cpp-src/
  47. rm -rf $IROOT/ffead-cpp-sql-raw
  48. rm -rf CMakeCache.txt CMakeFiles
  49. rm -rf web/te-benchmark-um web/te-benchmark-um-mgr
  50. sed -i 's|add_subdirectory(${PROJECT_SOURCE_DIR}/web/te-benchmark-um)||g' CMakeLists.txt
  51. sed -i 's|add_subdirectory(${PROJECT_SOURCE_DIR}/web/te-benchmark-um-mgr)||g' CMakeLists.txt
  52. sed -i 's|install(FILES ${PROJECT_BINARY_DIR}/web/te-benchmark-um/libte-benchmark-um${LIB_EXT} DESTINATION ${PROJECT_NAME}-bin/lib)||g' CMakeLists.txt
  53. sed -i 's|install(FILES ${PROJECT_BINARY_DIR}/web/te-benchmark-um-mgr/libte-benchmark-um-mgr${LIB_EXT} DESTINATION ${PROJECT_NAME}-bin/lib)||g' CMakeLists.txt
  54. if [ "$3" = "async" ]
  55. then
  56. sed -i 's|add_subdirectory(${PROJECT_SOURCE_DIR}/web/te-benchmark-um-pq)||g' CMakeLists.txt
  57. sed -i 's|install(FILES ${PROJECT_BINARY_DIR}/web/te-benchmark-um-pq/libte-benchmark-um-pq${LIB_EXT} DESTINATION ${PROJECT_NAME}-bin/lib)||g' CMakeLists.txt
  58. sed -i 's|tfb-database|localhost|g' $IROOT/ffead-cpp-src/web/te-benchmark-um-pq-async/config/sdorm.xml
  59. rm -rf web/te-benchmark-um-pq
  60. if [ "$4" = "pool" ]
  61. then
  62. sed -i 's|"TeBkUmLpqAsyncRouter"|"TeBkUmLpqAsyncRouterPooled"|g' $IROOT/ffead-cpp-src/web/te-benchmark-um-pq-async/config/application.xml
  63. sed -i 's|TeBkUmLpqAsyncRouter|TeBkUmLpqAsyncRouterPooled|g' $IROOT/ffead-cpp-src/web/te-benchmark-um-pq-async/config/cachememory.xml
  64. fi
  65. else
  66. sed -i 's|add_subdirectory(${PROJECT_SOURCE_DIR}/web/te-benchmark-um-pq-async)||g' CMakeLists.txt
  67. sed -i 's|install(FILES ${PROJECT_BINARY_DIR}/web/te-benchmark-um-pq-async/libte-benchmark-um-pq-async${LIB_EXT} DESTINATION ${PROJECT_NAME}-bin/lib)||g' CMakeLists.txt
  68. sed -i 's|tfb-database|localhost|g' $IROOT/ffead-cpp-src/web/te-benchmark-um-pq/config/sdorm.xml
  69. rm -rf web/te-benchmark-um-pq-async
  70. fi