WorkloadTools icon indicating copy to clipboard operation
WorkloadTools copied to clipboard

Replay workload from file take db name from source and not from ReplayConsumer

Open hajerty opened this issue 3 years ago • 1 comments

Hi, I took my production trace and convert it into a .sqlite db. I used sqlite db as listener and defined the consumers as in the following sample. The trace saved into .sqlite db was taken on a db named dbA and I would have expected that the replay it would work on the dbB, but when I ran the tool, I figured out that the replay was working on dbA. So, why happened this? Did I wrong something?

Thank you so much

    "Consumers":
    [
        {
            "__type": "ReplayConsumer",
            "ConnectionInfo": 
            {
                "ServerName": "server",
                "DatabaseName": "dbB"
            }
        },
        {
            "__type": "AnalysisConsumer",
            "ConnectionInfo": 
            {
                "ServerName": "server",
                "DatabaseName": "SqlWorkload",
                "SchemaName": "xxxx"
            },
            "UploadIntervalSeconds": 3600
        }
    ]

hajerty avatar Jan 14 '22 13:01 hajerty

Hey! You can use the property DatabaseMap in the ReplayConsumer to remap commands from one database to another. Here's a link to the docs: https://github.com/spaghettidba/WorkloadTools/wiki/SqlWorkload#replayconsumer Example:

"DatabaseMap": {
        "databaseA": "databaseB"
        "databaseC": "databaseD"
    }

In this example, all queries running on databaseA are run against databaseB and all queries from databaseC go to databaseD. Hope this helps

spaghettidba avatar Jan 14 '22 16:01 spaghettidba