Skip to content

6. Eager Migration

Gang Liao edited this page Mar 10, 2021 · 19 revisions

Eager Migration

In eager migration, the system immediately physically moves all data stored under the old schema into tables in the new schema prior to becoming available to client requests over the new schema.

The implementation of eager migration is based on PostgreSQL with zero changes. This post will show you how to set up the raw PostgreSQL and how to run the TPC-C benchmark on top of that.

Quick Start

Using the following as a guide, we will walk you through the setup of BullFrog. To make it smoother, we record terminal sessions and share them on the web.

TODO

I. Docker Image

This tutorial assumes you have a current version of Docker installed on your machine. If you do not have Docker installed, choose your preferred operating system below to download Docker:

After you installed Docker, you can issue a command to pull our docker image and start a container:

# Pulls Docker image and run it on your local machine.
$ docker run --rm -it -d  --name bullfrog gangliao/bullfrog:eager_migration bash

# Output:
#
# Unable to find image 'gangliao/bullfrog:eager_migration' locally    
# latest: Pulling from gangliao/bullfrog
# ......: Pull complete
# ......: Pull complete
# ......: Pull complete
# Digest: sha256:......
# Status: Downloaded newer image for gangliao/bullfrog:eager_migration  

# Enters the container.
$ docker exec -u postgres -it bullfrog bash

# Output:
#
# postgres@968c58c4b04d:/$

II. BullFrog Experiments

  1. Deploy a DB instance:

    # Deploys the postgres backend
    $ cd /home/postgres/BullFrog && ./deploy.sh
    
    # Output:
    #
    # +++ case $- in
    # +++ return
    # ++ rm -rf /home/postgres/BullFrog/build/data
    # ++ initdb -D /home/postgres/BullFrog/build/data
    # The files belonging to this database system will be owned by user "postgres".
    # This user must also own the server process.
    # 
    # The database cluster will be initialized with locale "C".
    # The default database encoding has accordingly been set to "SQL_ASCII".
    # The default text search configuration will be set to "english".
    # 
    # Data page checksums are disabled.
    # 
    # creating directory /home/postgres/BullFrog/build/data ... ok
    # creating subdirectories ... ok
    # selecting default max_connections ... 100
    # selecting default shared_buffers ... 128MB
    # selecting dynamic shared memory implementation ... posix
    # creating configuration files ... ok
    # running bootstrap script ... Shared Global Bitmap created!
    # ok
    # performing post-bootstrap initialization ... ok
    # syncing data to disk ... ok
    # 
    # WARNING: enabling "trust" authentication for local connections
    # You can change this by editing pg_hba.conf or using the option -A, or
    # --auth-local and --auth-host, the next time you run initdb.
    # 
    # Success. You can now start the database server using:
    # 
    #     pg_ctl -D /home/postgres/BullFrog/build/data -l logfile start
    # 
    # ++ cp /home/postgres/postgresql.conf /home/postgres/BullFrog/build/data/
    # ++ pg_ctl -D /home/postgres/BullFrog/build/data -o '-F -p 5433' start
  2. Run a TPC-C Benchmark (without migration) where data is already loaded into the database.

III. Stop Database & Container

  1. You may want to shut down the database for any reason:

    $ cd /home/postgres/BullFrog && ./shutdown.sh
    
    # Output:
    #
    # ++ source /home/postgres/.bashrc
    # +++ case $- in
    # +++ return
    # ++ pg_ctl -D /home/postgres/BullFrog/build/data stop
    # waiting for server to shut down.... done
    # server stopped
    # ++ pg_ctl -D /home/postgres/BullFrog/build/data status
    # pg_ctl: no server running
  2. You may stop a running container when you finish the tutorial:

    $ docker stop bullfrog

Clone this wiki locally